Skip to content

Commit 6930eca

Browse files
authored
feat(konnect entities): Support KongKey and KongConsumer to reference KonnectGatewayControlPlane in another namespace (#3086)
1 parent de4687f commit 6930eca

27 files changed

+82
-122
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@
100100
- `KongUpstream`
101101
- `KongCertificate`
102102
- `KongCACertificate`
103+
- `KongConsumer`
103104
- `KongConsumerGroup`
105+
- `KongKey`
104106
- `KongKeySet`
105107
- `KongVault`
106108
- `KongDataPlaneClientCertificate`
@@ -117,6 +119,7 @@
117119
[#3069](https://github.com/Kong/kong-operator/pull/3069)
118120
[#3052](https://github.com/Kong/kong-operator/pull/3052)
119121
[#3082](https://github.com/Kong/kong-operator/pull/3082)
122+
[#3086](https://github.com/Kong/kong-operator/pull/3086)
120123
- Added support for cross namespace references between the following Konnect
121124
entities and `core` `Secret`
122125

api/configuration/v1/kongconsumer_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
// +kubebuilder:printcolumn:name="Programmed",type=string,JSONPath=`.status.conditions[?(@.type=="Programmed")].status`
3737
// +kubebuilder:validation:XValidation:rule="has(self.username) || has(self.custom_id)", message="Need to provide either username or custom_id"
3838
// +kubebuilder:validation:XValidation:rule="(!has(oldSelf.spec) || !has(oldSelf.spec.controlPlaneRef)) || has(self.spec.controlPlaneRef)", message="controlPlaneRef is required once set"
39-
// +kubebuilder:validation:XValidation:rule="(!has(self.spec) || !has(self.spec.controlPlaneRef) || !has(self.spec.controlPlaneRef.konnectNamespacedRef)) ? true : !has(self.spec.controlPlaneRef.konnectNamespacedRef.__namespace__)", message="spec.controlPlaneRef cannot specify namespace for namespaced resource"
4039
// +kubebuilder:validation:XValidation:rule="(!has(self.spec) || !has(self.spec.controlPlaneRef)) ? true : (!has(self.status) || !self.status.conditions.exists(c, c.type == 'Programmed' && c.status == 'True')) ? true : oldSelf.spec.controlPlaneRef == self.spec.controlPlaneRef", message="spec.controlPlaneRef is immutable when an entity is already Programmed"
4140
// +apireference:kgo:include
4241
// +kong:channels=kong-operator

api/configuration/v1alpha1/kongkey_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
// +kubebuilder:printcolumn:name="Programmed",description="The Resource is Programmed on Konnect",type=string,JSONPath=`.status.conditions[?(@.type=='Programmed')].status`
3636
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.spec.controlPlaneRef) || has(self.spec.controlPlaneRef)", message="controlPlaneRef is required once set"
3737
// +kubebuilder:validation:XValidation:rule="(!self.status.conditions.exists(c, c.type == 'Programmed' && c.status == 'True')) ? true : oldSelf.spec.controlPlaneRef == self.spec.controlPlaneRef", message="spec.controlPlaneRef is immutable when an entity is already Programmed"
38-
// +kubebuilder:validation:XValidation:rule="(!has(self.spec.controlPlaneRef) || !has(self.spec.controlPlaneRef.konnectNamespacedRef)) ? true : !has(self.spec.controlPlaneRef.konnectNamespacedRef.__namespace__)", message="spec.controlPlaneRef cannot specify namespace for namespaced resource"
3938
// +apireference:kgo:include
4039
// +kong:channels=kong-operator
4140
type KongKey struct {

api/configuration/v1alpha1/kongreferencegrant_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type KongReferenceGrantSpec struct {
9191

9292
// ReferenceGrantFrom describes trusted namespaces and kinds.
9393
//
94-
// +kubebuilder:validation:XValidation:rule="self.group != 'configuration.konghq.com' || self.kind in ['KongConsumerGroup', 'KongService', 'KongCertificate', 'KongCACertificate', 'KongDataPlaneClientCertificate', 'KongUpstream', 'KongKeySet', 'KongVault']",message="Only KongConsumerGroup, KongCertificate, KongCACertificate, KongDataPlaneClientCertificate, KongService, KongUpstream, KongKeySet, and KongVault kinds are supported for 'configuration.konghq.com' group"
94+
// +kubebuilder:validation:XValidation:rule="self.group != 'configuration.konghq.com' || self.kind in [ 'KongConsumer', 'KongConsumerGroup', 'KongService', 'KongCertificate', 'KongCACertificate', 'KongDataPlaneClientCertificate', 'KongUpstream', 'KongKey', 'KongKeySet', 'KongVault']",message="Only KongConsumer, KongConsumerGroup, KongCertificate, KongCACertificate, KongDataPlaneClientCertificate, KongService, KongUpstream, KongKey, KongKeySet, and KongVault kinds are supported for 'configuration.konghq.com' group"
9595
// +kubebuilder:validation:XValidation:rule="self.kind == 'KongVault' ? self.__namespace__ == \"\" : self.__namespace__ != \"\"",message="namespace must be empty for KongVault and non-empty for other kinds"
9696
type ReferenceGrantFrom struct {
9797
// Group is the group of the referent.

charts/kong-operator/charts/ko-crds/templates/ko-crds.yaml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50477,9 +50477,6 @@ spec:
5047750477
rule: has(self.username) || has(self.custom_id)
5047850478
- message: controlPlaneRef is required once set
5047950479
rule: (!has(oldSelf.spec) || !has(oldSelf.spec.controlPlaneRef)) || has(self.spec.controlPlaneRef)
50480-
- message: spec.controlPlaneRef cannot specify namespace for namespaced resource
50481-
rule: '(!has(self.spec) || !has(self.spec.controlPlaneRef) || !has(self.spec.controlPlaneRef.konnectNamespacedRef))
50482-
? true : !has(self.spec.controlPlaneRef.konnectNamespacedRef.__namespace__)'
5048350480
- message: spec.controlPlaneRef is immutable when an entity is already Programmed
5048450481
rule: '(!has(self.spec) || !has(self.spec.controlPlaneRef)) ? true : (!has(self.status)
5048550482
|| !self.status.conditions.exists(c, c.type == ''Programmed'' && c.status
@@ -52688,9 +52685,6 @@ spec:
5268852685
- message: spec.controlPlaneRef is immutable when an entity is already Programmed
5268952686
rule: '(!self.status.conditions.exists(c, c.type == ''Programmed'' && c.status
5269052687
== ''True'')) ? true : oldSelf.spec.controlPlaneRef == self.spec.controlPlaneRef'
52691-
- message: spec.controlPlaneRef cannot specify namespace for namespaced resource
52692-
rule: '(!has(self.spec.controlPlaneRef) || !has(self.spec.controlPlaneRef.konnectNamespacedRef))
52693-
? true : !has(self.spec.controlPlaneRef.konnectNamespacedRef.__namespace__)'
5269452688
served: true
5269552689
storage: true
5269652690
subresources:
@@ -54254,14 +54248,14 @@ spec:
5425454248
- namespace
5425554249
type: object
5425654250
x-kubernetes-validations:
54257-
- message: Only KongConsumerGroup, KongCertificate, KongCACertificate,
54258-
KongDataPlaneClientCertificate, KongService, KongUpstream, KongKeySet,
54259-
and KongVault kinds are supported for 'configuration.konghq.com'
54260-
group
54251+
- message: Only KongConsumer, KongConsumerGroup, KongCertificate,
54252+
KongCACertificate, KongDataPlaneClientCertificate, KongService,
54253+
KongUpstream, KongKey, KongKeySet, and KongVault kinds are supported
54254+
for 'configuration.konghq.com' group
5426154255
rule: self.group != 'configuration.konghq.com' || self.kind in
54262-
['KongConsumerGroup', 'KongService', 'KongCertificate', 'KongCACertificate',
54263-
'KongDataPlaneClientCertificate', 'KongUpstream', 'KongKeySet',
54264-
'KongVault']
54256+
[ 'KongConsumer', 'KongConsumerGroup', 'KongService', 'KongCertificate',
54257+
'KongCACertificate', 'KongDataPlaneClientCertificate', 'KongUpstream',
54258+
'KongKey', 'KongKeySet', 'KongVault']
5426554259
- message: namespace must be empty for KongVault and non-empty for
5426654260
other kinds
5426754261
rule: 'self.kind == ''KongVault'' ? self.__namespace__ == "" :

charts/kong-operator/ci/__snapshots__/affinity-values.snap

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/kong-operator/ci/__snapshots__/controlplane-config-dump.snap

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/kong-operator/ci/__snapshots__/disable-gateway-controller-values.snap

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/kong-operator/ci/__snapshots__/env-and-args-values.snap

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)