Skip to content

Commit 3463908

Browse files
committed
fix: add AntiAffinity rules for registry addon
1 parent 6e0f736 commit 3463908

File tree

2 files changed

+19
-6
lines changed
  • charts/cluster-api-runtime-extensions-nutanix/addons/registry/cncf-distribution
  • pkg/handlers/generic/lifecycle/registry/cncfdistribution

2 files changed

+19
-6
lines changed

charts/cluster-api-runtime-extensions-nutanix/addons/registry/cncf-distribution/values-template.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,20 @@ tolerations:
3030
operator: Exists
3131
effect: "NoSchedule"
3232

33-
nodeAffinity:
34-
requiredDuringSchedulingIgnoredDuringExecution:
35-
nodeSelectorTerms:
36-
- matchExpressions:
37-
- key: node-role.kubernetes.io/control-plane
38-
operator: Exists
33+
podLabels:
34+
caren.nutanix.com/cluster-uuid: {{ .ClusterUUID }} # ensure the labels match with pod AntiAffinity.
35+
36+
affinity:
37+
nodeAffinity:
38+
requiredDuringSchedulingIgnoredDuringExecution:
39+
nodeSelectorTerms:
40+
- matchExpressions:
41+
- key: node-role.kubernetes.io/control-plane
42+
operator: Exists
43+
podAntiAffinity:
44+
preferredDuringSchedulingIgnoredDuringExecution:
45+
- weight: 100
46+
podAffinityTerm:
47+
labelSelector:
48+
matchLabels:
49+
caren.nutanix.com/cluster-uuid: {{ .ClusterUUID }}

pkg/handlers/generic/lifecycle/registry/cncfdistribution/handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,14 @@ func templateValues(cluster *clusterv1.Cluster, text string) (string, error) {
165165
ServiceIP string
166166
Replicas int32
167167
TLSSecretName string
168+
ClusterUUID string
168169
}
169170

170171
templateInput := input{
171172
Replicas: stsReplicas,
172173
ServiceIP: serviceIP,
173174
TLSSecretName: tlsSecretName,
175+
ClusterUUID: cluster.Annotations[v1alpha1.ClusterUUIDAnnotationKey],
174176
}
175177

176178
var b bytes.Buffer

0 commit comments

Comments
 (0)