Skip to content

Commit 6f7152c

Browse files
authored
fix: API server warning for empty imagePullSecrets (#774)
Signed-off-by: Yosiah de Koeyer <[email protected]>
1 parent 6cbc0fa commit 6f7152c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cmd/main.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ func StringToMap(s string) map[string]string {
119119
return m
120120
}
121121

122+
// CommaSeparatedStringToSlice transforms a comma-separated string into a slice of strings
123+
func CommaSeparatedStringToSlice(s string) []string {
124+
if s == "" {
125+
return []string{}
126+
}
127+
return strings.Split(s, ",")
128+
}
129+
122130
func init() {
123131
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
124132
utilruntime.Must(corev1beta1.AddToScheme(scheme))
@@ -345,7 +353,7 @@ func main() {
345353
kph := flagdproxy.NewFlagdProxyHandler(
346354
flagdproxy.NewFlagdProxyConfiguration(
347355
env,
348-
strings.Split(imagePullSecrets, ","),
356+
CommaSeparatedStringToSlice(imagePullSecrets),
349357
labelsMap,
350358
annotationsMap,
351359
),
@@ -384,9 +392,10 @@ func main() {
384392
Scheme: mgr.GetScheme(),
385393
Log: flagdControllerLogger,
386394
}
395+
387396
flagdConfig := flagd.NewFlagdConfiguration(
388397
env,
389-
strings.Split(imagePullSecrets, ","),
398+
CommaSeparatedStringToSlice(imagePullSecrets),
390399
labelsMap,
391400
annotationsMap,
392401
)

0 commit comments

Comments
 (0)