Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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