Metadata Bundle Image The bundle image will house your metadata including the CSV.yaml, and the CRD.yaml.
When we ran the make bundle
command earlier, part of what was generated was the metadata bundle image.
Copy [nhartman@fedora wordpress]$ ls
bin charts Dockerfile Makefile requirements.lock values.schema.json
bundle Chart.yaml helm-charts PROJECT requirements.yaml values.yaml
bundle.Dockerfile config licenses README.md templates watches.yaml
Here you see the bundle.Dockerfile
in the root directory of your operator project. This is your Dockerfile for your metadata bundle image.
There are up to 3 labels you will need to add to the Dockerfile:
LABEL com.redhat.openshift.versions
This lists OpenShift versions, starting with 4.5, that your operator will support. See the section Managing OpenShift Versions for syntax and rules.
LABEL com.redhat.delivery.operator.bundle=true
This just needs to be there
LABEL com.redhat.deliver.backport=true
This is used to indicate support for OpenShift versions before 4.6. If you don't specify this flag, your operator won't be listed in 4.5 or earlier.
Copy 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=wordpress
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.0.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=helm.sdk.operatorframework.io/v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
#Add these labels
LABEL com.redhat.openshift.versions="v4.6"
LABEL com.redhat.delivery.operator.bundle=true
LABEL com.redhat.delivery.backport=true
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
Now lets build the bundle image from the bundle.Dockerfile. You can use an existing public container registry of your choice, though we recommend using quay.io. When you create a new repository make sure its publicly available.
The next step is to build the bundle-dockerfile locally and push it to quay.io for testing which we will cover in the Deploying onto OpenShift section
Copy podman build -t quay.io/<namespace>/wordpress-operator:v0.0.1 -f bundle.Dockerfile
Copy podman push quay.io/<namespace>/wordpress-operator:v0.0.1