diff --git a/CHANGELOG.md b/CHANGELOG.md index 93f5f58b..2dc7395f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Adding a new version? You'll need three changes: * Add the section header, like "## [v1.2.3]". * Add the diff link, like "[v2.7.0]: https://github.com/kong/kubernetes-ingress-controller/compare/v1.2.2...v1.2.3". ---> +- [v1.1.0](#v110) - [v1.0.6](#v106) - [v1.0.5](#v105) - [v1.0.4](#v104) @@ -13,7 +14,9 @@ Adding a new version? You'll need three changes: - [v1.0.2](#v102) - [v1.0.0](#v100) -## Unreleased +## [v1.1.0] + +[v1.1.0]: https://github.com/Kong/kubernetes-configuration/compare/v1.0.6...v1.1.0 ### Changes @@ -25,10 +28,13 @@ Adding a new version? You'll need three changes: `targets` field. A new alternative is `GlobalInControlPlane` that will make the plugin apply globally in a control plane. [#236](https://github.com/Kong/kubernetes-configuration/pull/236) +- Make `KongPluginBinding`'s `spec.controlPlaneRef` field required as that's expected + by KGO. + [#238](https://github.com/Kong/kubernetes-configuration/pull/238) ## [v1.0.6] -[v1.0.6]: https://github.com/Kong/kubernetes-configuration/compare/v1.0.5...v1.0.6 +[v1.0.6]: https://github.com/Kong/kubernetes-configuration/compare/v1.0.5...v1.0.6 ### Changes diff --git a/VERSION b/VERSION index e7b68975..2cf2bddb 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -v1.0.6 +v1.1.0 latest diff --git a/api/configuration/v1alpha1/kongpluginbinding_types.go b/api/configuration/v1alpha1/kongpluginbinding_types.go index 88e5350e..af1db5bb 100644 --- a/api/configuration/v1alpha1/kongpluginbinding_types.go +++ b/api/configuration/v1alpha1/kongpluginbinding_types.go @@ -96,8 +96,8 @@ type KongPluginBindingSpec struct { Targets *KongPluginBindingTargets `json:"targets,omitempty"` // ControlPlaneRef is a reference to a ControlPlane this KongPluginBinding is associated with. - // +optional - ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef,omitempty"` + // +kubebuilder:validation:Required + ControlPlaneRef ControlPlaneRef `json:"controlPlaneRef"` // Scope defines the scope of the plugin binding. // +optional diff --git a/api/configuration/v1alpha1/zz_generated.deepcopy.go b/api/configuration/v1alpha1/zz_generated.deepcopy.go index 84005122..7e8fd5be 100644 --- a/api/configuration/v1alpha1/zz_generated.deepcopy.go +++ b/api/configuration/v1alpha1/zz_generated.deepcopy.go @@ -1788,11 +1788,7 @@ func (in *KongPluginBindingSpec) DeepCopyInto(out *KongPluginBindingSpec) { *out = new(KongPluginBindingTargets) (*in).DeepCopyInto(*out) } - if in.ControlPlaneRef != nil { - in, out := &in.ControlPlaneRef, &out.ControlPlaneRef - *out = new(ControlPlaneRef) - (*in).DeepCopyInto(*out) - } + in.ControlPlaneRef.DeepCopyInto(&out.ControlPlaneRef) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongPluginBindingSpec. diff --git a/api/configuration/v1alpha1/zz_generated_funcs.go b/api/configuration/v1alpha1/zz_generated_funcs.go index ca81620f..c26a6749 100644 --- a/api/configuration/v1alpha1/zz_generated_funcs.go +++ b/api/configuration/v1alpha1/zz_generated_funcs.go @@ -686,11 +686,15 @@ func (obj *KongPluginBinding) SetControlPlaneID(id string) { } func (obj *KongPluginBinding) SetControlPlaneRef(ref *ControlPlaneRef) { - obj.Spec.ControlPlaneRef = ref + if ref == nil { + obj.Spec.ControlPlaneRef = ControlPlaneRef{} + return + } + obj.Spec.ControlPlaneRef = *ref } func (obj *KongPluginBinding) GetControlPlaneRef() *ControlPlaneRef { - return obj.Spec.ControlPlaneRef + return &obj.Spec.ControlPlaneRef } func (obj *KongService) initKonnectStatus() { diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongcacertificates.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongcacertificates.yaml index b05b0492..3e2021f2 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongcacertificates.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongcacertificates.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcacertificates.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongcertificates.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongcertificates.yaml index c745f326..6e7004e9 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongcertificates.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongcertificates.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcertificates.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml index 92073939..1ad29de4 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongconsumergroups.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml index 202d3c58..a1327eb1 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongconsumers.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialacls.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialacls.yaml index 0f680c43..8d322dc1 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialacls.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialacls.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcredentialacls.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialapikeys.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialapikeys.yaml index 1f85b2e1..4cf6b94c 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialapikeys.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialapikeys.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcredentialapikeys.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialbasicauths.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialbasicauths.yaml index ee693265..12418562 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialbasicauths.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialbasicauths.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcredentialbasicauths.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialhmacs.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialhmacs.yaml index de78148e..fa7fd875 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialhmacs.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialhmacs.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcredentialhmacs.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialjwts.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialjwts.yaml index 70e6cf29..95493a4a 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongcredentialjwts.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongcredentialjwts.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcredentialjwts.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongdataplaneclientcertificates.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongdataplaneclientcertificates.yaml index adf8af07..7fabe941 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongdataplaneclientcertificates.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongdataplaneclientcertificates.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongdataplaneclientcertificates.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongkeys.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongkeys.yaml index d0404c81..e6c5e21a 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongkeys.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongkeys.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongkeys.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongkeysets.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongkeysets.yaml index 8c57cb14..c86a41b8 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongkeysets.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongkeysets.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongkeysets.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_konglicenses.yaml b/config/crd/gateway-operator/configuration.konghq.com_konglicenses.yaml index fe7938b2..818122cc 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_konglicenses.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_konglicenses.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: konglicenses.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongpluginbindings.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongpluginbindings.yaml index 44571819..82678fbc 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongpluginbindings.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongpluginbindings.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongpluginbindings.configuration.konghq.com spec: group: configuration.konghq.com @@ -281,6 +281,7 @@ spec: ? (!has(self.routeRef) || self.routeRef.kind == ''KongRoute'') : true' required: + - controlPlaneRef - pluginRef type: object x-kubernetes-validations: diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongplugins.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongplugins.yaml index 7702cdd2..02a5f721 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongplugins.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongplugins.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongroutes.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongroutes.yaml index 2da2c10b..45fb8814 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongroutes.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongroutes.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongroutes.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongservices.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongservices.yaml index 6bcc1a58..a5106ed2 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongservices.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongservices.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongservices.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongsnis.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongsnis.yaml index 0a1e0923..0c6c809c 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongsnis.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongsnis.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongsnis.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongtargets.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongtargets.yaml index e8094815..8bfe3ed7 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongtargets.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongtargets.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongtargets.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongupstreams.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongupstreams.yaml index dabb1a9d..58e8be94 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongupstreams.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongupstreams.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongupstreams.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml index abbddc97..aabeef6b 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongvaults.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/gateway-operator/konnect.konghq.com_konnectapiauthconfigurations.yaml b/config/crd/gateway-operator/konnect.konghq.com_konnectapiauthconfigurations.yaml index 084044c2..5608bdae 100644 --- a/config/crd/gateway-operator/konnect.konghq.com_konnectapiauthconfigurations.yaml +++ b/config/crd/gateway-operator/konnect.konghq.com_konnectapiauthconfigurations.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: konnectapiauthconfigurations.konnect.konghq.com spec: group: konnect.konghq.com diff --git a/config/crd/gateway-operator/konnect.konghq.com_konnectgatewaycontrolplanes.yaml b/config/crd/gateway-operator/konnect.konghq.com_konnectgatewaycontrolplanes.yaml index 46363827..c3cb8259 100644 --- a/config/crd/gateway-operator/konnect.konghq.com_konnectgatewaycontrolplanes.yaml +++ b/config/crd/gateway-operator/konnect.konghq.com_konnectgatewaycontrolplanes.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: konnectgatewaycontrolplanes.konnect.konghq.com spec: group: konnect.konghq.com diff --git a/config/crd/ingress-controller-incubator/incubator.ingress-controller.konghq.com_kongservicefacades.yaml b/config/crd/ingress-controller-incubator/incubator.ingress-controller.konghq.com_kongservicefacades.yaml index 825cb487..2fc35013 100644 --- a/config/crd/ingress-controller-incubator/incubator.ingress-controller.konghq.com_kongservicefacades.yaml +++ b/config/crd/ingress-controller-incubator/incubator.ingress-controller.konghq.com_kongservicefacades.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller-incubator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongservicefacades.incubator.ingress-controller.konghq.com spec: group: incubator.ingress-controller.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_ingressclassparameterses.yaml b/config/crd/ingress-controller/configuration.konghq.com_ingressclassparameterses.yaml index ae738f80..adfadc5f 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_ingressclassparameterses.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_ingressclassparameterses.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: ingressclassparameterses.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml index 9dc29831..8f41af9c 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongclusterplugins.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml index 92073939..1ad29de4 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongconsumergroups.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml index 202d3c58..a1327eb1 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongconsumers.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml index e8e900d2..7ef2d705 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongcustomentities.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongingresses.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongingresses.yaml index 944a1d6d..f1ada4ab 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongingresses.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongingresses.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongingresses.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_konglicenses.yaml b/config/crd/ingress-controller/configuration.konghq.com_konglicenses.yaml index fe7938b2..818122cc 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_konglicenses.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_konglicenses.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: konglicenses.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongplugins.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongplugins.yaml index 7702cdd2..02a5f721 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongplugins.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongplugins.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongplugins.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongupstreampolicies.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongupstreampolicies.yaml index 61c67b24..768c8cf1 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongupstreampolicies.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongupstreampolicies.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 labels: gateway.networking.k8s.io/policy: direct name: kongupstreampolicies.configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml index abbddc97..aabeef6b 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: kongvaults.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_tcpingresses.yaml b/config/crd/ingress-controller/configuration.konghq.com_tcpingresses.yaml index 626e996d..9cae2cec 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_tcpingresses.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_tcpingresses.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: tcpingresses.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/crd/ingress-controller/configuration.konghq.com_udpingresses.yaml b/config/crd/ingress-controller/configuration.konghq.com_udpingresses.yaml index 72ea529b..c0946bf0 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_udpingresses.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_udpingresses.yaml @@ -4,7 +4,7 @@ kind: CustomResourceDefinition metadata: annotations: kubernetes-configuration.konghq.com/channels: ingress-controller - kubernetes-configuration.konghq.com/version: v1.0.6 + kubernetes-configuration.konghq.com/version: v1.1.0 name: udpingresses.configuration.konghq.com spec: group: configuration.konghq.com diff --git a/config/samples/kongpluginbinding.yaml b/config/samples/kongpluginbinding.yaml index 904caa7c..b636a210 100644 --- a/config/samples/kongpluginbinding.yaml +++ b/config/samples/kongpluginbinding.yaml @@ -1,11 +1,14 @@ apiVersion: configuration.konghq.com/v1alpha1 kind: KongPluginBinding metadata: - generation: 1 name: plugin-binding-kongservice-kongroute-kongconsumer spec: pluginRef: name: plugin-sample + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: test1 targets: consumerRef: name: consumer-sample @@ -21,9 +24,12 @@ spec: apiVersion: configuration.konghq.com/v1alpha1 kind: KongPluginBinding metadata: - generation: 1 name: plugin-binding-kongservice-kongconsumer spec: + controlPlaneRef: + type: konnectNamespacedRef + konnectNamespacedRef: + name: test1 pluginRef: name: plugin-sample targets: diff --git a/scripts/apitypes-funcs/main.go b/scripts/apitypes-funcs/main.go index 610828c0..ba218345 100644 --- a/scripts/apitypes-funcs/main.go +++ b/scripts/apitypes-funcs/main.go @@ -26,7 +26,12 @@ type templateDataT struct { // If it's not provided Konnect status functions will not be generated. KonnectStatusType string + // ControlPlaneRefType is the ControlPlaneRef type to be used in the template (with the package name if it's outside + // the type's package). ControlPlaneRefType string + + // ControlPlaneRefRequired is true if the ControlPlaneRef is required for the type. + ControlPlaneRefRequired bool } const ( diff --git a/scripts/apitypes-funcs/supportedtypes.go b/scripts/apitypes-funcs/supportedtypes.go index 4525b1db..5abec16e 100644 --- a/scripts/apitypes-funcs/supportedtypes.go +++ b/scripts/apitypes-funcs/supportedtypes.go @@ -71,9 +71,10 @@ var supportedKonnectTypesControlPlaneConfig = []supportedTypesT{ ControlPlaneRefType: "ControlPlaneRef", }, { - Type: "KongPluginBinding", - KonnectStatusType: "konnectv1alpha1.KonnectEntityStatusWithControlPlaneRef", - ControlPlaneRefType: "ControlPlaneRef", + Type: "KongPluginBinding", + KonnectStatusType: "konnectv1alpha1.KonnectEntityStatusWithControlPlaneRef", + ControlPlaneRefType: "ControlPlaneRef", + ControlPlaneRefRequired: true, }, { Type: "KongService", diff --git a/scripts/apitypes-funcs/templates.go b/scripts/apitypes-funcs/templates.go index b0227eb1..08136629 100644 --- a/scripts/apitypes-funcs/templates.go +++ b/scripts/apitypes-funcs/templates.go @@ -79,11 +79,17 @@ func (obj *{{ .Type }}) SetControlPlaneID(id string) { {{- if .ControlPlaneRefType }} func (obj *{{ .Type }}) SetControlPlaneRef(ref *{{ .ControlPlaneRefType }}) { - obj.Spec.ControlPlaneRef = ref + {{- if .ControlPlaneRefRequired }} + if ref == nil { + obj.Spec.ControlPlaneRef = {{ .ControlPlaneRefType }}{} + return + } + {{- end }} + obj.Spec.ControlPlaneRef = {{ if .ControlPlaneRefRequired }}*{{ end }}ref } func (obj *{{ .Type }}) GetControlPlaneRef() *{{ .ControlPlaneRefType }} { - return obj.Spec.ControlPlaneRef + return {{ if .ControlPlaneRefRequired }}&{{ end }}obj.Spec.ControlPlaneRef } {{- end }} diff --git a/test/crdsvalidation/kongpluginbindings_test.go b/test/crdsvalidation/kongpluginbindings_test.go index 5509baef..ce025d6b 100644 --- a/test/crdsvalidation/kongpluginbindings_test.go +++ b/test/crdsvalidation/kongpluginbindings_test.go @@ -11,6 +11,15 @@ import ( ) func TestKongPluginBindings(t *testing.T) { + validTestCPRef := func() configurationv1alpha1.ControlPlaneRef { + return configurationv1alpha1.ControlPlaneRef{ + Type: configurationv1alpha1.ControlPlaneRefKonnectNamespacedRef, + KonnectNamespacedRef: &configurationv1alpha1.KonnectNamespacedRef{ + Name: "test-control-plane", + }, + } + } + t.Run("cp ref", func(t *testing.T) { obj := &configurationv1alpha1.KongPluginBinding{ TypeMeta: metav1.TypeMeta{ @@ -29,6 +38,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, } @@ -49,6 +59,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "core", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("pluginRef name must be set"), @@ -66,6 +77,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "core", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("pluginRef name must be set"), @@ -86,6 +98,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "core", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -105,6 +118,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "core", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -124,6 +138,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "core", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr(`spec.pluginRef.kind: Unsupported value: "WrongPluginKind"`), @@ -157,6 +172,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -184,6 +200,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -206,6 +223,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -228,6 +246,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -250,6 +269,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -272,6 +292,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -299,6 +320,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -316,6 +338,7 @@ func TestKongPluginBindings(t *testing.T) { Name: "test-consumer", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -333,6 +356,7 @@ func TestKongPluginBindings(t *testing.T) { Name: "test-consumer", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -352,6 +376,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -371,6 +396,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "core", }, }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -401,6 +427,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("Cannot set Consumer and ConsumerGroup at the same time"), @@ -427,6 +454,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("Cannot set Consumer and ConsumerGroup at the same time"), @@ -453,6 +481,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("Cannot set Consumer and ConsumerGroup at the same time"), @@ -474,6 +503,7 @@ func TestKongPluginBindings(t *testing.T) { Name: "test-consumer-group", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("Cannot set Consumer and ConsumerGroup at the same time"), @@ -487,6 +517,7 @@ func TestKongPluginBindings(t *testing.T) { Kind: lo.ToPtr("KongPlugin"), Name: "my-plugin", }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("At least one target reference must be set when scope is 'OnlyTargets'"), @@ -500,7 +531,8 @@ func TestKongPluginBindings(t *testing.T) { Kind: lo.ToPtr("KongPlugin"), Name: "my-plugin", }, - Targets: &configurationv1alpha1.KongPluginBindingTargets{}, + Targets: &configurationv1alpha1.KongPluginBindingTargets{}, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("At least one target reference must be set when scope is 'OnlyTargets'"), @@ -526,6 +558,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "networking.k8s.io", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("group/kind not allowed for the serviceRef"), @@ -546,6 +579,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "core", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("group/kind not allowed for the routeRef"), @@ -576,6 +610,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "configuration.konghq.com", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr(" KongRoute can be used only when serviceRef is unset or set to KongService"), @@ -601,6 +636,7 @@ func TestKongPluginBindings(t *testing.T) { Group: "networking.k8s.io", }, }, + ControlPlaneRef: validTestCPRef(), }, }, ExpectedErrorMessage: lo.ToPtr("KongService can be used only when routeRef is unset or set to KongRoute"), @@ -620,12 +656,7 @@ func TestKongPluginBindings(t *testing.T) { Kind: lo.ToPtr("KongPlugin"), Name: "my-plugin", }, - ControlPlaneRef: &configurationv1alpha1.ControlPlaneRef{ - Type: configurationv1alpha1.ControlPlaneRefKonnectNamespacedRef, - KonnectNamespacedRef: &configurationv1alpha1.KonnectNamespacedRef{ - Name: "test-control-plane", - }, - }, + ControlPlaneRef: validTestCPRef(), }, }, }, @@ -639,13 +670,8 @@ func TestKongPluginBindings(t *testing.T) { Kind: lo.ToPtr("KongPlugin"), Name: "my-plugin", }, - ControlPlaneRef: &configurationv1alpha1.ControlPlaneRef{ - Type: configurationv1alpha1.ControlPlaneRefKonnectNamespacedRef, - KonnectNamespacedRef: &configurationv1alpha1.KonnectNamespacedRef{ - Name: "test-control-plane", - }, - }, - Targets: &configurationv1alpha1.KongPluginBindingTargets{}, + ControlPlaneRef: validTestCPRef(), + Targets: &configurationv1alpha1.KongPluginBindingTargets{}, }, }, ExpectedErrorMessage: lo.ToPtr("No targets must be set when scope is 'GlobalInControlPlane'"), diff --git a/test/crdsvalidation/suite_crd_ref_change_test.go b/test/crdsvalidation/suite_crd_ref_change_test.go index 8e657290..a0fdb00b 100644 --- a/test/crdsvalidation/suite_crd_ref_change_test.go +++ b/test/crdsvalidation/suite_crd_ref_change_test.go @@ -332,6 +332,17 @@ func NewCRDValidationTestCasesGroupCPRefChange[ }) } } + { + if supportedByKIC == NotSupportedByKIC { + obj := obj.DeepCopy() + obj.SetControlPlaneRef(nil) + ret = append(ret, crdsvalidation.TestCase[T]{ + Name: "cpRef is required", + TestObject: obj, + ExpectedUpdateErrorMessage: lo.ToPtr("spec.controlPlaneRef is required"), + }) + } + } return ret }