@@ -11,18 +11,29 @@ bundle_directory="bundles/${DISTRIBUTION}"
11
11
project_directory=" projects/${DISTRIBUTION} "
12
12
go_api_directory=$( cd ../../pkg/apis && pwd)
13
13
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) .
16
16
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.
17
22
# Per OLM guidance, the filename for the clusterserviceversion.yaml must be prefixed
18
23
# with the Operator's package name for the 'redhat' and 'marketplace' bundles.
19
24
# 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'
21
26
case " ${DISTRIBUTION} " in
22
27
# 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
+ ;;
24
32
# 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
+ ;;
26
37
esac
27
38
28
39
operator_yamls=$( kubectl kustomize " config/${DISTRIBUTION} " )
@@ -115,14 +126,6 @@ yq > /dev/null <<< "${operator_roles}" --exit-status 'length == 1' ||
115
126
116
127
csv_stem=$( yq --raw-output ' .projectName' " ${project_directory} /PROJECT" )
117
128
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
-
126
129
crd_descriptions=$( yq ' .spec.customresourcedefinitions.owned' \
127
130
" ${project_directory} /config/manifests/bases/${csv_stem} .clusterserviceversion.yaml" )
128
131
@@ -135,7 +138,7 @@ crd_examples=$(yq <<< "${operator_yamls}" --slurp --argjson gvks "${crd_gvks}" '
135
138
IN({ apiVersion, kind }; $gvks | .[])
136
139
))' )
137
140
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" \
139
142
--argjson deployment " $( yq <<< " ${operator_deployments}" ' first' ) " \
140
143
--argjson account " $( yq <<< " ${operator_accounts}" ' first | .metadata.name' ) " \
141
144
--argjson rules " $( yq <<< " ${operator_roles}" ' first | .rules' ) " \
@@ -168,29 +171,32 @@ case "${DISTRIBUTION}" in
168
171
yq --in-place --yaml-roundtrip \
169
172
'
170
173
.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>" |
171
176
.' \
172
- " ${bundle_directory} /manifests/${csv_stem } .clusterserviceversion.yaml"
177
+ " ${bundle_directory} /manifests/${file_name } .clusterserviceversion.yaml"
173
178
174
179
# Finally, add related images. NOTE: SHA values will need to be updated
175
180
# -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"
177
182
;;
178
183
' marketplace' )
179
184
# Annotations needed when targeting Red Hat Marketplace
180
185
# https://github.com/redhat-openshift-ecosystem/certification-releases/blob/main/4.9/ga/ci-pipeline.md#bundle-structure
181
186
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 } " \
183
188
'
189
+ .metadata.annotations["containerImage"] = "registry.connect.redhat.com/crunchydata/postgres-operator@sha256:<update_SHA_value>" |
184
190
.metadata.annotations["marketplace.openshift.io/remote-workflow"] =
185
191
"\($package_url)/pricing?utm_source=openshift_console" |
186
192
.metadata.annotations["marketplace.openshift.io/support-workflow"] =
187
193
"\($package_url)/support?utm_source=openshift_console" |
188
194
.' \
189
- " ${bundle_directory} /manifests/${csv_stem } .clusterserviceversion.yaml"
195
+ " ${bundle_directory} /manifests/${file_name } .clusterserviceversion.yaml"
190
196
191
197
# Finally, add related images. NOTE: SHA values will need to be updated
192
198
# -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"
194
200
;;
195
201
esac
196
202
0 commit comments