Skip to content

Commit

Permalink
fix: fix index out of range panic when annotation is not in 'key=valu…
Browse files Browse the repository at this point in the history
…e' format
  • Loading branch information
lianghao208 committed Jan 18, 2023
1 parent 54a2e9f commit 7c7b6ee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/crd/markers/crd.go
Expand Up @@ -369,6 +369,9 @@ func (s Metadata) ApplyToCRD(crd *apiext.CustomResourceDefinition, version strin
}
for _, str := range s.Annotations {
kv := strings.SplitN(str, "=", 2)
if len(kv) < 2 {
return fmt.Errorf("annotation %s is not in 'xxx=xxx' format", str)
}
crd.Annotations[kv[0]] = kv[1]
}
}
Expand Down

0 comments on commit 7c7b6ee

Please sign in to comment.