Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 0a7b7e4

Browse files
authored
Merge pull request #120 from darkowlzz/metadata-update-verify
Automate OLM metadata update and verify
2 parents 409b9de + b9fa75e commit 0a7b7e4

14 files changed

+405
-168
lines changed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,15 @@ metadata-zip:
7676
deploy/olm/storageos/storageosupgrade.crd.yaml \
7777
deploy/olm/csv-rhel/storageos.clusterserviceversion.yaml
7878

79+
metadata-update:
80+
# Update all the metadata files in-place.
81+
bash scripts/metadata-checker/update-metadata-files.sh
82+
7983
# Lint the OLM metadata bundle.
8084
olm-lint:
85+
# Generate metadata files and verify all the metadata files are up-to-date.
86+
bash scripts/metadata-checker/metadata-diff-checker.sh
87+
# Verify the OLM metada using operator-courier.
8188
docker run -it --rm -v $(PWD)/deploy/olm/storageos/:/storageos \
8289
python:3 bash -c "pip install operator-courier && operator-courier verify --ui_validate_io /storageos"
8390

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ for more information.
2323

2424
## Setup/Development
2525

26-
1. Install [operator-sdk](https://github.com/operator-framework/operator-sdk/tree/master#quick-start).
27-
2. Run `operator-sdk generate k8s` if there's a change in api type.
28-
3. Build operator container with `operator-sdk build storageos/cluster-operator:<tag>`
29-
4. Apply the manifests in `deploy/` to install the operator
26+
1. Build operator container image with `make image/cluster-operator`. Publish or
27+
copy this container image to an existing k8s cluster to make it available
28+
for use within the cluster.
29+
2. Apply the manifests in `deploy/` to install the operator
3030
* Apply `namespace.yaml` to create the `storageos-operator` namespace.
3131
* Apply `service_account.yaml`, `role.yaml` and `role_binding.yaml` to create
3232
a service account and to grant all the permissions.
@@ -53,7 +53,11 @@ make image/cluster-operator OPERATOR_IMAGE=storageos/cluster-operator:test
5353

5454
This builds all the components and copies the binaries into the same container.
5555

56-
After creating a resource, query the resource:
56+
For any changes related to Operator Lifecycle Manager(OLM), update
57+
`deploy/storageos-operators.configmap.yaml` and run `make metadata-update` to
58+
automatically update all the CRD, CSV and package files.
59+
60+
After creating a StorageOSCluster resource, query the resource:
5761

5862
```bash
5963
$ kubectl get storageoscluster

deploy/olm/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## csv-rhel/
2+
3+
This directory contains all the CSV files for rhel releases.
4+
5+
## storageos/
6+
7+
This directory contains all the CSV files for community operator releases. It
8+
also contains CRD and package files. This directory is also used to create a
9+
diff and submit a PR to the community operator repo for publishing new
10+
release. rhel releases uses the CRD and package files from this directory.
11+
12+
## olm.sh
13+
14+
This script contains helper functions to setup OLM in a cluster, install
15+
the storageos operator and install storageos. Also includes scripts to
16+
uninstallation everything it installs.
17+
18+
19+
## community-changes.yaml, rhel-changes.yaml, package-changes.yaml
20+
21+
These files are update scripts for the yaml files used by yq yaml processor.

deploy/olm/community-changes.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
metadata.name: storageosoperator.v1.1.0
2+
metadata.namespace: placeholder
3+
metadata.annotations.containerImage: storageos/cluster-operator:1.1.0
4+
spec.version: 1.1.0
5+
spec.install.spec.deployments[0].spec.template.spec.containers[0].image: storageos/cluster-operator:1.1.0

deploy/olm/csv-rhel/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ change, a new CSV with incremented version must be created.
1010
## Release Instructions
1111

1212
To create a new release:
13-
1. Update `metadata.annotations.containerImage` and deployment image with the
14-
new operator container image and `spec.version` to the new release version
15-
number in `storageos.clusterserviceversion.yaml`.
13+
1. Update `metadata.name` with new version name,
14+
`metadata.annotations.containerImage` and
15+
`spec.install.spec.deployments[0].spec.template.spec.containers[0].image` with
16+
the new operator container image, and `spec.version` to the new release version
17+
number in `deploy/olm/rhel-changes.yaml`. Run `make metadata-update` to generate
18+
`storageos.clusterserviceversion.yaml`.
19+
Any other change in the CSV file must be made in
20+
`deploy/storageos-operators.configmap.yaml` and regenerate all the metadata
21+
files.
22+
1623
2. Run `make metadata-zip` from the root of the project to generate a metadata
1724
zip file at `/build/_output/storageos-olm-metadata.zip`. This file can be
1825
directly uploaded to the rhel operator metadata scanner for a new release.
@@ -23,4 +30,4 @@ the repo to keep a record of the releases.
2330
## Testing
2431

2532
Run `make metadata-bundle-lint` from the root of the project to create a
26-
metadata bundle and lint it before submitting a new release.
33+
metadata bundle at `build/_output/` and lint it before submitting a new release.

deploy/olm/csv-rhel/storageos.clusterserviceversion.yaml

Lines changed: 62 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ metadata:
55
namespace: placeholder
66
annotations:
77
capabilities: Full Lifecycle
8-
categories: "Storage"
8+
categories: Storage
99
description: Cloud-native, persistent storage for containers.
1010
containerImage: registry.connect.redhat.com/storageos/cluster-operator:1.1.0
1111
repository: https://github.com/storageos/cluster-operator
12-
createdAt: 2019-04-17T08:00:00Z
12+
createdAt: "2019-04-17T08:00:00Z"
1313
support: StorageOS, Inc
1414
certified: "true"
1515
alm-examples: |-
@@ -54,7 +54,6 @@ metadata:
5454
}
5555
}
5656
]
57-
5857
spec:
5958
displayName: StorageOS
6059
description: |
@@ -151,36 +150,32 @@ spec:
151150
on any platform while maintaining full control of business requirements
152151
around availability, data mobility, performance, security, data residency
153152
compliance and business continuity.
154-
155-
keywords: ['storageos', 'storage', 'persistent storage', 'open source']
156-
153+
keywords:
154+
- storageos
155+
- storage
156+
- persistent storage
157+
- open source
157158
version: 1.1.0
158-
minKubeVersion: "1.10.0"
159+
minKubeVersion: 1.10.0
159160
maturity: stable
160161
maintainers:
161162
- name: StorageOS, Inc
162163
163-
164164
provider:
165165
name: StorageOS, Inc
166-
167166
labels:
168167
operated-by: storageosoperator
169-
170168
selector:
171169
matchLabels:
172170
operated-by: storageosoperator
173-
174171
links:
175172
- name: Documentation
176173
url: https://docs.storageos.com/
177174
- name: StorageOS Operator Source Code
178175
url: https://github.com/storageos/cluster-operator
179-
180176
icon:
181177
- base64data: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9Ii05MCAyODQuNyA0MzAgNDMwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IC05MCAyODQuNyA0MzAgNDMwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGZpbGw9IiM0RjUyNjMiIGQ9Ik0yNzguNSw0MjAuOWgtNzQuMWwtNS42LTkuN2wxMy42LTIzLjZsLTE4LjEtMzEuM0gxODBsMjcuNS00Ny43YzMtNS4xLDEuMi0xMS43LTMuOS0xNC42DQoJCWMtNS4xLTMtMTEuNy0xLjItMTQuNiwzLjlsLTM0LDU4LjhIOTMuMmwtMzQtNTguOGMtMi45LTUuMS05LjUtNi45LTE0LjYtMy45cy02LjksOS41LTMuOSwxNC42bDI3LjUsNDcuN0g1My45bC0xOC4xLDMxLjMNCgkJbDEzLjYsMjMuNmwtNS42LDkuOGgtNzQuMmwtNDMuMyw3NC45bDQzLjMsNzQuOWg3NC4xbDM0LDU4LjlMNzksNjI5bC0xLjIsMC44bDQ2LjQsNzcuMmw0Ni4yLTc3LjNsMCwwbDM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zdmc+DQo=
182178
mediatype: image/svg+xml
183-
184179
installModes:
185180
- type: OwnNamespace
186181
supported: true
@@ -190,7 +185,6 @@ spec:
190185
supported: false
191186
- type: AllNamespaces
192187
supported: true
193-
194188
install:
195189
strategy: deployment
196190
spec:
@@ -204,14 +198,14 @@ spec:
204198
- storageosupgrades
205199
- jobs
206200
verbs:
207-
- "*"
201+
- '*'
208202
- apiGroups:
209203
- apps
210204
resources:
211205
- statefulsets
212206
- daemonsets
213207
verbs:
214-
- "*"
208+
- '*'
215209
- apiGroups:
216210
- ""
217211
resources:
@@ -324,7 +318,7 @@ spec:
324318
fieldRef:
325319
fieldPath: metadata.annotations['olm.targetNamespaces']
326320
- name: OPERATOR_NAME
327-
value: "cluster-operator"
321+
value: cluster-operator
328322
ports:
329323
- containerPort: 8080
330324
name: metrics
@@ -334,34 +328,34 @@ spec:
334328
version: v1
335329
kind: StorageOSCluster
336330
displayName: StorageOS Cluster
337-
description: StorageOS Cluster installs StorageOS in the cluster. It
338-
contains all the configuration for setting up a StorageOS cluster and
339-
also shows the status of the running StorageOS cluster.
331+
description: StorageOS Cluster installs StorageOS in the cluster. It contains
332+
all the configuration for setting up a StorageOS cluster and also shows the
333+
status of the running StorageOS cluster.
340334
specDescriptors:
341335
- description: Defines the various container images used in the cluster.
342336
displayName: Images
343337
path: images
344-
- description: The namespace to install the StorageOS cluster into.
345-
`kube-system` is recommended so that StorageOS does not get evicted if
346-
a node becomes over-allocated.
338+
- description: The namespace to install the StorageOS cluster into. `kube-system`
339+
is recommended so that StorageOS does not get evicted if a node becomes
340+
over-allocated.
347341
displayName: Namespace
348342
path: namespace
349343
- description: The name of the secret object that stores the api credentials.
350344
displayName: Cluster Secret
351345
path: secretRefName
352-
- description: The name of the namespace where the secret object that
353-
stores the api credentials exists.
346+
- description: The name of the namespace where the secret object that stores
347+
the api credentials exists.
354348
displayName: Cluster Secret Namespace
355349
path: secretRefNamespace
356-
- description: The join token is used for cluster discovery. When used
357-
with the Operator, the token will be a comma-separated list of all
358-
cluster member IP addresses. The node that owns the first IP address
359-
listed will be responsible for bootsrapping the cluster.
350+
- description: The join token is used for cluster discovery. When used with
351+
the Operator, the token will be a comma-separated list of all cluster member
352+
IP addresses. The node that owns the first IP address listed will be responsible
353+
for bootsrapping the cluster.
360354
displayName: Cluster members
361355
path: join
362-
- description: KV store configuration to use. Defaults to embedded. `etcd`
363-
is recommended for production deployments with the address set to an
364-
external etcd instance.
356+
- description: KV store configuration to use. Defaults to embedded. `etcd` is
357+
recommended for production deployments with the address set to an external
358+
etcd instance.
365359
displayName: KV Store
366360
path: kvBackend
367361
- description: Describes the Container Storage Interface (CSI) configuration.
@@ -370,52 +364,50 @@ spec:
370364
- description: The cluster Service configuration.
371365
displayName: Service configuration
372366
path: service
373-
- description: The shared directory where storage devices should be
374-
created. This directory must be available to both the StorageOS Node
375-
container and the kubelet, and must have mount propagation enabled.
376-
When kubelet is running in a container,
377-
`/var/lib/kubelet/plugins/kubernetes.io~storageos` should normally be
378-
set, otherwise leave empty.
367+
- description: The shared directory where storage devices should be created. This
368+
directory must be available to both the StorageOS Node container and the
369+
kubelet, and must have mount propagation enabled. When kubelet is running
370+
in a container, `/var/lib/kubelet/plugins/kubernetes.io~storageos` should
371+
normally be set, otherwise leave empty.
379372
displayName: Device directory
380373
path: sharedDir
381-
- description: Describes the ingress configuration to be configured for
382-
the cluster.
374+
- description: Describes the ingress configuration to be configured for the
375+
cluster.
383376
displayName: Ingress configuration
384377
path: ingress
385-
- description: The name of the secret object that contains the etcd TLS
386-
certificates.
378+
- description: The name of the secret object that contains the etcd TLS certificates.
387379
displayName: etcd TLS Secret Name
388380
path: tlsEtcdSecretRefName
389-
- description: The namespace of the secret object that contains the etcd
390-
TLS certificates.
381+
- description: The namespace of the secret object that contains the etcd TLS
382+
certificates.
391383
displayName: etcd TLS Secret Namespace
392384
path: tlsEtcdSecretRefNamespace
393-
- description: Node selector terms can be set to control the placement of
394-
StorageOS pods using node affiinity.
385+
- description: Node selector terms can be set to control the placement of StorageOS
386+
pods using node affiinity.
395387
displayName: Node Selectors
396388
path: nodeSelectorTerms
397-
- description: Tolerations can be set to control the placement of
398-
StorageOS pods.
389+
- description: Tolerations can be set to control the placement of StorageOS
390+
pods.
399391
displayName: Tolerations
400392
path: tolerations
401-
- description: Name of the Kubernetes distribution in use, e.g.
402-
`openshift`. This will be included in the product telemetry (if
403-
enabled), to help focus development efforts.
393+
- description: Name of the Kubernetes distribution in use, e.g. `openshift`. This
394+
will be included in the product telemetry (if enabled), to help focus development
395+
efforts.
404396
displayName: Kubernetes Distribution Name
405397
path: k8sDistro
406-
- description: To disable anonymous usage reporting across the cluster,
407-
set to true. Defaults to false. To help improve the product, data such
408-
as API usage and StorageOS configuration information is collected.
398+
- description: To disable anonymous usage reporting across the cluster, set
399+
to true. Defaults to false. To help improve the product, data such as API
400+
usage and StorageOS configuration information is collected.
409401
displayName: Disable Telemetry
410402
path: disableTelemetry
411-
- description: When Pod Fencing is disabled, StorageOS will not perform
412-
any interaction with Kubernetes when it detects that a node has gone
413-
offline. Additionally, the Kubernetes permissions required for Fencing
414-
will not be added to the StorageOS role.
403+
- description: When Pod Fencing is disabled, StorageOS will not perform any
404+
interaction with Kubernetes when it detects that a node has gone offline.
405+
Additionally, the Kubernetes permissions required for Fencing will not be
406+
added to the StorageOS role.
415407
displayName: Disable Fencing
416408
path: disableFencing
417-
- description: When enabled, the Operator will not perform any actions on
418-
the cluster.
409+
- description: When enabled, the Operaaor will not perform any actions on the
410+
cluster.
419411
displayName: Pause Operator
420412
path: pause
421413
- description: Enables debug logging when set to true.
@@ -442,9 +434,9 @@ spec:
442434
version: v1
443435
kind: Job
444436
displayName: StorageOS Job
445-
description: StorageOS Job creates special pods that run on all the node
446-
and perform an administrative task. This could be used for cluster
447-
maintenance tasks.
437+
description: StorageOS Job creates special pods that run on all the node and
438+
perform an administrative task. This could be used for cluster maintenance
439+
tasks.
448440
specDescriptors:
449441
- description: The container image to run as the job.
450442
displayName: Image
@@ -458,15 +450,15 @@ spec:
458450
- description: The path on the host that is mounted into the job container.
459451
displayName: Source path
460452
path: hostPath
461-
- description: The job is marked as completed when the completion word is
462-
found in the pod logs.
453+
- description: The job is marked as completed when the completion word is found
454+
in the pod logs.
463455
displayName: Source Path
464456
path: completionWord
465457
- description: A label selector can be set to identify Pods created by the job.
466458
displayName: Label Selector
467459
path: labelSelector
468-
- description: Node selector terms can be set to control the placement of
469-
job pods using node affiinity.
460+
- description: Node selector terms can be set to control the placement of job
461+
pods using node affiinity.
470462
displayName: Node Selectors
471463
path: nodeSelectorTerms
472464
- description: Tolerations can be set to control the placement of job pods.
@@ -480,11 +472,10 @@ spec:
480472
version: v1
481473
kind: StorageOSUpgrade
482474
displayName: StorageOS Upgrade
483-
description: StorageOS Upgrade automatically upgrades an existing
484-
StorageOS cluster as per the upgrade configuration.
475+
description: StorageOS Upgrade automatically upgrades an existing StorageOS
476+
cluster as per the upgrade configuration.
485477
specDescriptors:
486-
- description: The StorageOS Node image to upgrade to.
487-
e.g. `registry.connect.redhat.com/storageos/node:latest`
478+
- description: The StorageOS Node image to upgrade to. e.g. `registry.connect.redhat.com/storageos/node:latest`
488479
displayName: New Image
489480
path: newImage
490481
statusDescriptors:

deploy/olm/package-changes.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
channels[0].currentCSV: storageosoperator.v1.1.0

0 commit comments

Comments
 (0)