From d3282d53690409515cc7838f62fc4d6896547398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Thu, 3 Oct 2024 09:21:09 +0200 Subject: [PATCH] feat: disallow cross namespace services refs (#107) --- api/configuration/v1alpha1/service_ref.go | 7 +++++-- config/crd/bases/configuration.konghq.com_kongroutes.yaml | 2 -- docs/api-reference.md | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/configuration/v1alpha1/service_ref.go b/api/configuration/v1alpha1/service_ref.go index 62d9b1d..2c28039 100644 --- a/api/configuration/v1alpha1/service_ref.go +++ b/api/configuration/v1alpha1/service_ref.go @@ -16,10 +16,13 @@ type ServiceRef struct { NamespacedRef *NamespacedServiceRef `json:"namespacedRef,omitempty"` } +// NamespacedServiceRef is a namespaced reference to a KongService. +// +// NOTE: currently cross namespace references are not supported. type NamespacedServiceRef struct { // +kubebuilder:validation:Required Name string `json:"name"` - // +kubebuilder:validation:Optional - Namespace string `json:"namespace,omitempty"` + // TODO: handle cross namespace references. + // https://github.com/Kong/kubernetes-configuration/issues/106 } diff --git a/config/crd/bases/configuration.konghq.com_kongroutes.yaml b/config/crd/bases/configuration.konghq.com_kongroutes.yaml index 7fa2816..fa52a2b 100644 --- a/config/crd/bases/configuration.konghq.com_kongroutes.yaml +++ b/config/crd/bases/configuration.konghq.com_kongroutes.yaml @@ -194,8 +194,6 @@ spec: properties: name: type: string - namespace: - type: string required: - name type: object diff --git a/docs/api-reference.md b/docs/api-reference.md index 485acbf..2612f02 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -1543,14 +1543,14 @@ _Appears in:_ #### NamespacedServiceRef - +NamespacedServiceRef is a namespaced reference to a KongService.

+NOTE: currently cross namespace references are not supported. | Field | Description | | --- | --- | | `name` _string_ | | -| `namespace` _string_ | | _Appears in:_