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?
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?
This works: listType=set
type FooSpec struct {
// +listType=set
MyItems []string `json:"myItems"`