From 5109ac83b7657ad4889c85d94a4774a4c5f73278 Mon Sep 17 00:00:00 2001 From: Akshay D'Souza Date: Thu, 17 Aug 2023 17:36:00 -0400 Subject: [PATCH 1/2] fix(ho): Restore match label selector behavior --- .../hostedcluster/ignitionserver/ignitionserver.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go b/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go index 75ecdf3b5a..ec856c3dc4 100644 --- a/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go +++ b/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go @@ -487,7 +487,9 @@ func reconcileDeployment(deployment *appsv1.Deployment, // it got also silently included in MatchLabels. This made any additional additionalLabel to break reconciliation because MatchLabels is an immutable field. // So now we leave Selector.MatchLabels if it has something already and use a different var from .Labels so the former is not impacted by additionalLabels changes. selectorLabels := ignitionServerLabels + isSelectorSet := false if deployment.Spec.Selector != nil && deployment.Spec.Selector.MatchLabels != nil { + isSelectorSet = true selectorLabels = deployment.Spec.Selector.MatchLabels } @@ -632,15 +634,16 @@ func reconcileDeployment(deployment *appsv1.Deployment, } } - deploymentConfig := config.DeploymentConfig{ - AdditionalLabels: map[string]string{ - config.NeedManagementKASAccessLabel: "true", - }, - } + deploymentConfig := config.DeploymentConfig{} deploymentConfig.Scheduling.PriorityClass = config.DefaultPriorityClass deploymentConfig.SetRestartAnnotation(hcp.ObjectMeta) deploymentConfig.SetDefaults(hcp, ignitionServerLabels, nil) deploymentConfig.ApplyTo(deployment) + // Intentionally syncing selector matchLabels and pod template Labels + // to preserve existing 4.9 and 4.10 reconciliation behavior. + if !isSelectorSet { + deployment.Spec.Selector.MatchLabels = deployment.Spec.Template.ObjectMeta.Labels + } return nil } From 027332af83ba196ceb5927604307757023b69726 Mon Sep 17 00:00:00 2001 From: Akshay D'Souza Date: Thu, 17 Aug 2023 17:38:17 -0400 Subject: [PATCH 2/2] fix(ho): remove additional volumes in 4.9 and 4.10 --- .../ignitionserver/ignitionserver.go | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go b/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go index ec856c3dc4..48e2cd2d17 100644 --- a/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go +++ b/hypershift-operator/controllers/hostedcluster/ignitionserver/ignitionserver.go @@ -530,18 +530,6 @@ func reconcileDeployment(deployment *appsv1.Deployment, EmptyDir: &corev1.EmptyDirVolumeSource{}, }, }, - { - Name: "bootstrap-manifests", - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, - }, - { - Name: "manifests", - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, - }, }, Containers: []corev1.Container{ { @@ -611,14 +599,6 @@ func reconcileDeployment(deployment *appsv1.Deployment, Name: "payloads", MountPath: "/payloads", }, - { - Name: "bootstrap-manifests", - MountPath: "/usr/share/bootkube/manifests/bootstrap-manifests", - }, - { - Name: "manifests", - MountPath: "/usr/share/bootkube/manifests/manifests", - }, }, }, },