Skip to content

Commit

Permalink
do not panic if assertion fails
Browse files Browse the repository at this point in the history
  • Loading branch information
pszmytka-viacom authored and clementnuss committed Feb 28, 2022
1 parent 206c6d8 commit 4a57e93
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions cmd/synchronizer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,22 @@ func (sc *syncConfig) synchronize() error {
data := make(map[string][]byte)

for k, v := range s {
w, err := decode(v.(string))
if err != nil {
return err
// Verify if v is string to avoid panic.
str, ok := v.(string)
if ok {
w, err := decode(str)
if err != nil {
return err
}
data[k] = w
}
}

data[k] = w
if data == nil {
log.Println("secret", v, "is not a simple key-value, skipping")
continue
}

// create/update k8s secret
annotations[sc.annotation] = v
secret := &corev1.Secret{}
Expand Down

0 comments on commit 4a57e93

Please sign in to comment.