Skip to content

Commit 698b837

Browse files
committed
Address PR feedback
1 parent 6ae2ced commit 698b837

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

hack/charts/cluster-api-operator/templates/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ spec:
7474
{{- if .Values.watchConfigSecret }}
7575
- --watch-configsecret
7676
{{- end }}
77+
{{- if .Values.watchConfigMap }}
78+
- --watch-configmap
79+
{{- end }}
7780
{{- with .Values.leaderElection }}
7881
- --leader-elect={{ .enabled }}
7982
{{- if .leaseDuration }}

hack/charts/cluster-api-operator/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ profilerAddress: ":6060"
6464
contentionProfiling: false
6565
insecureDiagnostics: false
6666
watchConfigSecret: false
67+
watchConfigMap: false
6768
imagePullSecrets: {}
6869
resources:
6970
manager:

internal/controller/genericprovider_controller.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,18 +318,16 @@ func processProviderConfigMaps(ctx context.Context, k8sClient client.Client, has
318318

319319
// Ensure only one ConfigMap matches the selector
320320
if len(configMapList.Items) > 1 {
321-
return fmt.Errorf("multiple ConfigMaps match the provider selector, only one ConfigMap per provider is allowed")
321+
return fmt.Errorf("multiple ConfigMaps match selector %q in namespace %q; only one is allowed", labelSelector.String(), provider.GetNamespace())
322322
}
323323

324324
// Add the ConfigMap's data to the hash (if any ConfigMap exists)
325325
if len(configMapList.Items) == 1 {
326326
cm := configMapList.Items[0]
327-
if err := addObjectToHash(hash, cm.Data); err != nil {
328-
return err
329-
}
330-
331-
if err := addObjectToHash(hash, cm.BinaryData); err != nil {
332-
return err
327+
for _, data := range []interface{}{cm.Data, cm.BinaryData} {
328+
if err := addObjectToHash(hash, data); err != nil {
329+
return fmt.Errorf("failed to add ConfigMap data to hash: %w", err)
330+
}
333331
}
334332
}
335333

0 commit comments

Comments
 (0)