Skip to content

Commit 70f35c7

Browse files
committed
Update OLM bundle generation
This commit makes the following changes to the OLM bundle generation logic: - Update the version replacement value for OLM to 5.0.5 - Update the minimum supported Kubernetes version to 1.19 - Update logo files - Update related images to exclude PG 12 and PG Upgrade (only in marketplace, removed to provide consistent images) - Fix operator annotations for certified and marketplace - Update README with information regarding issues encountered with 5.1.0 bundles - Update post bundle generation README instructions - Update generation logic to match expected file, project and package names. - Add a comment that minKubeVersion must support the related OCP version range. Issue: [sc-13935]
1 parent 2f62605 commit 70f35c7

File tree

9 files changed

+106
-171
lines changed

9 files changed

+106
-171
lines changed

installers/favicon.png

-28.5 KB
Binary file not shown.

installers/olm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
CONTAINER ?= docker
55
PGO_VERSION ?= 5.1.0
6-
REPLACES_VERSION ?= 5.0.4
6+
REPLACES_VERSION ?= 5.0.5
77

88
OS_KERNEL ?= $(shell bash -c 'echo $${1,,}' - `uname -s`)
99
OS_MACHINE ?= $(shell bash -c 'echo $${1/x86_/amd}' - `uname -m`)

installers/olm/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,62 @@ tests. Consult the [technical requirements][hub-contrib] when making changes.
1919

2020
<!-- registry.connect.redhat.com/crunchydata/postgres-operator-bundle -->
2121

22+
## Notes
23+
24+
### v5 Versions per Repository
25+
26+
Community: https://github.com/k8s-operatorhub/community-operators/tree/main/operators/postgresql
27+
28+
5.0.2
29+
5.0.3
30+
5.0.4
31+
5.0.5
32+
5.1.0
33+
34+
Community Prod: https://github.com/redhat-openshift-ecosystem/community-operators-prod/tree/main/operators/postgresql
35+
36+
5.0.2
37+
5.0.3
38+
5.0.4
39+
5.0.5
40+
5.1.0
41+
42+
Certified: https://github.com/redhat-openshift-ecosystem/certified-operators/tree/main/operators/crunchy-postgres-operator
43+
44+
5.0.4
45+
5.0.5
46+
5.1.0
47+
48+
Marketplace: https://github.com/redhat-openshift-ecosystem/redhat-marketplace-operators/tree/main/operators/crunchy-postgres-operator-rhmp
49+
50+
5.0.4
51+
5.0.5
52+
5.1.0
53+
54+
### Issues Encountered
55+
56+
We hit various issues with 5.1.0 where the 'replaces' name, set in the clusterserviceversion.yaml, didn't match the
57+
expected names found for all indexes. Previously, we set the 'com.redhat.openshift.versions' annotation to "v4.6-v4.9".
58+
The goal for this setting was to limit the upper bound of supported versions for a particulary PGO release.
59+
The problem with this was, at the time of the 5.1.0 release, OCP 4.10 had been just been released. This meant that the
60+
5.0.5 bundle did not exist in the OCP 4.10 index. The solution presented by Red Hat was to use the 'skips' clause for
61+
the 5.1.0 release to remedy the immediate problem, but then go back to using an unbounded setting for subsequent
62+
releases.
63+
64+
For the certified, marketplace and community repositories, this strategy of using 'skips' instead of replaces worked as
65+
expected. However, for the production community operator bundle, we were seeing a failure that required adding an
66+
additional 'replaces' value of 5.0.4 in addition to the 5.0.5 'skips' value. While this allowed the PR to merge, it
67+
seems at odds with the behavior at the other repos.
68+
69+
For more information on the use of 'skips' and 'replaces', please see:
70+
https://olm.operatorframework.io/docs/concepts/olm-architecture/operator-catalog/creating-an-update-graph/
71+
72+
73+
Another version issue encountered was related to our attempt to both support OCP v4.6 (which is an Extended Update
74+
Support (EUS) release) while also limiting Kubernetes to 1.20+. The issue with this is that OCP 4.6 utilizes k8s 1.19
75+
and the kube minversion validation was in fact limiting the OCP version as well. Our hope was that those setting would
76+
be treated independently, but that was unfortunately not the case. The fix for this was to move this kube version to the
77+
1.19, despite its being released 3rd quarter of 2020 with 1 year of patch support.
2278

