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.
1
[[email protected] wordpress]$ ls
2
bin charts Dockerfile Makefile requirements.lock values.schema.json
3
bundle Chart.yaml helm-charts PROJECT requirements.yaml values.yaml
4
bundle.Dockerfile config licenses README.md templates watches.yaml
5
Copied!
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.
bundle.Dockerfile
1
FROM scratch
2
3
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
4
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
5
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
6
LABEL operators.operatorframework.io.bundle.package.v1=wordpress
7
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
8
LABEL operators.operatorframework.io.bundle.channel.default.v1=
9
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.0.0
10
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
11
LABEL operators.operatorframework.io.metrics.project_layout=helm.sdk.operatorframework.io/v1
12
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
13
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
14
15
#Add these labels
16
LABEL com.redhat.openshift.versions="v4.6"
17
LABEL com.redhat.delivery.operator.bundle=true
18
LABEL com.redhat.delivery.backport=true
19
20
COPY bundle/manifests /manifests/
21
COPY bundle/metadata /metadata/
22
COPY bundle/tests/scorecard /tests/scorecard/
23
Copied!
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
1
podman build -t quay.io/<namespace>/wordpress-operator:v0.0.1 -f bundle.Dockerfile
Copied!
1
podman push quay.io/<namespace>/wordpress-operator:v0.0.1
Copied!
Copy link