Skip to content

Commit 26519bf

Browse files
committed
fix: use maps.Copy for pod labels assignment in CronJob specification
1 parent dbb71d3 commit 26519bf

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

controllers/container_image/resources.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package container_image
55

66
import (
77
"fmt"
8+
"maps"
89
"strings"
910

1011
// That's the mod k8s relies on https://github.com/kubernetes/kubernetes/blob/master/go.mod#L63
@@ -198,9 +199,7 @@ func CronJob(image, integrationMrn, clusterUid, privateRegistrySecretName string
198199
// Copy labels so we don't mutate the CronJob/Job metadata.
199200
if wif.Provider == v1alpha2.CloudProviderAKS {
200201
podLabels := make(map[string]string, len(ls)+1)
201-
for k, v := range ls {
202-
podLabels[k] = v
203-
}
202+
maps.Copy(podLabels, ls)
204203
podLabels["azure.workload.identity/use"] = "true"
205204
cronjob.Spec.JobTemplate.Spec.Template.Labels = podLabels
206205
}
@@ -385,7 +384,7 @@ func registryWIFInitContainer(wif *v1alpha2.WorkloadIdentityConfig) corev1.Conta
385384
var env []corev1.EnvVar
386385

387386
// Common retry wrapper for transient failures
388-
retryWrapper := `
387+
retryWrapper := `set -euo pipefail
389388
# Retry wrapper for transient failures
390389
retry() {
391390
local max_attempts=3

0 commit comments

Comments
 (0)