2379
## Testing
2480

@@ -52,3 +108,11 @@ docker push "$INDEX_IMAGE"
52108
operator-sdk cleanup postgresql --namespace="$NAMESPACE"
53109
kubectl -n "$NAMESPACE" delete operatorgroup olm-operator-group
54110
```
111+
112+
### Post Bundle Generation
113+
114+
After generating and testing the OLM bundles, there are two manual steps.
115+
116+
1. Update the image SHA values (denoted with '<update_SHA_value>', required for both the Red Hat 'Certified' and
117+
'Marketplace' bundles)
118+
2. Update the 'description.md' file to indicate which OCP versions this release of PGO was tested against.

installers/olm/bundle.annotations.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ annotations:
3333
# https://github.com/operator-framework/community-operators/blob/8a36a33/docs/packaging-required-criteria-ocp.md
3434
# https://redhat-connect.gitbook.io/certified-operator-guide/ocp-deployment/operator-metadata/bundle-directory
3535
com.redhat.delivery.operator.bundle: true
36-
com.redhat.openshift.versions: 'v4.6-v4.10'
36+
com.redhat.openshift.versions: 'v4.6'
3737

3838
...

installers/olm/bundle.csv.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ spec:
5555
5656

5757
# https://olm.operatorframework.io/docs/best-practices/common/
58-
minKubeVersion: 1.18.0
58+
# Note: The minKubeVersion must correspond to the lowest supported OCP version
59+
minKubeVersion: 1.19.0
5960
maturity: stable
6061
# https://github.com/operator-framework/operator-lifecycle-manager/blob/v0.18.2/doc/design/how-to-update-operators.md#replaces--channels
6162
replaces: '' # generate.sh

installers/olm/bundle.relatedImages.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
relatedImages:
2+
- name: PGADMIN
3+
image: registry.connect.redhat.com/crunchydata/crunchydata/crunchy-pgadmin4@sha256:<update_SHA_value>
24
- name: PGBACKREST
35
image: registry.connect.redhat.com/crunchydata/crunchy-pgbackrest@sha256:<update_SHA_value>
46
- name: PGBOUNCER
57
image: registry.connect.redhat.com/crunchydata/crunchy-pgbouncer@sha256:<update_SHA_value>
68
- name: PGEXPORTER
79
image: registry.connect.redhat.com/crunchydata/crunchy-postgres-exporter@sha256:<update_SHA_value>
8-
- name: POSTGRES_12
9-
image: registry.connect.redhat.com/crunchydata/crunchy-postgres@sha256:<update_SHA_value>
1010
- name: POSTGRES_13
1111
image: registry.connect.redhat.com/crunchydata/crunchy-postgres@sha256:<update_SHA_value>
1212
- name: POSTGRES_14
1313
image: registry.connect.redhat.com/crunchydata/crunchy-postgres@sha256:<update_SHA_value>
14-
- name: POSTGRES_12_GIS_2.5
15-
image: registry.connect.redhat.com/crunchydata/crunchy-postgres-gis@sha256:<update_SHA_value>
16-
- name: POSTGRES_12_GIS_3.0
17-
image: registry.connect.redhat.com/crunchydata/crunchy-postgres-gis@sha256:<update_SHA_value>
1814
- name: POSTGRES_13_GIS_3.0
1915
image: registry.connect.redhat.com/crunchydata/crunchy-postgres-gis@sha256:<update_SHA_value>
2016
- name: POSTGRES_13_GIS_3.1

installers/olm/config/redhat/related-images.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@ spec:
1212
spec:
1313
containers:
1414
- name: operator
15+
image: registry.connect.redhat.com/crunchydata/postgres-operator@sha256:<update_SHA_value>
1516
env:
16-
- { name: RELATED_IMAGE_PGADMIN, value: 'registry.connect.redhat.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-0' }
17-
- { name: RELATED_IMAGE_PGBACKREST, value: 'registry.connect.redhat.com/crunchydata/crunchy-pgbackrest:ubi8-2.38-0' }
18-
- { name: RELATED_IMAGE_PGBOUNCER, value: 'registry.connect.redhat.com/crunchydata/crunchy-pgbouncer:ubi8-1.16-2' }
19-
- { name: RELATED_IMAGE_PGEXPORTER, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-exporter:ubi8-5.1.0-0' }
17+
- { name: RELATED_IMAGE_PGADMIN, value: 'registry.connect.redhat.com/crunchydata/crunchy-pgadmin4@sha256:<update_SHA_value>' }
18+
- { name: RELATED_IMAGE_PGBACKREST, value: 'registry.connect.redhat.com/crunchydata/crunchy-pgbackrest@sha256:<update_SHA_value>' }
19+
- { name: RELATED_IMAGE_PGBOUNCER, value: 'registry.connect.redhat.com/crunchydata/crunchy-pgbouncer@sha256:<update_SHA_value>' }
20+
- { name: RELATED_IMAGE_PGEXPORTER, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-exporter@sha256:<update_SHA_value>' }
2021

21-
- { name: RELATED_IMAGE_POSTGRES_12, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres:ubi8-12.10-1' }
22-
- { name: RELATED_IMAGE_POSTGRES_13, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres:ubi8-13.6-1' }
23-
- { name: RELATED_IMAGE_POSTGRES_14, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres:ubi8-14.2-1' }
22+
- { name: RELATED_IMAGE_POSTGRES_13, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres@sha256:<update_SHA_value>' }
23+
- { name: RELATED_IMAGE_POSTGRES_14, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres@sha256:<update_SHA_value>' }
2424

25-
- { name: RELATED_IMAGE_POSTGRES_12_GIS_2.5, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis:ubi8-12.10-2.5-1' }
26-
- { name: RELATED_IMAGE_POSTGRES_12_GIS_3.0, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis:ubi8-12.10-3.0-1' }
27-
- { name: RELATED_IMAGE_POSTGRES_13_GIS_3.0, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis:ubi8-13.6-3.0-1' }
28-
- { name: RELATED_IMAGE_POSTGRES_13_GIS_3.1, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis:ubi8-13.6-3.1-1' }
29-
- { name: RELATED_IMAGE_POSTGRES_14_GIS_3.1, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis:ubi8-14.2-3.1-1' }
25+
- { name: RELATED_IMAGE_POSTGRES_13_GIS_3.0, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis@sha256:<update_SHA_value>' }
26+
- { name: RELATED_IMAGE_POSTGRES_13_GIS_3.1, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis@sha256:<update_SHA_value>' }
27+
- { name: RELATED_IMAGE_POSTGRES_14_GIS_3.1, value: 'registry.connect.redhat.com/crunchydata/crunchy-postgres-gis@sha256:<update_SHA_value>' }

installers/olm/generate.sh

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,29 @@ bundle_directory="bundles/${DISTRIBUTION}"
1111
project_directory="projects/${DISTRIBUTION}"
1212
go_api_directory=$(cd ../../pkg/apis && pwd)
1313

14-
# TODO(tjmoore4): package_name and project_name are kept separate to maintain
15-
# expected names in all projects. This could be consolidated in the future.
14+
# The 'operators.operatorframework.io.bundle.package.v1' package name for each
15+
# bundle (updated for the 'certified' and 'marketplace' bundles).
1616
package_name='postgresql'
17+
18+
# The project name used by operator-sdk for initial bundle generation.
19+
project_name='postgresoperator'
20+
21+
# The prefix for the 'clusterserviceversion.yaml' file.
1722
# Per OLM guidance, the filename for the clusterserviceversion.yaml must be prefixed
1823
# with the Operator's package name for the 'redhat' and 'marketplace' bundles.
1924
# https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/troubleshooting.md#get-supported-versions
20-
project_name='postgresoperator'
25+
file_name='postgresoperator'
2126
case "${DISTRIBUTION}" in
2227
# https://redhat-connect.gitbook.io/certified-operator-guide/appendix/what-if-ive-already-published-a-community-operator
23-
'redhat') package_name='crunchy-postgres-operator' ;;
28+
'redhat')
29+
file_name='crunchy-postgres-operator'
30+
package_name='crunchy-postgres-operator'
31+
;;
2432
# https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/ci-pipeline.md#bundle-structure
25-
'marketplace') package_name='crunchy-postgres-operator-rhmp' ;;
33+
'marketplace')
34+
file_name='crunchy-postgres-operator-rhmp'
35+
package_name='crunchy-postgres-operator-rhmp'
36+
;;
2637
esac
2738

2839
operator_yamls=$(kubectl kustomize "config/${DISTRIBUTION}")
@@ -115,14 +126,6 @@ yq > /dev/null <<< "${operator_roles}" --exit-status 'length == 1' ||
115126

116127
csv_stem=$(yq --raw-output '.projectName' "${project_directory}/PROJECT")
117128

118-
# marketplace and redhat require different naming patters than community
119-
if [ ${DISTRIBUTION} == 'marketplace' ] || [ ${DISTRIBUTION} == 'redhat' ]; then
120-
mv "${project_directory}/config/manifests/bases/${project_name}.clusterserviceversion.yaml" \
121-
"${project_directory}/config/manifests/bases/${package_name}.clusterserviceversion.yaml"
122-
123-
csv_stem=${package_name}
124-
fi
125-
126129
crd_descriptions=$(yq '.spec.customresourcedefinitions.owned' \
127130
"${project_directory}/config/manifests/bases/${csv_stem}.clusterserviceversion.yaml")
128131

@@ -135,7 +138,7 @@ crd_examples=$(yq <<< "${operator_yamls}" --slurp --argjson gvks "${crd_gvks}" '
135138
IN({ apiVersion, kind }; $gvks | .[])
136139
))')
137140

138-
yq --yaml-roundtrip < bundle.csv.yaml > "${bundle_directory}/manifests/${csv_stem}.clusterserviceversion.yaml" \
141+
yq --yaml-roundtrip < bundle.csv.yaml > "${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml" \
139142
--argjson deployment "$(yq <<< "${operator_deployments}" 'first')" \
140143
--argjson account "$(yq <<< "${operator_accounts}" 'first | .metadata.name')" \
141144
--argjson rules "$(yq <<< "${operator_roles}" 'first | .rules')" \
@@ -168,29 +171,32 @@ case "${DISTRIBUTION}" in
168171
yq --in-place --yaml-roundtrip \
169172
'
170173
.metadata.annotations.certified = "true" |
174+
.metadata.annotations["containerImage"] = "registry.connect.redhat.com/crunchydata/postgres-operator@sha256:<update_SHA_value>" |
175+
.metadata.annotations["containerImage"] = "registry.connect.redhat.com/crunchydata/postgres-operator@sha256:<update_SHA_value>" |
171176
.' \
172-
"${bundle_directory}/manifests/${csv_stem}.clusterserviceversion.yaml"
177+
"${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"
173178

174179
# Finally, add related images. NOTE: SHA values will need to be updated
175180
# -https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/troubleshooting.md#digest-pinning
176-
cat bundle.relatedImages.yaml >> "${bundle_directory}/manifests/${csv_stem}.clusterserviceversion.yaml"
181+
cat bundle.relatedImages.yaml >> "${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"
177182
;;
178183
'marketplace')
179184
# Annotations needed when targeting Red Hat Marketplace
180185
# https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/ci-pipeline.md#bundle-structure
181186
yq --in-place --yaml-roundtrip \
182-
--arg package_url "https://marketplace.redhat.com/en-us/operators/${package_name}" \
187+
--arg package_url "https://marketplace.redhat.com/en-us/operators/${file_name}" \
183188
'
189+
.metadata.annotations["containerImage"] = "registry.connect.redhat.com/crunchydata/postgres-operator@sha256:<update_SHA_value>" |
184190
.metadata.annotations["marketplace.openshift.io/remote-workflow"] =
185191
"\($package_url)/pricing?utm_source=openshift_console" |
186192
.metadata.annotations["marketplace.openshift.io/support-workflow"] =
187193
"\($package_url)/support?utm_source=openshift_console" |
188194
.' \
189-
"${bundle_directory}/manifests/${csv_stem}.clusterserviceversion.yaml"
195+
"${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"
190196

191197
# Finally, add related images. NOTE: SHA values will need to be updated
192198
# -https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/troubleshooting.md#digest-pinning
193-
cat bundle.relatedImages.yaml >> "${bundle_directory}/manifests/${csv_stem}.clusterserviceversion.yaml"
199+
cat bundle.relatedImages.yaml >> "${bundle_directory}/manifests/${file_name}.clusterserviceversion.yaml"
194200
;;
195201
esac
196202

0 commit comments

Comments
 (0)