Skip to content

Adopt bundle format for the Operator #128

Open
@salv-orlando

Description

@salv-orlando

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:

  1. 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/
  1. 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)

Example: https://github.com/vmware/antrea-operator-for-kubernetes/pull/25/files#diff-05b673b667f06134d9ecd4d5a022ad2cc1e125a50bc7df1bf3221d9cb9eb9010

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions