Table of Contents generated with DocToc
- Operand Deployment Lifecycle Manager (ODLM)
The operand is the instance managed by the operator. ODLM is used to manage the lifecycle of for a group of operands, compared with operator lifecycle manager, ODLM focus on the management of operands but not operators.
Operator is a method of packaging, deploying and managing a Kubernetes application. Operands are the services and applications that Operator manage.
For example, cert-manager operator deploys a cert-manager deployment, then the cert-manager-operator is an operator and the cert-manager deployment is an operand.
The ODLM will have four CRDs:
Resource | Short Name | Description |
---|---|---|
OperandRequest | opreq | It defines which operator/operand want to be installed in the cluster |
OperandRegistry | opreg | It defines the OLM information, like channel and catalog source, for each operator |
OperandConfig | opcon | It defines the parameters that should be used to install the operator's operand |
OperandBindInfo | opbi | It identifies secrets and/or configmaps that should be shared with requests |
- A single entry point to manage a group of operands
- User can select a set of operands to install
- The install can be invoked through either OCP UI or CLI
OperandRegistry defines the OLM information used for installation, like package name and catalog source, for each operator.
Following is an example of the OperandRegistry CR:
NOTE: The "spec.operators[*].name" parameter must be unique for each entry.
apiVersion: operator.ibm.com/v1alpha1
kind: OperandRegistry
metadata:
name: example-service [1]
namespace: example-service-ns [2]
spec:
operators:
- name: jenkins [3]
namespace: default [4]
channel: alpha [5]
packageName: jenkins-operator [6]
scope: public [7]
sourceName: community-operators [8]
sourceNamespace: openshift-marketplace [9]
installMode: cluster [10]
installPlanApproval: Manual [11]
The OperandRegistry Custom Resource (CR) lists OLM Operator information for operands that may be requested for installation and/or access by an application that runs in a namespace. The registry CR specifies:
name
of the OperandRegistrynamespace
of the OperandRegistryname
is the name of the operator, which should be the same as the services name in the OperandConfig and OperandRequest.- (optional)
namespace
defines the namespace where the operator will be deployed. (1) When InstallMode iscluster
, the operator will be deployed into theopenshift-operators
namespace. (2) When InstallMode is empty or set tonamespace
, it is the namespace where operator will be deployed. (3) If thenamespace
value is empty, the operator will be deployed in the same namespace as this OperandRegistry. channel
is the name of OLM channel that is subscribed for the operator.packageName
is the name of the package in CatalogSource that is subscribed for the operator.- (optional)
scope
is an indicator, either public or private, that dictates whether deployment can be requested from other namespaces (public) or only from the namespace of this OperandRegistry (private). The default value is private. sourceName
is the name of the CatalogSource.sourceNamespace
is the namespace of the CatalogSource.- (optional)
installMode
is the install mode of the operator, can benamespace
(OLM one namespace),cluster
(OLM all namespaces) orno-op
(discontinued service). The default value isnamespace
. Operator is deployed inopenshift-operators
namespace when InstallMode is set tocluster
. - (optional)
installPlanApproval
is the approval mode for emitted installplan. The default value isAutomatic
.
OperandConfig defines the individual operand configuration. The OperandConfig Custom Resource (CR) defines the parameters for each operator that is listed in the OperandRegistry that should be used to install the operator instance by specifying an installation CR.
apiVersion: operator.ibm.com/v1alpha1
Kind: OperandConfigs
metadata:
name: example-service [1]
namespace: example-service-ns [2]
spec:
services:
- name: jenkins [3]
spec: [4]
jenkins:
port: 8081
OperandConfig defines the individual operand deployment config:
name
of the OperandConfignamespace
of the OperandConfigname
is the name of the operator, which should be the same as the services name in the OperandRegistry and OperandRequest.spec
defines a map. Its key is the kind name of the custom resource. Its value is merged to the spec field of custom resource. For more details, you can check the following topic How does ODLM create the individual operator CR?
Jenkins Operator has one CRD: Jenkins:
The OperandConfig CR has
- name: jenkins
spec:
jenkins:
service:
port: 8081
The Jenkins Operator CSV has
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: |-
[
{
"apiVersion":"jenkins.io/v1alpha2",
"kind":"Jenkins",
"metadata": {
"name":"example"
},
"spec":{
...
"service":{"port":8080,"type":"ClusterIP"},
...
}
}
]
The ODLM will deep merge the OperandConfig CR spec and Jenkins Operator CSV alm-examples to create the Jenkins CR.
apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
...
service:
port: 8081
type: ClusterIP
...
For day2 operations, the ODLM will patch the OperandConfigs CR spec to the existing Jenkins CR.
OperandRequest defines which operator/operand you want to install in the cluster.
NOTE: OperandRequest custom resource is used to trigger a deployment for Operators and Operands.
apiVersion: operator.ibm.com/v1alpha1
kind: OperandRequest
metadata:
name: example-service [1]
namespace: example-service-ns [2]
spec:
requests:
- registry: example-service [3]
registryNamespace: example-service-ns [4]
operands: [5]
- name: jenkins [6]
bindings: [7]
public:
secret: jenkins-operator-credential [8]
configmap: jenkins-operator-base-configuration [9]
name
of the OperandRequestnamespace
of the OperandRequestregistry
identifies the name of the OperandRegistry CR from which this operand deployment is being requested.- (optional)
registryNamespace
identifies the namespace in which the OperandRegistry CR is defined. Note: If theregistryNamespace
is not specified then it is assumed that the OperandRegistry CR is in the current (OperandRequest's) namespace. operands
in the CR is a list of operands.name
of operands in the CR must match a name specification in an OperandRegistry's CR.- (optional) The
bindings
of the operands is a map to get and rename the secret and/or configmap from the provider and create them in the requester's namespace. If the requester wants to rename the secret and/or configmap, they need to know the key of the binding in the OperandBindInfo. If the key of the bindings map is prefixed with public, it means the secret and/or configmap can be shared with the requester in the other namespace. If the key of the bindings map is prefixed with private, it means the secret and/or configmap can only be shared within its own namespace. - (optional)
secret
names a secret that should be created in the requester's namespace with formatted data that can be used to interact with the service. - (optional)
configmap
names a configmap that should be created in the requester's namespace with formatted data that can be used to interact with the service.
apiVersion: operator.ibm.com/v1alpha1
kind: OperandRequest
metadata:
name: example-service
namespace: example-service-ns
spec:
requests:
- registry: example-service
registryNamespace: example-service-ns
operands:
- name: jenkins
kind: Jenkins [1]
apiVersion: "jenkins.io/v1alpha2" [2]
instanceName: "example" [3]
spec: [4]
service:
port: 8081
kind
of the target custom resource. If it is set in the operand item, ODLM will create CR according to OperandRequest only and get rid of the alm-example and OperandConfig.apiVersion
of the target custom resource.instanceName
is the name of the custom resource. IfinstanceName
is not set, the name of the custom resource will be created with the name of the OperandRequest as a prefix.spec
is the spec field of the target CR.
The ODLM will use the OperandBindInfo to copy the generated secret and/or configmap to a requester's namespace when a service is requested with the OperandRequest CR. An example specification for an OperandBindInfo CR is shown below.
apiVersion: operator.ibm.com/v1alpha1
kind: OperandBindInfo
metadata:
name: publicjenkinsbinding [1]
namespace: example-service-ns [2]
spec:
operand: jenkins [3]
registry: example-service [4]
registryNamespace: example-service-ns [5]
description: "Binding information that should be accessible to jenkins adopters" [6]
bindings: [7]
public:
secret: jenkins-operator-credentials-example [8]
configmap: jenkins-operator-base-configuration-example [9]
Fields in this CR are described below.
name
of the OperandBindInfonamespace
of the OperandBindInfo- The
operand
should be the the individual operator name. - The
registry
identifies the name of the OperandRegistry CR in which this operand information is registered. - (optional)
registryNamespace
identifies the namespace in which the OperandRegistry CR is defined. Note: If theregistryNamespace
is not specified then it is assumed that the OperandRegistry CR is in the current (OperandBindInfo's) namespace. description
is used to add a detailed description of a service.- The
bindings
section is used to specify information about the access/configuration data that is to be shared. If the key of the bindings map is prefixed with public, it means the secret and/or configmap can be shared with the requester in the other namespace. If the key of the bindings map is prefixed with private, it means the secret and/or configmap can only be shared within its own namespace. If the key of the bindings map is prefixed with protected, it means the secret and/or configmap can only be shared if it is explicitly declared in the OperandRequest. - The
secret
field names an existing secret, if any, that has been created and holds information that is to be shared with the requester. - The
configmap
field identifies a configmap object, if any, that should be shared with the requester
ODLM will use the OperandBindInfo CR to pass information to an adopter when they create a OperandRequest to access the service, assuming that both have compatible scopes. ODLM will copy the information from the shared service's "OperandBindInfo.bindinfo[].secret" and/or "OperandBindInfo.bindinfo[].configmap" to the requester namespace.
NOTE: If in the OperandRequest, there is no secret and/or configmap name specified in the bindings or no bindings field in the element of operands, ODLM will copy the secret and/or configmap to the requester's namespace and rename them to the name of the OperandBindInfo + secret/configmap name.
-
User installs ODLM from OLM
The ODLM will automatically generate two default CRD CRs, since OperandRegistry and OperandConfigs CRs don't define the state, so it should be fine.
-
Optional: Users can update the OperandConfigs CR with their own parameter values
Users can skip this step if the default configurations match the requirement.
-
User creates the OperandRequest CR from OLM
This tells ODLM that users want to install some of the individual operator/operand.
-
The rest works will be done by OLM and ODLM
Finally, users will get what they want.
- For operator/operand upgrade, you only need to publish your operator OLM to your operator channel, and OLM will handle the upgrade automatically.
- If there are major version, then you may want to update
channel
inOperandRegistry
to trigger upgrade.