Skip to content

Commit 9ac9961

Browse files
authored
Complete documentation coverage of registry operator (#46)
* Add more commands in README Signed-off-by: Philippe Martin <[email protected]> * Remove definition of NAMESPACE when executing make run, which seems not used Signed-off-by: Philippe Martin <[email protected]> * Update CONTRIBUTING Signed-off-by: Philippe Martin <[email protected]> * Document DevfileRegistry resource Signed-off-by: Philippe Martin <[email protected]> * Update REGISTRIES_LISTS Signed-off-by: Philippe Martin <[email protected]> * Fix typo "ociRegistryImage" instead of registryVolumeSize and secretName Signed-off-by: Philippe Martin <[email protected]> * No doc about Storage Signed-off-by: Philippe Martin <[email protected]> * Update CONTRIBUTING Signed-off-by: Philippe Martin <[email protected]> --------- Signed-off-by: Philippe Martin <[email protected]>
1 parent dea070a commit 9ac9961

File tree

7 files changed

+221
-25
lines changed

7 files changed

+221
-25
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ You can tag Devfile Registry related issues with the `/area registry` text in yo
1717
### Development
1818

1919
#### First Time Setup
20-
1. Install prerequisites:
21-
- Go 1.13 or higher
22-
- Docker or Podman
23-
- Operator-SDK 1.11.0 or higher (including `controller-gen` 0.6.0 or higher)
20+
1. Install prerequisites: see [Requirements section in README](README.md#requirements).
2421

2522
2. Fork and clone this repository.
2623

@@ -35,9 +32,11 @@ You can tag Devfile Registry related issues with the `/area registry` text in yo
3532

3633
4. Run `make docker-push` to push the devfile registry operator image.
3734

38-
5. Run `make install` to install the CRDs
35+
5. Run `make install-cert` to install the cert-manager.
3936

40-
6. Run `make deploy` to deploy the operator.
37+
6. Run `make install` to install the CRDs.
38+
39+
7. Run `make deploy` to deploy the operator.
4140

4241
### Testing your Changes
4342

@@ -55,7 +54,7 @@ To run these tests, run the following commands :
5554

5655
```bash
5756
export IMG=<your-built-operator-image>
58-
make test_integration
57+
make test-integration
5958
```
6059

6160

DEVFILE_REGISTRY.md

Lines changed: 146 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ The Devfile Registry custom resource allows you to create and manage your own in
44

55
## Deploying a Devfile Registry
66

7-
Once the Devfile Registry operator has been deployed to a cluster, it's straightforward to deploy a Devfile Registry. The following samples below showcase how the registry can be deployed on to an OpenShift or Kubernetes cluster.
7+
Once the Devfile Registry operator has been deployed to a cluster, you can deploy a Devfile Registry by creating custom resources. The following samples below showcase how the registry can be deployed on to an OpenShift or Kubernetes cluster.
88

99
In addition to the examples below, the `samples/` folder in this repo provides some example devfile registry yaml files for convenience.
1010

1111

1212
### OpenShift
1313

14-
Installing the devfile registry via the devfile registry operator on an OpenShift cluster can be done in one easy command:
14+
Installing the devfile registry via the devfile registry operator on an OpenShift cluster can be done with this command:
1515

1616
```bash
1717
$ cat <<EOF | oc apply -f -
@@ -30,7 +30,7 @@ EOF
3030

3131
### Kubernetes
3232

33-
Installing the devfile registry on a Kubernetes cluster is similar, but requires setting the `k8s.ingressDomain` field first.
33+
Installing the devfile registry on a Kubernetes cluster is similar, but requires setting the `k8s.ingressDomain` field.
3434

3535
```bash
3636
$ export INGRESS_DOMAIN=<my-ingress-domain>
@@ -61,3 +61,146 @@ If you want to send telemetry information to your own Segment instance, specify
6161
key: <your-segment-write-key>
6262
registryViewerWriteKey: <your-segment-write-key>
6363
```
64+
65+
## Using Specific Container Images
66+
67+
By default, the operator deploys a Devfile Registry using a Pod containing three containers:
68+
69+
- `devfile-registry` container runs the API serving the Devfile stacks. The container image used by default
70+
is `quay.io/devfile/devfile-index:next` and you can change it with the field `spec.devfileIndex.image`.
71+
- `oci-registry` container runs a standard OCI registry, serving the stacks in the OCI format.
72+
The container image used by default is `quay.io/devfile/oci-registry:next` and you can change it with the field `spec.ociRegistry.image`.
73+
- `registry-viewer` container runs a web frontend, to help the user brwose the Devfile stacks.
74+
The container image used by default is `quay.io/devfile/registry-viewer:next` and you can change it with the field `spec.registryViewer.image`.
75+
76+
```bash
77+
$ cat <<EOF | oc apply -f -
78+
apiVersion: registry.devfile.io/v1alpha1
79+
kind: DevfileRegistry
80+
metadata:
81+
name: my-devfile-registry
82+
spec:
83+
devfileIndex:
84+
image: quay.io/my-devfile/devfile-index:next
85+
ociRegistry:
86+
image: quay.io/my-devfile/oci-registry:next
87+
registryViewer:
88+
image: quay.io/my-devfile/registry-viewer:next
89+
EOF
90+
```
91+
92+
### Defining the ImagePullPolicy for pulling containers
93+
94+
By default, the containers will be pulled depending on the policy set on the Kubernetes or OpenShift cluster the registry is deployed on.
95+
96+
You can set a specific pull policy for each container, by setting the fields `spec.devfileIndex.imagePullPolicy`, `spec.ociRegistry.imagePullPolicy` and `spec.registryViewer.imagePullPolicy` to a value `IfNotPresent`, `Always` or `Never`. See the [Kubernetes documentation](https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy) for more information.
97+
98+
99+
```bash
100+
$ cat <<EOF | oc apply -f -
101+
apiVersion: registry.devfile.io/v1alpha1
102+
kind: DevfileRegistry
103+
metadata:
104+
name: my-devfile-registry
105+
spec:
106+
devfileIndex:
107+
image: quay.io/my-devfile/devfile-index:next
108+
imagePullPolicy: Always
109+
ociRegistry:
110+
image: quay.io/my-devfile/oci-registry:next
111+
imagePullPolicy: Always
112+
registryViewer:
113+
image: quay.io/my-devfile/registry-viewer:next
114+
imagePullPolicy: Always
115+
EOF
116+
```
117+
118+
## Disabling the web frontend
119+
120+
You can ask the operator to deploy the Devfile Registry without the `registry-viewer` container, by setting the field `spec.headless` to `true`.
121+
122+
```bash
123+
$ cat <<EOF | oc apply -f -
124+
apiVersion: registry.devfile.io/v1alpha1
125+
kind: DevfileRegistry
126+
metadata:
127+
name: headless-devfile-registry
128+
spec:
129+
devfileIndex:
130+
image: quay.io/devfile/devfile-index:next
131+
telemetry:
132+
registryName: test
133+
headless: true
134+
EOF
135+
```
136+
137+
## Configuring TLS for Ingress/Route resource
138+
139+
The operator creates a Route resource (on OpenShift) or an Ingress resources (on Kubernetes)
140+
to give access to the Web frontend.
141+
142+
By default, the Ingress or Route is secured by TLS.
143+
144+
You can ask the operator to disable the use of TLS by setting the field `spec.tls.enabled` to false.
145+
146+
```bash
147+
$ cat <<EOF | kubectl apply -f -
148+
apiVersion: registry.devfile.io/v1alpha1
149+
kind: DevfileRegistry
150+
metadata:
151+
name: devfile-registry
152+
spec:
153+
devfileIndex:
154+
image: quay.io/devfile/devfile-index:next
155+
telemetry:
156+
registryName: test
157+
tls:
158+
enabled: false
159+
EOF
160+
```
161+
162+
You can ask the operator to configure the TLS with a specific certificate, by specifying a secret
163+
containing the certificate and the associated private key using the field `spec.tls.secretName`:
164+
165+
```bash
166+
$ kubectl create secret tls my-tls-secret --key=certs/ingress-tls.key --cert=certs/ingress-tls.crt
167+
168+
$ cat <<EOF | kubectl apply -f -
169+
apiVersion: registry.devfile.io/v1alpha1
170+
kind: DevfileRegistry
171+
metadata:
172+
name: devfile-registry
173+
spec:
174+
devfileIndex:
175+
image: quay.io/devfile/devfile-index:next
176+
telemetry:
177+
registryName: test
178+
tls:
179+
enabled: true
180+
secretName: my-tls-secret
181+
EOF
182+
```
183+
184+
## Configuring the Ingress Domain
185+
186+
On Kubernetes, the operator needs to know the Domain associated with the cluster, to create an Ingress
187+
with this specific domain. You need to indicate the Ingress domain with the field `spec.k8s.ingressDomain`.
188+
189+
190+
```bash
191+
$ export INGRESS_DOMAIN=<my-ingress-domain>
192+
193+
$ cat <<EOF | kubectl apply -f -
194+
apiVersion: registry.devfile.io/v1alpha1
195+
kind: DevfileRegistry
196+
metadata:
197+
name: devfile-registry
198+
spec:
199+
devfileIndex:
200+
image: quay.io/devfile/devfile-index:next
201+
telemetry:
202+
registryName: test
203+
k8s:
204+
ingressDomain: $INGRESS_DOMAIN
205+
EOF
206+
```

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Some of the rules supported by the makefile:
6060

6161
|rule|purpose|
6262
|---|---|
63+
| controller-gen | install the controll-gen tool, used by other commands |
64+
| kustomize | install the kustomize tool, used by other commands |
6365
| docker-build | build registry operator docker image |
6466
| docker-push | push registry operator docker image |
6567
| deploy | deploy operator to cluster |
@@ -71,34 +73,52 @@ Some of the rules supported by the makefile:
7173
| manifests | Generate manifests e.g. CRD, RBAC etc. |
7274
| generate | Generate the API type definitions. Must be run after modifying the DevfileRegistry type. |
7375
| bundle | Generate bundle manifests and metadata, then validate generated files. |
74-
| test_integration | Run the integration tests for the operator. |
76+
| test-integration | Run the integration tests for the operator. |
7577
| test | Run the unit tests for the operator. |
78+
| fmt | Check code formatting |
79+
| fmt_license | Ensure license header is set on all files |
80+
| vet | Check suspicious constructs into code |
81+
| gosec | Check for security problems in non-test source files |
7682

7783
To see all rules supported by the makefile, run `make help`
7884

7985
## Testing
8086

8187
To run integration tests for the operator, run `make test-integration`.
8288

83-
By default, the tests will use the default image for the operator, `quay.io/devfile/registry-operator:next`. To use your own image, run:
89+
The `oc` executable must be accessible.
90+
91+
By default, the tests will use the default image for the operator, `quay.io/devfile/registry-operator:next`.
92+
93+
You can use `make docker-build` to build your own image, `make docker-push` to publish it. Then, to use your own image, run:
8494

8595
```
86-
export IMG=<your-operator-image>
87-
make test-integration
96+
IMG=<your-operator-image> make test-integration
8897
```
8998

9099
### Run operator locally
91100
It's possible to run an instance of the operator locally while communicating with a cluster.
92101

93-
1. Build the binary
102+
1. You may need to install the `controller-gen` tool before, used when building the binary:
103+
104+
```bash
105+
make controller-gen
106+
```
107+
108+
2. Build the binary
94109

95110
```bash
96111
make manager
97112
```
98113

99-
2. Run the controller
114+
3. Deploy the CRDs
115+
116+
```bash
117+
make install
118+
```
119+
120+
4. Run the controller
100121

101122
```bash
102-
export NAMESPACE=devfileregistry-operator
103123
make run ENABLE_WEBHOOKS=false
104124
```

REGISTRIES_LISTS.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Registries Lists
22

3-
The Cluster/Devfile Registries Lists allow admins to specify multiple devfile registries to expose devfiles from various sources for use within the cluster or namespace. In order to be added to the list, the devfile registries must be reachable and support the Devfile v2.0 spec and above.
3+
The Devfile Registries Lists allow admins to specify multiple devfile registries to expose devfiles from various sources for use within the cluster or namespace. In order to be added to the list, the devfile registries must be reachable and support the Devfile v2.0 spec and above.
44

55
>**ClusterDevfileRegistriesList** is a custom resource where cluster admins can add a list of devfile registries to allow devfiles to be visible at the cluster level.
66
77

88
> **DevfileRegistriesList** is a custom resource where cluster admins can add a list of devfile registries to allow devfiles to be visible at the namespace level. Registries in this list will take precedence over the ones in the ClusterDevfileRegistriesList if there is a conflict.
99
10-
## Deploying a Cluster or Devfile Registries List
10+
## Deploying a Cluster or Namespaced Devfile Registries List
1111

1212
Note the following limitations when deploying a new list type:
1313
* Only one ClusterDevfileRegistriesList can be installed per cluster. If there is an existing list, you will encounter a validation error.
@@ -49,7 +49,41 @@ spec:
4949
EOF
5050
```
5151

52+
#### Skipping the TLS Verification
5253

54+
The operator contacts each Devfile Registry of the list, to check its validity.
55+
56+
In a non-production environment, you may want the operator to Skip the TLS Verification during this call, by setting the field `skipTLSVerify` for the Devfile Registry:
57+
58+
```bash
59+
$ cat <<EOF | kubectl apply -f -
60+
apiVersion: registry.devfile.io/v1alpha1
61+
kind: ClusterDevfileRegistriesList
62+
metadata:
63+
name: cluster-list
64+
spec:
65+
devfileRegistries:
66+
- name: devfile-staging
67+
url: 'https://registry.stage.devfile.io'
68+
skipTLSVerify: true
69+
EOF
70+
```
71+
72+
or
73+
74+
```bash
75+
$ cat <<EOF | kubectl apply -f -
76+
apiVersion: registry.devfile.io/v1alpha1
77+
kind: DevfileRegistriesList
78+
metadata:
79+
name: namespace-list
80+
spec:
81+
devfileRegistries:
82+
- name: devfile-staging
83+
url: 'https://registry.stage.devfile.io'
84+
skipTLSVerify: true
85+
EOF
86+
```
5387

5488
## Updating the Cluster or Devfile Registries List
5589

api/v1alpha1/devfileregistry_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type DevfileRegistrySpecStorage struct {
8181
// Configures the size of the devfile registry's persistent volume, if enabled.
8282
// Defaults to 1Gi.
8383
// +optional
84-
RegistryVolumeSize string `json:"ociRegistryImage,omitempty"`
84+
RegistryVolumeSize string `json:"registryVolumeSize,omitempty"`
8585
}
8686

8787
// DevfileRegistrySpecTLS defines the desired state for TLS in the DevfileRegistry
@@ -93,7 +93,7 @@ type DevfileRegistrySpecTLS struct {
9393

9494
// Name of an optional, pre-existing TLS secret to use for TLS termination on ingress/route resources.
9595
// +optional
96-
SecretName string `json:"ociRegistryImage,omitempty"`
96+
SecretName string `json:"secretName,omitempty"`
9797
}
9898

9999
// DevfileRegistrySpecK8sOnly defines the desired state of the kubernetes-only fields of the DevfileRegistry

bundle/manifests/registry.devfile.io_devfileregistries.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ spec:
108108
description: Instructs the operator to deploy the DevfileRegistry
109109
with persistent storage Disabled by default.
110110
type: boolean
111-
ociRegistryImage:
111+
registryVolumeSize:
112112
description: Configures the size of the devfile registry's persistent
113113
volume, if enabled. Defaults to 1Gi.
114114
type: string
@@ -142,7 +142,7 @@ spec:
142142
with TLS enabled. Enabled by default. Disabling is only recommended
143143
for development or test.
144144
type: boolean
145-
ociRegistryImage:
145+
secretName:
146146
description: Name of an optional, pre-existing TLS secret to use
147147
for TLS termination on ingress/route resources.
148148
type: string

config/crd/bases/registry.devfile.io_devfileregistries.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ spec:
109109
description: Instructs the operator to deploy the DevfileRegistry
110110
with persistent storage Disabled by default.
111111
type: boolean
112-
ociRegistryImage:
112+
registryVolumeSize:
113113
description: Configures the size of the devfile registry's persistent
114114
volume, if enabled. Defaults to 1Gi.
115115
type: string
@@ -143,7 +143,7 @@ spec:
143143
with TLS enabled. Enabled by default. Disabling is only recommended
144144
for development or test.
145145
type: boolean
146-
ociRegistryImage:
146+
secretName:
147147
description: Name of an optional, pre-existing TLS secret to use
148148
for TLS termination on ingress/route resources.
149149
type: string

0 commit comments

Comments
 (0)