Dockerfile Requirements
The Dockerfile can be found in the root directory of your operator. For Certified Operator Image Dockerfile requirements are as follows:
  1. 1.
    You must configure the required labels (name, maintainer, vendor, version, release, summary)
  2. 2.
    Software license(s) must be included within the image.
Although typically labels and licenses are not required to successfully build a running image, they are required for the Red Hat build service and scanner.
Below is an example Dockerfile for a Ansible Operator which includes the aforementioned requirements:
Dockerfile
1
FROM registry.redhat.io/openshift4/ose-ansible-operator:v4.7
2
3
### Required OpenShift Labels
4
LABEL name="Mongodb Operator" \
5
vendor="RHSCL" \
6
version="v0.0.1" \
7
release="1" \
8
summary="This is an example of a mongodb ansible operator." \
9
description="This operator will deploy mongodb to the cluster."
10
11
COPY requirements.yml ${HOME}/requirements.yml
12
RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \
13
&& chmod -R ug+rwx ${HOME}/.ansible
14
15
# Required Licenses
16
COPY licenses /licenses
17
18
COPY watches.yaml ${HOME}/watches.yaml
19
COPY roles/ ${HOME}/roles/
20
COPY playbooks/ ${HOME}/playbooks/
21
Copied!
A few things to note about the Dockerfile above:
  • The default FROM line produced by the SDK needs to be replaced with the line listed above.
  • This Dockerfile contains all of the required labels. These labels must be manually added (name, vendor, version, release, summary, and description).
  • If you are planning to use a playbook, that file will also need to be copied.
  • Lastly, this Dockerfile also references a licenses/ directory, which needs to be manually added to the root of the project. This directory must include the software license(s) of your project.
Your project directory structure should look similar to the hierarchy below. Note the location of the licenses directory.
mongodb-operator
1
├── config
2
│   ├── crd
3
│   │   ├── bases
4
│   │   │   └── nosql.mogodb.com_mongodbs.yaml
5
│   │   └── kustomization.yaml
6
│   ├── default
7
│   │   ├── kustomization.yaml
8
│   │   └── manager_auth_proxy_patch.yaml
9
│   ├── manager
10
│   │   ├── kustomization.yaml
11
│   │   └── manager.yaml
12
│   ├── prometheus
13
│   │   ├── kustomization.yaml
14
│   │   └── monitor.yaml
15
│   ├── rbac
16
│   │   ├── auth_proxy_client_clusterrole.yaml
17
│   │   ├── auth_proxy_role_binding.yaml
18
│   │   ├── auth_proxy_role.yaml
19
│   │   ├── auth_proxy_service.yaml
20
│   │   ├── kustomization.yaml
21
│   │   ├── leader_election_role_binding.yaml
22
│   │   ├── leader_election_role.yaml
23
│   │   ├── mongodb_editor_role.yaml
24
│   │   ├── mongodb_viewer_role.yaml
25
│   │   ├── role_binding.yaml
26
│   │   └── role.yaml
27
│   ├── samples
28
│   │   ├── kustomization.yaml
29
│   │   └── nosql_v1alpha1_mongodb.yaml
30
│   ├── scorecard
31
│   │   ├── bases
32
│   │   │   └── config.yaml
33
│   │   ├── kustomization.yaml
34
│   │   └── patches
35
│   │   ├── basic.config.yaml
36
│   │   └── olm.config.yaml
37
│   └── testing
38
│   ├── debug_logs_patch.yaml
39
│   ├── kustomization.yaml
40
│   ├── manager_image.yaml
41
│   └── pull_policy
42
│   ├── Always.yaml
43
│   ├── IfNotPresent.yaml
44
│   └── Never.yaml
45
├── Dockerfile
46
├── licenses
47
│   └── MIT.txt
48
├── Makefile
49
├── molecule
50
│   ├── default
51
│   │   ├── converge.yml
52
│   │   ├── create.yml
53
│   │   ├── destroy.yml
54
│   │   ├── kustomize.yml
55
│   │   ├── molecule.yml
56
│   │   ├── prepare.yml
57
│   │   ├── tasks
58
│   │   │   └── mongodb_test.yml
59
│   │   └── verify.yml
60
│   └── kind
61
│   ├── converge.yml
62
│   ├── create.yml
63
│   ├── destroy.yml
64
│   └── molecule.yml
65
├── playbooks
66
├── PROJECT
67
├── requirements.yml
68
├── roles
69
│   └── mongodb
70
│   ├── defaults
71
│   │   └── main.yml
72
│   ├── files
73
│   ├── handlers
74
│   │   └── main.yml
75
│   ├── meta
76
│   │   └── main.yml
77
│   ├── README.md
78
│   ├── tasks
79
│   │   └── main.yml
80
│   ├── templates
81
│   └── vars
82
│   └── main.yml
83
└── watches.yaml
84
Copied!
Last modified 8mo ago
Copy link