Skip to content

Commit

Permalink
Merge pull request #166 from openshift-cherrypick-robot/cherry-pick-1…
Browse files Browse the repository at this point in the history
…61-to-release-4.15

[release-4.15] OCPBUGS-30117: manifests-gen: also add CustomNoUpgrade annotation value
  • Loading branch information
openshift-merge-bot[bot] committed Apr 11, 2024
2 parents 3479a9e + 3c6afe4 commit 0e5dbd0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions manifests-gen/customizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion manifests-gen/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 0e5dbd0

Please sign in to comment.