diff --git a/CHANGELOG.md b/CHANGELOG.md index eb61d789..c08be53c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,15 @@ Adding a new version? You'll need three changes: To prevent import cycles, `v1alpha1` now imports required types from `v1alpha2`. [#550](https://github.com/Kong/kubernetes-configuration/pull/550) +### Added + +- Added optional `ingressClassName` pointer field to the following CRDs to allow association with a specific `IngressClass` and ingress controller: + - `KongConsumer` (v1, in KongConsumerSpec) + - `KongConsumerGroup` (v1beta1, in KongConsumerGroupSpec) + - `KongClusterPlugin` (v1) + - `KongVault` (v1alpha1, in KongVaultSpec) + - `KongCustomEntity` (v1alpha1, in KongCustomEntitySpec) + ## [v2.0.0-alpha.3] [v2.0.0-alpha.3]: https://github.com/Kong/kubernetes-configuration/compare/v2.0.0-alpha.0...v2.0.0-alpha.3 diff --git a/api/configuration/v1/kongclusterplugin_types.go b/api/configuration/v1/kongclusterplugin_types.go index f7210b75..6717f0b1 100644 --- a/api/configuration/v1/kongclusterplugin_types.go +++ b/api/configuration/v1/kongclusterplugin_types.go @@ -98,6 +98,10 @@ type KongClusterPlugin struct { // same plugin in multiple contexts, for example, on multiple services. InstanceName string `json:"instance_name,omitempty"` + // IngressClassName is the name of the IngressClass associated with this resource. + // +optional + IngressClassName *string `json:"ingressClassName,omitempty"` + // Status represents the current status of the KongClusterPlugin resource. Status KongClusterPluginStatus `json:"status,omitempty"` } diff --git a/api/configuration/v1/kongconsumer_types.go b/api/configuration/v1/kongconsumer_types.go index 8fa3fc71..31ea4144 100644 --- a/api/configuration/v1/kongconsumer_types.go +++ b/api/configuration/v1/kongconsumer_types.go @@ -80,6 +80,10 @@ type KongConsumerSpec struct { // Tags is an optional set of tags applied to the consumer. Tags commonv1alpha1.Tags `json:"tags,omitempty"` + + // IngressClassName is the name of the IngressClass associated with this resource. + // +optional + IngressClassName *string `json:"ingressClassName,omitempty"` } // KongConsumerList contains a list of KongConsumer. diff --git a/api/configuration/v1/zz_generated.deepcopy.go b/api/configuration/v1/zz_generated.deepcopy.go index 4b785757..44e67503 100644 --- a/api/configuration/v1/zz_generated.deepcopy.go +++ b/api/configuration/v1/zz_generated.deepcopy.go @@ -86,6 +86,11 @@ func (in *KongClusterPlugin) DeepCopyInto(out *KongClusterPlugin) { *out = new(kong.PluginOrdering) (*in).DeepCopyInto(*out) } + if in.IngressClassName != nil { + in, out := &in.IngressClassName, &out.IngressClassName + *out = new(string) + **out = **in + } in.Status.DeepCopyInto(&out.Status) } @@ -243,6 +248,11 @@ func (in *KongConsumerSpec) DeepCopyInto(out *KongConsumerSpec) { *out = make(v1alpha1.Tags, len(*in)) copy(*out, *in) } + if in.IngressClassName != nil { + in, out := &in.IngressClassName, &out.IngressClassName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongConsumerSpec. diff --git a/api/configuration/v1alpha1/kong_custom_entity_types.go b/api/configuration/v1alpha1/kong_custom_entity_types.go index 88182979..01edecc7 100644 --- a/api/configuration/v1alpha1/kong_custom_entity_types.go +++ b/api/configuration/v1alpha1/kong_custom_entity_types.go @@ -52,6 +52,10 @@ type KongCustomEntitySpec struct { // Currently only KongPlugin/KongClusterPlugin allowed. This will make the custom entity to be attached // to the entity(service/route/consumer) where the plugin is attached. ParentRef *ObjectReference `json:"parentRef,omitempty"` + + // IngressClassName is the name of the IngressClass associated with this resource. + // +optional + IngressClassName *string `json:"ingressClassName,omitempty"` } // ObjectReference defines reference of a kubernetes object. diff --git a/api/configuration/v1alpha1/kong_vault_types.go b/api/configuration/v1alpha1/kong_vault_types.go index d8e46b30..c73b19c3 100644 --- a/api/configuration/v1alpha1/kong_vault_types.go +++ b/api/configuration/v1alpha1/kong_vault_types.go @@ -81,6 +81,10 @@ type KongVaultSpec struct { // +kubebuilder:validation:XValidation:message="'konnectID' type is not supported", rule="self.type != 'konnectID'" // +optional ControlPlaneRef *commonv1alpha1.ControlPlaneRef `json:"controlPlaneRef,omitempty"` + + // IngressClassName is the name of the IngressClass associated with this resource. + // +optional + IngressClassName *string `json:"ingressClassName,omitempty"` } // KongVaultStatus represents the current status of the KongVault resource. diff --git a/api/configuration/v1alpha1/zz_generated.deepcopy.go b/api/configuration/v1alpha1/zz_generated.deepcopy.go index bd6a9b4e..ef41f13c 100644 --- a/api/configuration/v1alpha1/zz_generated.deepcopy.go +++ b/api/configuration/v1alpha1/zz_generated.deepcopy.go @@ -1153,6 +1153,11 @@ func (in *KongCustomEntitySpec) DeepCopyInto(out *KongCustomEntitySpec) { *out = new(ObjectReference) (*in).DeepCopyInto(*out) } + if in.IngressClassName != nil { + in, out := &in.IngressClassName, &out.IngressClassName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongCustomEntitySpec. @@ -2763,6 +2768,11 @@ func (in *KongVaultSpec) DeepCopyInto(out *KongVaultSpec) { *out = new(commonv1alpha1.ControlPlaneRef) (*in).DeepCopyInto(*out) } + if in.IngressClassName != nil { + in, out := &in.IngressClassName, &out.IngressClassName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongVaultSpec. diff --git a/api/configuration/v1beta1/kongconsumergroup_types.go b/api/configuration/v1beta1/kongconsumergroup_types.go index 70ac4559..fe981d10 100644 --- a/api/configuration/v1beta1/kongconsumergroup_types.go +++ b/api/configuration/v1beta1/kongconsumergroup_types.go @@ -63,6 +63,10 @@ type KongConsumerGroupSpec struct { // Tags is an optional set of tags applied to the ConsumerGroup. Tags commonv1alpha1.Tags `json:"tags,omitempty"` + + // IngressClassName is the name of the IngressClass associated with this resource. + // +optional + IngressClassName *string `json:"ingressClassName,omitempty"` } // KongConsumerGroupList contains a list of KongConsumerGroups. diff --git a/api/configuration/v1beta1/zz_generated.deepcopy.go b/api/configuration/v1beta1/zz_generated.deepcopy.go index 09ad71b1..3e19ca2e 100644 --- a/api/configuration/v1beta1/zz_generated.deepcopy.go +++ b/api/configuration/v1beta1/zz_generated.deepcopy.go @@ -99,6 +99,11 @@ func (in *KongConsumerGroupSpec) DeepCopyInto(out *KongConsumerGroupSpec) { *out = make(v1alpha1.Tags, len(*in)) copy(*out, *in) } + if in.IngressClassName != nil { + in, out := &in.IngressClassName, &out.IngressClassName + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KongConsumerGroupSpec. diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml index 311104ae..9c3f0ef6 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongconsumergroups.yaml @@ -123,6 +123,10 @@ spec: rule: '!has(self.type) ? !has(self.konnectID) : true' - message: when type is unset, konnectNamespacedRef must not be set rule: '!has(self.type) ? !has(self.konnectNamespacedRef) : true' + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string name: description: Name is the name of the ConsumerGroup in Kong. type: string diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml index 700063fe..48eee4e9 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongconsumers.yaml @@ -148,6 +148,10 @@ spec: rule: '!has(self.type) ? !has(self.konnectID) : true' - message: when type is unset, konnectNamespacedRef must not be set rule: '!has(self.type) ? !has(self.konnectNamespacedRef) : true' + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string tags: description: Tags is an optional set of tags applied to the consumer. items: diff --git a/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml b/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml index dc30665d..34595f2b 100644 --- a/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml +++ b/config/crd/gateway-operator/configuration.konghq.com_kongvaults.yaml @@ -153,6 +153,10 @@ spec: description: description: Description is the additional information about the vault. type: string + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string prefix: description: |- Prefix is the prefix of vault URI for referencing values in the vault. diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml index dc598afc..73861582 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongclusterplugins.yaml @@ -144,6 +144,10 @@ spec: disabled: description: Disabled set if the plugin is disabled or not. type: boolean + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string instance_name: description: |- InstanceName is an optional custom name to identify an instance of the plugin. This is useful when running the diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml index 311104ae..9c3f0ef6 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongconsumergroups.yaml @@ -123,6 +123,10 @@ spec: rule: '!has(self.type) ? !has(self.konnectID) : true' - message: when type is unset, konnectNamespacedRef must not be set rule: '!has(self.type) ? !has(self.konnectNamespacedRef) : true' + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string name: description: Name is the name of the ConsumerGroup in Kong. type: string diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml index 700063fe..48eee4e9 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongconsumers.yaml @@ -148,6 +148,10 @@ spec: rule: '!has(self.type) ? !has(self.konnectID) : true' - message: when type is unset, konnectNamespacedRef must not be set rule: '!has(self.type) ? !has(self.konnectNamespacedRef) : true' + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string tags: description: Tags is an optional set of tags applied to the consumer. items: diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml index 039db673..57efa242 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongcustomentities.yaml @@ -65,6 +65,10 @@ spec: fields: description: Fields defines the fields of the Kong entity itself. x-kubernetes-preserve-unknown-fields: true + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string parentRef: description: |- ParentRef references the kubernetes resource it attached to when its scope is "attached". diff --git a/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml b/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml index dc30665d..34595f2b 100644 --- a/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml +++ b/config/crd/ingress-controller/configuration.konghq.com_kongvaults.yaml @@ -153,6 +153,10 @@ spec: description: description: Description is the additional information about the vault. type: string + ingressClassName: + description: IngressClassName is the name of the IngressClass associated + with this resource. + type: string prefix: description: |- Prefix is the prefix of vault URI for referencing values in the vault. diff --git a/docs/all-api-reference.md b/docs/all-api-reference.md index 1fcc0a34..07f5b0a5 100644 --- a/docs/all-api-reference.md +++ b/docs/all-api-reference.md @@ -41,6 +41,7 @@ KongClusterPlugin is the Schema for the kongclusterplugins API. | `protocols` _[KongProtocol](#kongprotocol) array_ | Protocols configures plugin to run on requests received on specific protocols. | | `ordering` _[PluginOrdering](#pluginordering)_ | Ordering overrides the normal plugin execution order. It's only available on Kong Enterprise. `` is a request processing phase (for example, `access` or `body_filter`) and `` is the name of the plugin that will run before or after the KongPlugin. For example, a KongPlugin with `plugin: rate-limiting` and `before.access: ["key-auth"]` will create a rate limiting plugin that limits requests _before_ they are authenticated. | | `instance_name` _string_ | InstanceName is an optional custom name to identify an instance of the plugin. This is useful when running the same plugin in multiple contexts, for example, on multiple services. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | @@ -143,6 +144,7 @@ KongConsumerSpec defines the specification of the KongConsumer. | --- | --- | | `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this Consumer is associated with. | | `tags` _[Tags](#tags)_ | Tags is an optional set of tags applied to the consumer. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_ @@ -968,6 +970,7 @@ KongCustomEntitySpec defines the specification of the KongCustomEntity. | `fields` _[JSON](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#json-v1-apiextensions-k8s-io)_ | Fields defines the fields of the Kong entity itself. | | `controllerName` _string_ | ControllerName specifies the controller that should reconcile it, like ingress class. | | `parentRef` _[ObjectReference](#objectreference)_ | ParentRef references the kubernetes resource it attached to when its scope is "attached". Currently only KongPlugin/KongClusterPlugin allowed. This will make the custom entity to be attached to the entity(service/route/consumer) where the plugin is attached. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_ @@ -1440,6 +1443,7 @@ KongVaultSpec defines specification of a custom Kong vault. | `config` _[JSON](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#json-v1-apiextensions-k8s-io)_ | Config is the configuration of the vault. Varies for different backends. | | `tags` _[Tags](#tags)_ | Tags are the tags associated to the vault for grouping and filtering. | | `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a Konnect ControlPlane this KongVault is associated with. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_ @@ -1661,6 +1665,7 @@ KongConsumerGroupSpec defines the desired state of KongConsumerGroup. | `name` _string_ | Name is the name of the ConsumerGroup in Kong. | | `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this ConsumerGroup is associated with. | | `tags` _[Tags](#tags)_ | Tags is an optional set of tags applied to the ConsumerGroup. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_ diff --git a/docs/configuration-api-reference.md b/docs/configuration-api-reference.md index b149f407..13bb5fb5 100644 --- a/docs/configuration-api-reference.md +++ b/docs/configuration-api-reference.md @@ -35,6 +35,7 @@ KongClusterPlugin is the Schema for the kongclusterplugins API. | `protocols` _[KongProtocol](#kongprotocol) array_ | Protocols configures plugin to run on requests received on specific protocols. | | `ordering` _[PluginOrdering](#pluginordering)_ | Ordering overrides the normal plugin execution order. It's only available on Kong Enterprise. `` is a request processing phase (for example, `access` or `body_filter`) and `` is the name of the plugin that will run before or after the KongPlugin. For example, a KongPlugin with `plugin: rate-limiting` and `before.access: ["key-auth"]` will create a rate limiting plugin that limits requests _before_ they are authenticated. | | `instance_name` _string_ | InstanceName is an optional custom name to identify an instance of the plugin. This is useful when running the same plugin in multiple contexts, for example, on multiple services. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | @@ -137,6 +138,7 @@ KongConsumerSpec defines the specification of the KongConsumer. | --- | --- | | `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this Consumer is associated with. | | `tags` _[Tags](#tags)_ | Tags is an optional set of tags applied to the consumer. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_ @@ -946,6 +948,7 @@ KongCustomEntitySpec defines the specification of the KongCustomEntity. | `fields` _[JSON](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#json-v1-apiextensions-k8s-io)_ | Fields defines the fields of the Kong entity itself. | | `controllerName` _string_ | ControllerName specifies the controller that should reconcile it, like ingress class. | | `parentRef` _[ObjectReference](#objectreference)_ | ParentRef references the kubernetes resource it attached to when its scope is "attached". Currently only KongPlugin/KongClusterPlugin allowed. This will make the custom entity to be attached to the entity(service/route/consumer) where the plugin is attached. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_ @@ -1418,6 +1421,7 @@ KongVaultSpec defines specification of a custom Kong vault. | `config` _[JSON](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#json-v1-apiextensions-k8s-io)_ | Config is the configuration of the vault. Varies for different backends. | | `tags` _[Tags](#tags)_ | Tags are the tags associated to the vault for grouping and filtering. | | `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a Konnect ControlPlane this KongVault is associated with. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_ @@ -1639,6 +1643,7 @@ KongConsumerGroupSpec defines the desired state of KongConsumerGroup. | `name` _string_ | Name is the name of the ConsumerGroup in Kong. | | `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this ConsumerGroup is associated with. | | `tags` _[Tags](#tags)_ | Tags is an optional set of tags applied to the ConsumerGroup. | +| `ingressClassName` _string_ | IngressClassName is the name of the IngressClass associated with this resource. | _Appears in:_