-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(konnect): add KonnectCloudGatewayNetwork CRD #268
Open
pmalek
wants to merge
7
commits into
main
Choose a base branch
from
konnect-network-type
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a8a26c5
feat(konnect): add KonnectNetwork CRD
pmalek b55ea5f
Update config/crd/gateway-operator/kustomization.yaml
pmalek a54cbcf
chore: generate
pmalek 3a28e99
chore: KonnectNetwork -> KonnectCloudGatewayNetwork
pmalek 2749e52
chore: add cp ref enum const aliases
pmalek 107b2d4
chore: adjust code to make it work with current KGO implementation
pmalek 6c9edbc
refactor: move common to common/v1alpha
pmalek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package v1alpha1 | ||
|
||
const ( | ||
// ControlPlaneRefKonnectID is the type for the KonnectID ControlPlaneRef. | ||
// It is used to reference a Konnect Control Plane entity by its ID on the Konnect platform. | ||
ControlPlaneRefKonnectID = "konnectID" | ||
// ControlPlaneRefKonnectNamespacedRef is the type for the KonnectNamespacedRef ControlPlaneRef. | ||
// It is used to reference a Konnect Control Plane entity inside the cluster | ||
// using a namespaced reference. | ||
ControlPlaneRefKonnectNamespacedRef = "konnectNamespacedRef" | ||
// ControlPlaneRefKIC is the type for KIC ControlPlaneRef. | ||
// It is used to reference a KIC as Control Plane. | ||
ControlPlaneRefKIC = "kic" | ||
) | ||
|
||
// ControlPlaneRef is the schema for the ControlPlaneRef type. | ||
// It is used to reference a Control Plane entity. | ||
// | ||
// +kubebuilder:object:generate=true | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectNamespacedRef') ? has(self.konnectNamespacedRef) : true", message="when type is konnectNamespacedRef, konnectNamespacedRef must be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectNamespacedRef') ? !has(self.konnectID) : true", message="when type is konnectNamespacedRef, konnectID must not be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectID') ? has(self.konnectID) : true", message="when type is konnectID, konnectID must be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectID') ? !has(self.konnectNamespacedRef) : true", message="when type is konnectID, konnectNamespacedRef must not be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'kic') ? !has(self.konnectID) : true", message="when type is kic, konnectID must not be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'kic') ? !has(self.konnectNamespacedRef) : true", message="when type is kic, konnectNamespacedRef must not be set" | ||
// +kubebuilder:validation:XValidation:rule="!has(self.type) ? !has(self.konnectID) : true", message="when type is unset, konnectID must not be set" | ||
// +kubebuilder:validation:XValidation:rule="!has(self.type) ? !has(self.konnectNamespacedRef) : true", message="when type is unset, konnectNamespacedRef must not be set" | ||
// +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. | ||
// | ||
// +kubebuilder:validation:Enum=konnectID;konnectNamespacedRef;kic | ||
// +kubebuilder:default:=kic | ||
Type string `json:"type,omitempty"` | ||
|
||
// KonnectID is the schema for the KonnectID type. | ||
// This field is required when the Type is konnectID. | ||
// +optional | ||
KonnectID *string `json:"konnectID,omitempty"` | ||
|
||
// KonnectNamespacedRef is a reference to a Konnect Control Plane entity inside the cluster. | ||
// It contains the name of the Konnect Control Plane. | ||
// This field is required when the Type is konnectNamespacedRef. | ||
// +optional | ||
KonnectNamespacedRef *KonnectNamespacedRef `json:"konnectNamespacedRef,omitempty"` | ||
} | ||
|
||
// KonnectNamespacedRef is the schema for the KonnectNamespacedRef type. | ||
// | ||
// +kubebuilder:object:generate=true | ||
// +apireference:kgo:include | ||
type KonnectNamespacedRef struct { | ||
// Name is the name of the Konnect Control Plane. | ||
// +kubebuilder:validation:Required | ||
Name string `json:"name"` | ||
|
||
// TODO: Implement cross namespace references: | ||
// https://github.com/Kong/kubernetes-configuration/issues/36 | ||
|
||
// Namespace is the namespace where the Konnect Control Plane is in. | ||
// Currently only cluster scoped resources (KongVault) are allowed to set `konnectNamespacedRef.namespace`. | ||
// | ||
// +optional | ||
Namespace string `json:"namespace,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
Copyright 2025 Kong, Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// +kubebuilder:object:generate=true | ||
package v1alpha1 |
2 changes: 1 addition & 1 deletion
2
api/configuration/common/kong_tags_types.go → api/common/v1alpha1/kong_tags_types.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,25 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
commonv1alpha1 "github.com/kong/kubernetes-configuration/api/common/v1alpha1" | ||
) | ||
|
||
// ControlPlaneRef is the schema for the ControlPlaneRef type. | ||
// It is used to reference a Control Plane entity. | ||
type ControlPlaneRef = commonv1alpha1.ControlPlaneRef | ||
|
||
// KonnectNamespacedRef is the schema for the KonnectNamespacedRef type. | ||
type KonnectNamespacedRef = commonv1alpha1.KonnectNamespacedRef | ||
|
||
const ( | ||
// ControlPlaneRefKonnectID is the type for the KonnectID ControlPlaneRef. | ||
// It is used to reference a Konnect Control Plane entity by its ID on the Konnect platform. | ||
ControlPlaneRefKonnectID = "konnectID" | ||
ControlPlaneRefKonnectID = commonv1alpha1.ControlPlaneRefKonnectID | ||
// ControlPlaneRefKonnectNamespacedRef is the type for the KonnectNamespacedRef ControlPlaneRef. | ||
// It is used to reference a Konnect Control Plane entity inside the cluster | ||
// using a namespaced reference. | ||
ControlPlaneRefKonnectNamespacedRef = "konnectNamespacedRef" | ||
ControlPlaneRefKonnectNamespacedRef = commonv1alpha1.ControlPlaneRefKonnectNamespacedRef | ||
// ControlPlaneRefKIC is the type for KIC ControlPlaneRef. | ||
// It is used to reference a KIC as Control Plane. | ||
ControlPlaneRefKIC = "kic" | ||
ControlPlaneRefKIC = commonv1alpha1.ControlPlaneRefKIC | ||
) | ||
|
||
// ControlPlaneRef is the schema for the ControlPlaneRef type. | ||
// It is used to reference a Control Plane entity. | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectNamespacedRef') ? has(self.konnectNamespacedRef) : true", message="when type is konnectNamespacedRef, konnectNamespacedRef must be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectNamespacedRef') ? !has(self.konnectID) : true", message="when type is konnectNamespacedRef, konnectID must not be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectID') ? has(self.konnectID) : true", message="when type is konnectID, konnectID must be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'konnectID') ? !has(self.konnectNamespacedRef) : true", message="when type is konnectID, konnectNamespacedRef must not be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'kic') ? !has(self.konnectID) : true", message="when type is kic, konnectID must not be set" | ||
// +kubebuilder:validation:XValidation:rule="(has(self.type) && self.type == 'kic') ? !has(self.konnectNamespacedRef) : true", message="when type is kic, konnectNamespacedRef must not be set" | ||
// +kubebuilder:validation:XValidation:rule="!has(self.type) ? !has(self.konnectID) : true", message="when type is unset, konnectID must not be set" | ||
// +kubebuilder:validation:XValidation:rule="!has(self.type) ? !has(self.konnectNamespacedRef) : true", message="when type is unset, konnectNamespacedRef must not be set" | ||
// +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. | ||
// | ||
// +kubebuilder:validation:Enum=konnectID;konnectNamespacedRef;kic | ||
// +kubebuilder:default:=kic | ||
Type string `json:"type,omitempty"` | ||
|
||
// KonnectID is the schema for the KonnectID type. | ||
// This field is required when the Type is konnectID. | ||
// +optional | ||
KonnectID *string `json:"konnectID,omitempty"` | ||
|
||
// KonnectNamespacedRef is a reference to a Konnect Control Plane entity inside the cluster. | ||
// It contains the name of the Konnect Control Plane. | ||
// This field is required when the Type is konnectNamespacedRef. | ||
// +optional | ||
KonnectNamespacedRef *KonnectNamespacedRef `json:"konnectNamespacedRef,omitempty"` | ||
} | ||
|
||
// KonnectNamespacedRef is the schema for the KonnectNamespacedRef type. | ||
// +apireference:kgo:include | ||
type KonnectNamespacedRef struct { | ||
// Name is the name of the Konnect Control Plane. | ||
// +kubebuilder:validation:Required | ||
Name string `json:"name"` | ||
|
||
// TODO: Implement cross namespace references: | ||
// https://github.com/Kong/kubernetes-configuration/issues/36 | ||
|
||
// Namespace is the namespace where the Konnect Control Plane is in. | ||
// Currently only cluster scoped resources (KongVault) are allowed to set `konnectNamespacedRef.namespace`. | ||
// | ||
// +optional | ||
Namespace string `json:"namespace,omitempty"` | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to workaround broken aliases support in controller-gen kubernetes-sigs/controller-tools#1136 (which wasn't released yet)