From 1ba62a1e066daaaf32ecb833dfe5062372285782 Mon Sep 17 00:00:00 2001 From: salonichf5 <146118978+salonichf5@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:01:27 -0800 Subject: [PATCH] update observability policy API to have minimum one target ref --- apis/v1alpha1/observabilitypolicy_types.go | 1 + config/crd/bases/gateway.nginx.org_observabilitypolicies.yaml | 1 + deploy/crds.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/apis/v1alpha1/observabilitypolicy_types.go b/apis/v1alpha1/observabilitypolicy_types.go index 6e95d28ccf..99b09e4ff9 100644 --- a/apis/v1alpha1/observabilitypolicy_types.go +++ b/apis/v1alpha1/observabilitypolicy_types.go @@ -47,6 +47,7 @@ type ObservabilityPolicySpec struct { // Objects must be in the same namespace as the policy. // Support: HTTPRoute, GRPCRoute. // + // +kubebuilder:validation:MinItems=1 // +kubebuilder:validation:MaxItems=16 // +kubebuilder:validation:XValidation:message="TargetRef Kind must be: HTTPRoute or GRPCRoute",rule="(self.exists(t, t.kind=='HTTPRoute') || self.exists(t, t.kind=='GRPCRoute'))" // +kubebuilder:validation:XValidation:message="TargetRef Group must be gateway.networking.k8s.io.",rule="self.all(t, t.group=='gateway.networking.k8s.io')" diff --git a/config/crd/bases/gateway.nginx.org_observabilitypolicies.yaml b/config/crd/bases/gateway.nginx.org_observabilitypolicies.yaml index d55574e353..8a27d84594 100644 --- a/config/crd/bases/gateway.nginx.org_observabilitypolicies.yaml +++ b/config/crd/bases/gateway.nginx.org_observabilitypolicies.yaml @@ -85,6 +85,7 @@ spec: - name type: object maxItems: 16 + minItems: 1 type: array x-kubernetes-validations: - message: 'TargetRef Kind must be: HTTPRoute or GRPCRoute' diff --git a/deploy/crds.yaml b/deploy/crds.yaml index 1e87d74771..6c619d5511 100644 --- a/deploy/crds.yaml +++ b/deploy/crds.yaml @@ -904,6 +904,7 @@ spec: - name type: object maxItems: 16 + minItems: 1 type: array x-kubernetes-validations: - message: 'TargetRef Kind must be: HTTPRoute or GRPCRoute'