Reputation: 27031
My Kubernetes CRD:
type FooSpec struct {
// +kubebuilder:validation:UniqueItems=true
MyItems []string `json:"myItems"`
Fails:
Forbidden: uniqueItems cannot be set to true since the runtime complexity becomes quadratic
This is documented: kubernetes.io validation docs
How can I ensure that the slice MyItems
contains no duplicates without writing a webhook?
Upvotes: 0
Views: 45
Reputation: 27031
This works: listType=set
type FooSpec struct {
// +listType=set
MyItems []string `json:"myItems"`
Upvotes: 2