Skip to content

Commit

Permalink
[release/1.0.x]: allow konnectID on ControlPlaneRef, disallow in …
Browse files Browse the repository at this point in the history
…types that include it (#253)

* Revert "Reapply "fix: disallow konnectID references (#198)" (#214)"

This reverts commit c15f3b7.

* fix: allow konnectID on ControlPlaneRef but disallow where unsupported

* chore: disallow konnectID cpRef for KongKey

* chore: generate
  • Loading branch information
pmalek authored Jan 22, 2025
1 parent 845f955 commit cefabd6
Show file tree
Hide file tree
Showing 55 changed files with 166 additions and 61 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.0.8](#v108)
- [v1.0.7](#v107)
- [v1.0.6](#v106)
- [v1.0.5](#v105)
Expand All @@ -14,6 +15,16 @@ Adding a new version? You'll need three changes:
- [v1.0.2](#v102)
- [v1.0.0](#v100)

## [v1.0.8]

[v1.0.8]: https://github.com/Kong/kubernetes-configuration/compare/v1.0.7...v1.0.8

### Changes

- Allow `konnectID` as `ControlPlaneRef`'s `type` but disallow it in CRDs that import it.
This allows usage of `konnectID` in the `ControlPlaneRef`'s `type` field in CRDs
that are outside of this repository, e.g. KGO's `KonnectExtension`.

## [v1.0.7]

[v1.0.7]: https://github.com/Kong/kubernetes-configuration/compare/v1.0.6...v1.0.7
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v1.0.7
v1.0.8
not-latest
1 change: 1 addition & 0 deletions api/configuration/v1/kongconsumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ type KongConsumer struct {
type KongConsumerSpec struct {
// ControlPlaneRef is a reference to a ControlPlane this Consumer is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *configurationv1alpha1.ControlPlaneRef `json:"controlPlaneRef,omitempty"`

// Tags is an optional set of tags applied to the consumer.
Expand Down
5 changes: 4 additions & 1 deletion api/configuration/v1alpha1/controlplaneref_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ const (
// +apireference:kgo:include
type ControlPlaneRef struct {
// Type indicates the type of the control plane being referenced. Allowed values:
// - konnectID
// - konnectNamespacedRef
// - kic
//
// The default is kic, which implies that the Control Plane is KIC.
// KonnectID might not be available for all the resources.
// Consult the specific resource documentation for more information.
//
// +kubebuilder:validation:Enum=konnectNamespacedRef;kic
// +kubebuilder:validation:Enum=konnectID;konnectNamespacedRef;kic
// +kubebuilder:default:=kic
Type string `json:"type,omitempty"`

Expand Down
4 changes: 1 addition & 3 deletions api/configuration/v1alpha1/key_set_ref.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v1alpha1

// KeySetRefType is the enum type for the KeySetRef.
// +kubebuilder:validation:Enum=konnectID;namespacedRef
// +kubebuilder:validation:Enum=namespacedRef
// +apireference:kgo:include
type KeySetRefType string

Expand All @@ -24,8 +24,6 @@ const (
type KeySetRef struct {
// Type defines type of the KeySet object reference. It can be one of:
// - namespacedRef
//
// +kubebuilder:validation:Enum=namespacedRef
Type KeySetRefType `json:"type"`

// KonnectID is the schema for the KonnectID type.
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kong_ca_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type KongCACertificate struct {
type KongCACertificateSpec struct {
// ControlPlaneRef references the Konnect Control Plane that this KongCACertificate should be created in.
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef"`

KongCACertificateAPISpec `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kong_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type KongCertificate struct {
type KongCertificateSpec struct {
// ControlPlaneRef references the Konnect Control Plane that this KongCertificate should be created in.
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef"`

KongCertificateAPISpec `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kong_vault_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type KongVaultSpec struct {
Tags common.Tags `json:"tags,omitempty"`
// ControlPlaneRef is a reference to a Konnect ControlPlane this KongVault is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type KongDataPlaneClientCertificate struct {
type KongDataPlaneClientCertificateSpec struct {
// ControlPlaneRef is a reference to a Konnect ControlPlane this KongDataPlaneClientCertificate is associated with.
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef"`

// KongDataPlaneClientCertificateAPISpec are the attributes of the KongDataPlaneClientCertificate itself.
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kongkey_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type KongKey struct {
type KongKeySpec struct {
// ControlPlaneRef is a reference to a Konnect ControlPlane this KongKey is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef,omitempty"`

// KeySetRef is a reference to a KongKeySet this KongKey is attached to.
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kongkeyset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type KongKeySet struct {
type KongKeySetSpec struct {
// ControlPlaneRef is a reference to a Konnect ControlPlane with which KongKeySet is associated.
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef"`

// KongKeySetAPISpec are the attributes of the KongKeySet itself.
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kongpluginbinding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type KongPluginBindingSpec struct {

// ControlPlaneRef is a reference to a ControlPlane this KongPluginBinding is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef,omitempty"`
}

Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kongroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type KongRouteSpec struct {
// Route can either specify a ControlPlaneRef and be 'serviceless' route or
// specify a ServiceRef and be associated with a Service.
// +optional
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef,omitempty"`
// ServiceRef is a reference to a Service this KongRoute is associated with.
// Route can either specify a ControlPlaneRef and be 'serviceless' route or
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kongservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type KongService struct {
type KongServiceSpec struct {
// ControlPlaneRef is a reference to a ControlPlane this KongService is associated with.
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef"`

KongServiceAPISpec `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1alpha1/kongupstream_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type KongUpstream struct {
type KongUpstreamSpec struct {
// ControlPlaneRef is a reference to a ControlPlane this KongUpstream is associated with.
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *ControlPlaneRef `json:"controlPlaneRef"`

KongUpstreamAPISpec `json:",inline"`
Expand Down
1 change: 1 addition & 0 deletions api/configuration/v1beta1/kongconsumergroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type KongConsumerGroupSpec struct {

// ControlPlaneRef is a reference to a ControlPlane this ConsumerGroup is associated with.
// +optional
// +kubebuilder:validation:XValidation:rule="!has(self.type) || self.type != 'konnectID'", message="konnectID type is not supported"
ControlPlaneRef *configurationv1alpha1.ControlPlaneRef `json:"controlPlaneRef,omitempty"`

// Tags is an optional set of tags applied to the ConsumerGroup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongcacertificates.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down Expand Up @@ -80,16 +80,22 @@ spec:
default: kic
description: |-
Type indicates the type of the control plane being referenced. Allowed values:
- konnectID
- konnectNamespacedRef
- kic
The default is kic, which implies that the Control Plane is KIC.
KonnectID might not be available for all the resources.
Consult the specific resource documentation for more information.
enum:
- konnectID
- konnectNamespacedRef
- kic
type: string
type: object
x-kubernetes-validations:
- message: konnectID type is not supported
rule: '!has(self.type) || self.type != ''konnectID'''
- message: when type is konnectNamespacedRef, konnectNamespacedRef
must be set
rule: '(has(self.type) && self.type == ''konnectNamespacedRef'')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongcertificates.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down Expand Up @@ -86,16 +86,22 @@ spec:
default: kic
description: |-
Type indicates the type of the control plane being referenced. Allowed values:
- konnectID
- konnectNamespacedRef
- kic
The default is kic, which implies that the Control Plane is KIC.
KonnectID might not be available for all the resources.
Consult the specific resource documentation for more information.
enum:
- konnectID
- konnectNamespacedRef
- kic
type: string
type: object
x-kubernetes-validations:
- message: konnectID type is not supported
rule: '!has(self.type) || self.type != ''konnectID'''
- message: when type is konnectNamespacedRef, konnectNamespacedRef
must be set
rule: '(has(self.type) && self.type == ''konnectNamespacedRef'')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongconsumergroups.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down Expand Up @@ -82,16 +82,22 @@ spec:
default: kic
description: |-
Type indicates the type of the control plane being referenced. Allowed values:
- konnectID
- konnectNamespacedRef
- kic
The default is kic, which implies that the Control Plane is KIC.
KonnectID might not be available for all the resources.
Consult the specific resource documentation for more information.
enum:
- konnectID
- konnectNamespacedRef
- kic
type: string
type: object
x-kubernetes-validations:
- message: konnectID type is not supported
rule: '!has(self.type) || self.type != ''konnectID'''
- message: when type is konnectNamespacedRef, konnectNamespacedRef
must be set
rule: '(has(self.type) && self.type == ''konnectNamespacedRef'')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: ingress-controller,gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongconsumers.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down Expand Up @@ -107,16 +107,22 @@ spec:
default: kic
description: |-
Type indicates the type of the control plane being referenced. Allowed values:
- konnectID
- konnectNamespacedRef
- kic
The default is kic, which implies that the Control Plane is KIC.
KonnectID might not be available for all the resources.
Consult the specific resource documentation for more information.
enum:
- konnectID
- konnectNamespacedRef
- kic
type: string
type: object
x-kubernetes-validations:
- message: konnectID type is not supported
rule: '!has(self.type) || self.type != ''konnectID'''
- message: when type is konnectNamespacedRef, konnectNamespacedRef
must be set
rule: '(has(self.type) && self.type == ''konnectNamespacedRef'')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongcredentialacls.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongcredentialapikeys.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongcredentialbasicauths.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongcredentialhmacs.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongcredentialjwts.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: CustomResourceDefinition
metadata:
annotations:
kubernetes-configuration.konghq.com/channels: gateway-operator
kubernetes-configuration.konghq.com/version: v1.0.7
kubernetes-configuration.konghq.com/version: v1.0.8
name: kongdataplaneclientcertificates.configuration.konghq.com
spec:
group: configuration.konghq.com
Expand Down Expand Up @@ -82,16 +82,22 @@ spec:
default: kic
description: |-
Type indicates the type of the control plane being referenced. Allowed values:
- konnectID
- konnectNamespacedRef
- kic
The default is kic, which implies that the Control Plane is KIC.
KonnectID might not be available for all the resources.
Consult the specific resource documentation for more information.
enum:
- konnectID
- konnectNamespacedRef
- kic
type: string
type: object
x-kubernetes-validations:
- message: konnectID type is not supported
rule: '!has(self.type) || self.type != ''konnectID'''
- message: when type is konnectNamespacedRef, konnectNamespacedRef
must be set
rule: '(has(self.type) && self.type == ''konnectNamespacedRef'')
Expand Down
Loading

0 comments on commit cefabd6

Please sign in to comment.