Description
the NCP operator currently leverages the package manifest format.
We should move to the bundle format
the main difference is that while in package manifest format all the data are packaged in a zipfile, the bundle will instead be packages as a docker image.
As per the file structure, the contents are really the same, but organised in a slightly different manner. Since the image itself now provides versioning, it's not necessary anymore to store in-tree different data for different versions.
However, additional facilities must be added to build the bundle docker image:
- A bundle Dockerfile, which could be something like the following:
FROM scratch
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=nsx-container-plugin-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.4.2
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v2
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
- A makefile target to build such bundle. This could be as simple as building the dockerfile above.
Please note the Dockerfile above contains some parameters that are specific to operator-sdk 1.4 and above. This version of the SDK operator includes facilities for generating all the needed bundle files using kustomize and kube-builder. For a similar example refer to the Antrea operator for Kubernetes.
However, rebuilding the NCP operator using a new SDK operator is a task that we can consider orthogonal to this issue. It will also require a non-negligible refactoring.
For the purpose of this issue we can probably just ensure that the operator CSV, the ncpinstall CRD, and the annotations yaml file are provided in a bundle
director from which we will build the bundle image.
As for annotation, it should be ok to remove the one pertaining to kubebuilder.
However, for OCP certification, the following annotations should be added both to metadata and to bundle image labels:
- com.redhat.openshift.versions for supported Openshift versions
- com.redhat.delivery.operator.bundle: True (this just need to be there)