一个operator bundle是一个特殊的container image。这个特殊的image存储了k8 manifests和与一个opearator相关联的metadata。一个bundle可以理解为一个特定版本的operator。
一个operator bundle通常是non-runnable的,但是其可以在oci-compliant container registry上一个push和pull。最终的,这个operator bundle可以被operator registry和OLM所用,用来在支持OLM的cluster上安装operator。
- $ tree operator-bundle-tet
- operator-bundle-tet
- ├── my-manifests
- │ ├── etcdcluster.crd.yaml
- │ └── etcdoperator.clusterserviceversion.yaml
- ├── metadata
- │ └── annotations.yaml
- └── Dockerfile
- $ tree
- /
- ├── manifests
- │ ├── etcdcluster.crd.yaml
- │ └── etcdoperator.clusterserviceversion.yaml
- └── metadata
- ├── annotations.yaml
- └── dependencies.yaml
其中, manifests和metadata的名字是可以改的,需要和annotations中的定义保持一致即可。
annodations.yml
- annotations:
- operators.operatorframework.io.bundle.mediatype.v1: "registry+v1"
- operators.operatorframework.io.bundle.manifests.v1: "manifests/"
- operators.operatorframework.io.bundle.metadata.v1: "metadata/"
- operators.operatorframework.io.bundle.package.v1: "test-operator"
- reflects the list of channels the bundle is subscribing to when added into an operator registry
- operators.operatorframework.io.bundle.channels.v1: "beta,stable"
- operators.operatorframework.io.bundle.channel.default.v1: "stable"
一个operator的依赖被定义在dependencies.yaml文件中。
- dependencies:
- - type: olm.package
- value:
- packageName: prometheus
- version: ">0.27.0"
- - type: olm.gvk
- value:
- group: etcd.database.coreos.com
- kind: EtcdCluster
- version: v1beta2
- FROM scratch
-
- # We are pushing an operator-registry bundle
- # that has both metadata and manifests.
- LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
- LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
- LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
- LABEL operators.operatorframework.io.bundle.package.v1=test-operator
- LABEL operators.operatorframework.io.bundle.channels.v1=beta,stable
- LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
-
- ADD test/*.yaml /manifests
- ADD test/metadata/annotations.yaml /metadata/annotations.yaml