From 4f9998e6b8acbee56c9e475335fe0f395504dc93 Mon Sep 17 00:00:00 2001 From: Damiano Donati Date: Thu, 15 Feb 2024 11:57:18 +0100 Subject: [PATCH] manifests-gen: also add CustomNoUpgrade annotation value --- manifests-gen/customizations.go | 18 ++++++++++-------- manifests-gen/providers.go | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifests-gen/customizations.go b/manifests-gen/customizations.go index a35843954..531ce8535 100644 --- a/manifests-gen/customizations.go +++ b/manifests-gen/customizations.go @@ -37,8 +37,10 @@ var ( "target.workload.openshift.io/management": `{"effect": "PreferredDuringScheduling"}`, } - techPreviewAnnotation = "release.openshift.io/feature-set" - techPreviewAnnotationValue = "TechPreviewNoUpgrade" + // featureSetAnnotationValue is a multiple-feature-sets annotation value + // adhering to the: %s,%s,... notation defined in the openshift/library-go/pkg/manifest parser. + featureSetAnnotationValue = "CustomNoUpgrade,TechPreviewNoUpgrade" + featureSetAnnotationKey = "release.openshift.io/feature-set" ) func processObjects(objs []unstructured.Unstructured, providerName string) map[resourceKey][]unstructured.Unstructured { @@ -53,7 +55,7 @@ func processObjects(objs []unstructured.Unstructured, providerName string) map[r switch obj.GetKind() { case "ClusterRole", "Role", "ClusterRoleBinding", "RoleBinding", "ServiceAccount": setOpenShiftAnnotations(obj, false) - setTechPreviewAnnotation(obj) + setNoUpgradeAnnotations(obj) providerConfigMapObjs = append(providerConfigMapObjs, obj) case "MutatingWebhookConfiguration": // Explicitly remove defaulting webhooks for the cluster-api provider. @@ -71,7 +73,7 @@ func processObjects(objs []unstructured.Unstructured, providerName string) map[r replaceCertManagerAnnotations(&obj) removeConversionWebhook(&obj) setOpenShiftAnnotations(obj, true) - setTechPreviewAnnotation(obj) + setNoUpgradeAnnotations(obj) // Store Core CAPI CRDs in their own manifest to get them applied by CVO directly. // We want these to be installed independently from whether the cluster-capi-operator is enabled, // as other Openshift components rely on them. @@ -83,13 +85,13 @@ func processObjects(objs []unstructured.Unstructured, providerName string) map[r case "Service": replaceCertMangerServiceSecret(&obj, serviceSecretNames) setOpenShiftAnnotations(obj, true) - setTechPreviewAnnotation(obj) + setNoUpgradeAnnotations(obj) providerConfigMapObjs = append(providerConfigMapObjs, obj) case "Deployment": customizeDeployments(&obj) if providerName == "operator" { setOpenShiftAnnotations(obj, false) - setTechPreviewAnnotation(obj) + setNoUpgradeAnnotations(obj) } providerConfigMapObjs = append(providerConfigMapObjs, obj) case "Certificate", "Issuer", "Namespace", "Secret": // skip @@ -118,13 +120,13 @@ func setOpenShiftAnnotations(obj unstructured.Unstructured, merge bool) { obj.SetAnnotations(anno) } -func setTechPreviewAnnotation(obj unstructured.Unstructured) { +func setNoUpgradeAnnotations(obj unstructured.Unstructured) { anno := obj.GetAnnotations() if anno == nil { anno = map[string]string{} } - anno[techPreviewAnnotation] = techPreviewAnnotationValue + anno[featureSetAnnotationKey] = featureSetAnnotationValue obj.SetAnnotations(anno) } diff --git a/manifests-gen/providers.go b/manifests-gen/providers.go index b3f2587c7..b1e903733 100644 --- a/manifests-gen/providers.go +++ b/manifests-gen/providers.go @@ -109,7 +109,7 @@ func (p *provider) writeProviderComponentsConfigmap(fileName string, objs []unst } annotations := openshiftAnnotations - annotations[techPreviewAnnotation] = techPreviewAnnotationValue + annotations[featureSetAnnotationKey] = featureSetAnnotationValue cm := &corev1.ConfigMap{ TypeMeta: metav1.TypeMeta{