diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ec96c95..f44427b90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,9 +70,11 @@ [#657](https://github.com/Kong/gateway-operator/pull/657) - Add `KongDataPlaneClientCertificate` reconciler for Konnect DataPlaneClientCertificates. [#694](https://github.com/Kong/gateway-operator/pull/694) -- The `DataPlaneKonnectExtension` CRD has been introduced. Such a CRD can be attached +- The `KonnectExtension` CRD has been introduced. Such a CRD can be attached to a `DataPlane` via the extensions field to have a konnect-flavored `DataPlane`. - [#453](https://github.com/Kong/gateway-operator/pull/453), [#578](https://github.com/Kong/gateway-operator/pull/578) + [#453](https://github.com/Kong/gateway-operator/pull/453), + [#578](https://github.com/Kong/gateway-operator/pull/578), + [#736](https://github.com/Kong/gateway-operator/pull/736) - Entities created in Konnect are now labeled (or tagged for those that does not support labels) with origin Kubernetes object's metadata: `k8s-name`, `k8s-namespace`, `k8s-uid`, `k8s-generation`, `k8s-kind`, `k8s-group`, `k8s-version`. @@ -101,7 +103,7 @@ [#669](https://github.com/Kong/gateway-operator/pull/669) - Allow setting `KonnectGatewayControlPlane`s group membership [#697](https://github.com/Kong/gateway-operator/pull/697) -- Apply Konnect-related customizations to `DataPlane`s that properly reference `DataPlaneKonnectExtension` +- Apply Konnect-related customizations to `DataPlane`s that properly reference `KonnectExtension` resources. [#714](https://github.com/Kong/gateway-operator/pull/714) diff --git a/api/v1alpha1/dataplane_konnect_extension_types.go b/api/v1alpha1/konnect_extension_types.go similarity index 77% rename from api/v1alpha1/dataplane_konnect_extension_types.go rename to api/v1alpha1/konnect_extension_types.go index 2eb32ede3..b83a2cfc2 100644 --- a/api/v1alpha1/dataplane_konnect_extension_types.go +++ b/api/v1alpha1/konnect_extension_types.go @@ -20,12 +20,12 @@ import ( ) func init() { - SchemeBuilder.Register(&DataPlaneKonnectExtension{}, &DataPlaneKonnectExtensionList{}) + SchemeBuilder.Register(&KonnectExtension{}, &KonnectExtensionList{}) } const ( - // DataPlaneKonnectExtensionKind holds the kind for the DataPlaneKonnectExtension. - DataPlaneKonnectExtensionKind = "DataPlaneKonnectExtension" + // KonnectExtensionKind holds the kind for the KonnectExtension. + KonnectExtensionKind = "KonnectExtension" ) // +genclient @@ -34,36 +34,36 @@ const ( // +kubebuilder:resource:categories=kong;all // +kubebuilder:subresource:status -// DataPlaneKonnectExtension is the Schema for the dataplanekonnectextension API, +// KonnectExtension is the Schema for the KonnectExtension API, // and is intended to be referenced as extension by the dataplane API. -// If a DataPlane successfully refers a DataPlaneKonnectExtension, the DataPlane +// If a DataPlane successfully refers a KonnectExtension, the DataPlane // deployment spec gets customized to include the konnect-related configuration. // +kubebuilder:validation:XValidation:rule="oldSelf.spec.controlPlaneRef == self.spec.controlPlaneRef", message="spec.controlPlaneRef is immutable." // +apireference:kgo:include -type DataPlaneKonnectExtension struct { +type KonnectExtension struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // Spec is the specification of the DataPlaneKonnectExtension resource. - Spec DataPlaneKonnectExtensionSpec `json:"spec,omitempty"` - // Status is the status of the DataPlaneKonnectExtension resource. - Status DataPlaneKonnectExtensionStatus `json:"status,omitempty"` + // Spec is the specification of the KonnectExtension resource. + Spec KonnectExtensionSpec `json:"spec,omitempty"` + // Status is the status of the KonnectExtension resource. + Status KonnectExtensionStatus `json:"status,omitempty"` } // +kubebuilder:object:root=true -// DataPlaneKonnectExtensionList contains a list of DataPlaneKonnectExtension. +// KonnectExtensionList contains a list of KonnectExtension. // +apireference:kgo:include -type DataPlaneKonnectExtensionList struct { +type KonnectExtensionList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []DataPlaneKonnectExtension `json:"items"` + Items []KonnectExtension `json:"items"` } -// DataPlaneKonnectExtensionSpec defines the desired state of DataPlaneKonnectExtension. +// KonnectExtensionSpec defines the desired state of KonnectExtension. // +apireference:kgo:include -type DataPlaneKonnectExtensionSpec struct { - // ControlPlaneRef is a reference to a ControlPlane this DataPlaneKonnectExtension is associated with. +type KonnectExtensionSpec struct { + // ControlPlaneRef is a reference to a ControlPlane this KonnectExtension is associated with. // +kubebuilder:validation:Required // +kubebuilder:validation:XValidation:rule="self.type == 'konnectID'", message="Only konnectID type currently supported as controlPlaneRef." ControlPlaneRef configurationv1alpha1.ControlPlaneRef `json:"controlPlaneRef"` @@ -113,9 +113,9 @@ type ClusterCertificateSecretRef struct { Name string `json:"name"` } -// DataPlaneKonnectExtensionStatus defines the observed state of DataPlaneKonnectExtension. +// KonnectExtensionStatus defines the observed state of KonnectExtension. // +apireference:kgo:include -type DataPlaneKonnectExtensionStatus struct { +type KonnectExtensionStatus struct { // DataPlaneRefs is the array of DataPlane references this is associated with. // A new reference is set by the operator when this extension is associated with // a DataPlane through its extensions spec. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index be3754869..52b78c4cb 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -275,111 +275,6 @@ func (in *ClusterCertificateSecretRef) DeepCopy() *ClusterCertificateSecretRef { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataPlaneKonnectExtension) DeepCopyInto(out *DataPlaneKonnectExtension) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataPlaneKonnectExtension. -func (in *DataPlaneKonnectExtension) DeepCopy() *DataPlaneKonnectExtension { - if in == nil { - return nil - } - out := new(DataPlaneKonnectExtension) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DataPlaneKonnectExtension) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataPlaneKonnectExtensionList) DeepCopyInto(out *DataPlaneKonnectExtensionList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]DataPlaneKonnectExtension, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataPlaneKonnectExtensionList. -func (in *DataPlaneKonnectExtensionList) DeepCopy() *DataPlaneKonnectExtensionList { - if in == nil { - return nil - } - out := new(DataPlaneKonnectExtensionList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *DataPlaneKonnectExtensionList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataPlaneKonnectExtensionSpec) DeepCopyInto(out *DataPlaneKonnectExtensionSpec) { - *out = *in - in.ControlPlaneRef.DeepCopyInto(&out.ControlPlaneRef) - out.AuthConfiguration = in.AuthConfiguration - if in.ClusterDataPlaneLabels != nil { - in, out := &in.ClusterDataPlaneLabels, &out.ClusterDataPlaneLabels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataPlaneKonnectExtensionSpec. -func (in *DataPlaneKonnectExtensionSpec) DeepCopy() *DataPlaneKonnectExtensionSpec { - if in == nil { - return nil - } - out := new(DataPlaneKonnectExtensionSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DataPlaneKonnectExtensionStatus) DeepCopyInto(out *DataPlaneKonnectExtensionStatus) { - *out = *in - if in.DataPlaneRefs != nil { - in, out := &in.DataPlaneRefs, &out.DataPlaneRefs - *out = make([]NamespacedRef, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataPlaneKonnectExtensionStatus. -func (in *DataPlaneKonnectExtensionStatus) DeepCopy() *DataPlaneKonnectExtensionStatus { - if in == nil { - return nil - } - out := new(DataPlaneKonnectExtensionStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DataPlaneMetricsExtension) DeepCopyInto(out *DataPlaneMetricsExtension) { *out = *in @@ -609,6 +504,111 @@ func (in *KonnectControlPlaneAPIAuthConfiguration) DeepCopy() *KonnectControlPla return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KonnectExtension) DeepCopyInto(out *KonnectExtension) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectExtension. +func (in *KonnectExtension) DeepCopy() *KonnectExtension { + if in == nil { + return nil + } + out := new(KonnectExtension) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KonnectExtension) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KonnectExtensionList) DeepCopyInto(out *KonnectExtensionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KonnectExtension, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectExtensionList. +func (in *KonnectExtensionList) DeepCopy() *KonnectExtensionList { + if in == nil { + return nil + } + out := new(KonnectExtensionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KonnectExtensionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KonnectExtensionSpec) DeepCopyInto(out *KonnectExtensionSpec) { + *out = *in + in.ControlPlaneRef.DeepCopyInto(&out.ControlPlaneRef) + out.AuthConfiguration = in.AuthConfiguration + if in.ClusterDataPlaneLabels != nil { + in, out := &in.ClusterDataPlaneLabels, &out.ClusterDataPlaneLabels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectExtensionSpec. +func (in *KonnectExtensionSpec) DeepCopy() *KonnectExtensionSpec { + if in == nil { + return nil + } + out := new(KonnectExtensionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KonnectExtensionStatus) DeepCopyInto(out *KonnectExtensionStatus) { + *out = *in + if in.DataPlaneRefs != nil { + in, out := &in.DataPlaneRefs, &out.DataPlaneRefs + *out = make([]NamespacedRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectExtensionStatus. +func (in *KonnectExtensionStatus) DeepCopy() *KonnectExtensionStatus { + if in == nil { + return nil + } + out := new(KonnectExtensionStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LLMPrompt) DeepCopyInto(out *LLMPrompt) { *out = *in diff --git a/api/v1beta1/dataplane_types.go b/api/v1beta1/dataplane_types.go index 4877d73fc..81a810aca 100644 --- a/api/v1beta1/dataplane_types.go +++ b/api/v1beta1/dataplane_types.go @@ -34,7 +34,7 @@ func init() { // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:shortName=kodp,categories=kong;all -// +kubebuilder:validation:XValidation:message="Extension not allowed for DataPlane",rule="has(self.spec.extensions) ? self.spec.extensions.all(e, e.group == 'gateway-operator.konghq.com' && e.kind == 'DataPlaneKonnectExtension') : true" +// +kubebuilder:validation:XValidation:message="Extension not allowed for DataPlane",rule="has(self.spec.extensions) ? self.spec.extensions.all(e, e.group == 'gateway-operator.konghq.com' && e.kind == 'KonnectExtension') : true" // +kubebuilder:printcolumn:name="Ready",description="The Resource is ready",type=string,JSONPath=`.status.conditions[?(@.type=='Ready')].status` // DataPlane is the Schema for the dataplanes API @@ -78,7 +78,7 @@ type DataPlaneOptions struct { // Extensions provide additional or replacement features for the DataPlane // resources to influence or enhance functionality. - // NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. + // NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. // // +optional // +kubebuilder:validation:MinItems=0 diff --git a/api/v1beta1/gatewayconfiguration_types.go b/api/v1beta1/gatewayconfiguration_types.go index 84cd54000..d8967886e 100644 --- a/api/v1beta1/gatewayconfiguration_types.go +++ b/api/v1beta1/gatewayconfiguration_types.go @@ -30,7 +30,7 @@ func init() { // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:shortName=kogc,categories=kong;all -// +kubebuilder:validation:XValidation:message="Extension not allowed for DataPlane config options",rule="has(self.spec.dataPlaneOptions.extensions) ? self.spec.dataPlaneOptions.extensions.all(e, e.group == 'gateway-operator.konghq.com' && e.kind == 'DataPlaneKonnectExtension') : true" +// +kubebuilder:validation:XValidation:message="Extension not allowed for DataPlane config options",rule="has(self.spec.dataPlaneOptions.extensions) ? self.spec.dataPlaneOptions.extensions.all(e, e.group == 'gateway-operator.konghq.com' && e.kind == 'KonnectExtension') : true" // GatewayConfiguration is the Schema for the gatewayconfigurations API // +apireference:kgo:include @@ -70,7 +70,7 @@ type GatewayConfigDataPlaneOptions struct { // Extensions provide additional or replacement features for the DataPlane // resources to influence or enhance functionality. - // NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. + // NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. // // +optional // +kubebuilder:validation:MinItems=0 diff --git a/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml b/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml index 247dcc14e..aaf0241be 100644 --- a/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml +++ b/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml @@ -8773,7 +8773,7 @@ spec: description: |- Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. - NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. + NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. items: description: |- ExtensionRef corresponds to another resource in the Kubernetes cluster which @@ -9329,8 +9329,7 @@ spec: x-kubernetes-validations: - message: Extension not allowed for DataPlane rule: 'has(self.spec.extensions) ? self.spec.extensions.all(e, e.group == - ''gateway-operator.konghq.com'' && e.kind == ''DataPlaneKonnectExtension'') - : true' + ''gateway-operator.konghq.com'' && e.kind == ''KonnectExtension'') : true' served: true storage: true subresources: diff --git a/config/crd/bases/gateway-operator.konghq.com_gatewayconfigurations.yaml b/config/crd/bases/gateway-operator.konghq.com_gatewayconfigurations.yaml index 07bdff721..6345ee2d3 100644 --- a/config/crd/bases/gateway-operator.konghq.com_gatewayconfigurations.yaml +++ b/config/crd/bases/gateway-operator.konghq.com_gatewayconfigurations.yaml @@ -17066,7 +17066,7 @@ spec: description: |- Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. - NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. + NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. items: description: |- ExtensionRef corresponds to another resource in the Kubernetes cluster which @@ -17263,7 +17263,7 @@ spec: x-kubernetes-validations: - message: Extension not allowed for DataPlane config options rule: 'has(self.spec.dataPlaneOptions.extensions) ? self.spec.dataPlaneOptions.extensions.all(e, - e.group == ''gateway-operator.konghq.com'' && e.kind == ''DataPlaneKonnectExtension'') + e.group == ''gateway-operator.konghq.com'' && e.kind == ''KonnectExtension'') : true' served: true storage: true diff --git a/config/crd/bases/gateway-operator.konghq.com_dataplanekonnectextensions.yaml b/config/crd/bases/gateway-operator.konghq.com_konnectextensions.yaml similarity index 92% rename from config/crd/bases/gateway-operator.konghq.com_dataplanekonnectextensions.yaml rename to config/crd/bases/gateway-operator.konghq.com_konnectextensions.yaml index 767576380..cdeee3f45 100644 --- a/config/crd/bases/gateway-operator.konghq.com_dataplanekonnectextensions.yaml +++ b/config/crd/bases/gateway-operator.konghq.com_konnectextensions.yaml @@ -4,26 +4,26 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.16.3 - name: dataplanekonnectextensions.gateway-operator.konghq.com + name: konnectextensions.gateway-operator.konghq.com spec: group: gateway-operator.konghq.com names: categories: - kong - all - kind: DataPlaneKonnectExtension - listKind: DataPlaneKonnectExtensionList - plural: dataplanekonnectextensions - singular: dataplanekonnectextension + kind: KonnectExtension + listKind: KonnectExtensionList + plural: konnectextensions + singular: konnectextension scope: Namespaced versions: - name: v1alpha1 schema: openAPIV3Schema: description: |- - DataPlaneKonnectExtension is the Schema for the dataplanekonnectextension API, + KonnectExtension is the Schema for the KonnectExtension API, and is intended to be referenced as extension by the dataplane API. - If a DataPlane successfully refers a DataPlaneKonnectExtension, the DataPlane + If a DataPlane successfully refers a KonnectExtension, the DataPlane deployment spec gets customized to include the konnect-related configuration. properties: apiVersion: @@ -44,8 +44,7 @@ spec: metadata: type: object spec: - description: Spec is the specification of the DataPlaneKonnectExtension - resource. + description: Spec is the specification of the KonnectExtension resource. properties: clusterDataPlaneLabels: additionalProperties: @@ -55,7 +54,7 @@ spec: type: object controlPlaneRef: description: ControlPlaneRef is a reference to a ControlPlane this - DataPlaneKonnectExtension is associated with. + KonnectExtension is associated with. properties: konnectID: description: |- @@ -159,7 +158,7 @@ spec: - serverHostname type: object status: - description: Status is the status of the DataPlaneKonnectExtension resource. + description: Status is the status of the KonnectExtension resource. properties: dataPlaneRefs: description: |- diff --git a/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml b/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml index 247dcc14e..aaf0241be 100644 --- a/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml +++ b/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml @@ -8773,7 +8773,7 @@ spec: description: |- Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. - NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. + NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. items: description: |- ExtensionRef corresponds to another resource in the Kubernetes cluster which @@ -9329,8 +9329,7 @@ spec: x-kubernetes-validations: - message: Extension not allowed for DataPlane rule: 'has(self.spec.extensions) ? self.spec.extensions.all(e, e.group == - ''gateway-operator.konghq.com'' && e.kind == ''DataPlaneKonnectExtension'') - : true' + ''gateway-operator.konghq.com'' && e.kind == ''KonnectExtension'') : true' served: true storage: true subresources: diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 951282420..cdd41a288 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -10,7 +10,7 @@ resources: - bases/gateway-operator.konghq.com_gatewayconfigurations.yaml - bases/gateway-operator.konghq.com_dataplanemetricsextensions.yaml - bases/gateway-operator.konghq.com_kongplugininstallations.yaml -- bases/gateway-operator.konghq.com_dataplanekonnectextensions.yaml +- bases/gateway-operator.konghq.com_konnectextensions.yaml #+kubebuilder:scaffold:crdkustomizeresource # patches: diff --git a/config/rbac/role/role.yaml b/config/rbac/role/role.yaml index 5de469e38..971ecfcfe 100644 --- a/config/rbac/role/role.yaml +++ b/config/rbac/role/role.yaml @@ -281,9 +281,9 @@ rules: resources: - aigateways/status - controlplanes/status - - dataplanekonnectextensions/status - dataplanes/status - kongplugininstallations/status + - konnectextensions/status verbs: - get - patch @@ -291,29 +291,29 @@ rules: - apiGroups: - gateway-operator.konghq.com resources: - - dataplanekonnectextensions - - kongplugininstallations + - gatewayconfigurations verbs: - get - list - - patch - - update - watch - apiGroups: - gateway-operator.konghq.com resources: - - dataplanekonnectextensions/finalizers + - kongplugininstallations + - konnectextensions verbs: + - get + - list - patch - update + - watch - apiGroups: - gateway-operator.konghq.com resources: - - gatewayconfigurations + - konnectextensions/finalizers verbs: - - get - - list - - watch + - patch + - update - apiGroups: - gateway.networking.k8s.io resources: diff --git a/config/samples/dataplane-konnect-extension.yaml b/config/samples/dataplane-konnect-extension.yaml index d272d3233..c7e7817ca 100644 --- a/config/samples/dataplane-konnect-extension.yaml +++ b/config/samples/dataplane-konnect-extension.yaml @@ -19,7 +19,7 @@ # -----END PRIVATE KEY----- # --- apiVersion: gateway-operator.konghq.com/v1alpha1 -kind: DataPlaneKonnectExtension +kind: KonnectExtension metadata: name: my-konnect-config spec: @@ -38,7 +38,7 @@ metadata: name: konnect-extension-example spec: extensions: - - kind: DataPlaneKonnectExtension + - kind: KonnectExtension name: my-konnect-config group: gateway-operator.konghq.com deployment: diff --git a/controller/dataplane/controller_rbac.go b/controller/dataplane/controller_rbac.go index 244a1fcae..2a52a428d 100644 --- a/controller/dataplane/controller_rbac.go +++ b/controller/dataplane/controller_rbac.go @@ -7,8 +7,8 @@ package dataplane // +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanes,verbs=get;list;watch;update;patch // +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanes/status,verbs=get;update;patch // +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanes/finalizers,verbs=update -// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanekonnectextensions,verbs=get;list;watch;update;patch -// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanekonnectextensions/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=konnectextensions,verbs=get;list;watch;update;patch +// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=konnectextensions/status,verbs=get;update;patch // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=create;get;list;watch;update;patch;delete // +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get // +kubebuilder:rbac:groups=core,resources=services,verbs=create;get;list;watch;update;patch;delete diff --git a/controller/dataplane/controller_utils.go b/controller/dataplane/controller_utils.go index 4cbd65a57..3a3e2549a 100644 --- a/controller/dataplane/controller_utils.go +++ b/controller/dataplane/controller_utils.go @@ -327,7 +327,7 @@ func applyExtensions(ctx context.Context, cl client.Client, logger logr.Logger, return false, false, nil } condition := k8sutils.NewConditionWithGeneration(consts.ResolvedRefsType, metav1.ConditionTrue, consts.ResolvedRefsReason, "", dataplane.GetGeneration()) - err = applyDataPlaneKonnectExtension(ctx, cl, dataplane) + err = applyKonnectExtension(ctx, cl, dataplane) if err != nil { switch { case errors.Is(err, ErrCrossNamespaceReference): diff --git a/controller/dataplane/konnect_extension.go b/controller/dataplane/konnectextension.go similarity index 93% rename from controller/dataplane/konnect_extension.go rename to controller/dataplane/konnectextension.go index f46db4ec7..64000aa3c 100644 --- a/controller/dataplane/konnect_extension.go +++ b/controller/dataplane/konnectextension.go @@ -28,11 +28,11 @@ var ( ErrClusterCertificateNotFound = errors.New("cluster certificate not found") ) -// applyDataPlaneKonnectExtension gets the DataPlane as argument, and in case it references a KonnectExtension, it +// applyKonnectExtension gets the DataPlane as argument, and in case it references a KonnectExtension, it // fetches the referenced extension and applies the necessary changes to the DataPlane spec. -func applyDataPlaneKonnectExtension(ctx context.Context, cl client.Client, dataplane *v1beta1.DataPlane) error { +func applyKonnectExtension(ctx context.Context, cl client.Client, dataplane *v1beta1.DataPlane) error { for _, extensionRef := range dataplane.Spec.Extensions { - if extensionRef.Group != operatorv1alpha1.SchemeGroupVersion.Group || extensionRef.Kind != operatorv1alpha1.DataPlaneKonnectExtensionKind { + if extensionRef.Group != operatorv1alpha1.SchemeGroupVersion.Group || extensionRef.Kind != operatorv1alpha1.KonnectExtensionKind { continue } namespace := dataplane.Namespace @@ -40,7 +40,7 @@ func applyDataPlaneKonnectExtension(ctx context.Context, cl client.Client, datap return errors.Join(ErrCrossNamespaceReference, fmt.Errorf("the cross-namespace reference to the extension %s/%s is not permitted", *extensionRef.Namespace, extensionRef.Name)) } - konnectExt := operatorv1alpha1.DataPlaneKonnectExtension{} + konnectExt := operatorv1alpha1.KonnectExtension{} if err := cl.Get(ctx, client.ObjectKey{ Namespace: namespace, Name: extensionRef.Name, diff --git a/controller/dataplane/dataplanekonnectextension_controller.go b/controller/dataplane/konnectextension_controller.go similarity index 72% rename from controller/dataplane/dataplanekonnectextension_controller.go rename to controller/dataplane/konnectextension_controller.go index a50916f72..4fc72f78c 100644 --- a/controller/dataplane/dataplanekonnectextension_controller.go +++ b/controller/dataplane/konnectextension_controller.go @@ -25,8 +25,8 @@ import ( // DataKonnectExtensionReconciler // ----------------------------------------------------------------------------- -// DataPlaneKonnectExtensionReconciler reconciles a DataPlaneKonnectExtension object. -type DataPlaneKonnectExtensionReconciler struct { +// KonnectExtensionReconciler reconciles a KonnectExtension object. +type KonnectExtensionReconciler struct { client.Client ContextInjector ctxinjector.CtxInjector // DevelopmentMode indicates if the controller should run in development mode, @@ -35,16 +35,16 @@ type DataPlaneKonnectExtensionReconciler struct { } // SetupWithManager sets up the controller with the Manager. -func (r *DataPlaneKonnectExtensionReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error { +func (r *KonnectExtensionReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&operatorv1alpha1.DataPlaneKonnectExtension{}). + For(&operatorv1alpha1.KonnectExtension{}). Watches(&operatorv1beta1.DataPlane{}, handler.EnqueueRequestsFromMapFunc(r.listDataPlaneExtensionsReferenced)). Complete(r) } -// listDataPlaneExtensionsReferenced returns a list of all the DataPlaneKonnectExtensions referenced by the DataPlane object. +// listDataPlaneExtensionsReferenced returns a list of all the KonnectExtensions referenced by the DataPlane object. // Maximum one reference is expected. -func (r *DataPlaneKonnectExtensionReconciler) listDataPlaneExtensionsReferenced(ctx context.Context, obj client.Object) []reconcile.Request { +func (r *KonnectExtensionReconciler) listDataPlaneExtensionsReferenced(ctx context.Context, obj client.Object) []reconcile.Request { logger := ctrllog.FromContext(ctx) dataPlane, ok := obj.(*operatorv1beta1.DataPlane) if !ok { @@ -65,7 +65,7 @@ func (r *DataPlaneKonnectExtensionReconciler) listDataPlaneExtensionsReferenced( for _, ext := range dataPlane.Spec.Extensions { namespace := dataPlane.Namespace if ext.Group != operatorv1alpha1.SchemeGroupVersion.Group || - ext.Kind != operatorv1alpha1.DataPlaneKonnectExtensionKind { + ext.Kind != operatorv1alpha1.KonnectExtensionKind { continue } if ext.Namespace != nil && *ext.Namespace != namespace { @@ -81,18 +81,18 @@ func (r *DataPlaneKonnectExtensionReconciler) listDataPlaneExtensionsReferenced( return recs } -// Reconcile reconciles a DataPlaneKonnectExtension object. -func (r *DataPlaneKonnectExtensionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +// Reconcile reconciles a KonnectExtension object. +func (r *KonnectExtensionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { ctx = r.ContextInjector.InjectKeyValues(ctx) - var konnectExtension operatorv1alpha1.DataPlaneKonnectExtension + var konnectExtension operatorv1alpha1.KonnectExtension if err := r.Client.Get(ctx, req.NamespacedName, &konnectExtension); err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) } - logger := log.GetLogger(ctx, operatorv1alpha1.DataPlaneKonnectExtensionKind, r.DevelopmentMode) + logger := log.GetLogger(ctx, operatorv1alpha1.KonnectExtensionKind, r.DevelopmentMode) var dataPlaneList operatorv1beta1.DataPlaneList if err := r.List(ctx, &dataPlaneList, client.MatchingFields{ - index.DataPlaneKonnectExtensionIndex: konnectExtension.Namespace + "/" + konnectExtension.Name, + index.KonnectExtensionIndex: konnectExtension.Namespace + "/" + konnectExtension.Name, }); err != nil { return ctrl.Result{}, err } @@ -112,7 +112,7 @@ func (r *DataPlaneKonnectExtensionReconciler) Reconcile(ctx context.Context, req return ctrl.Result{}, err } - log.Info(logger, "DataPlaneKonnectExtension finalizer updated", konnectExtension) + log.Info(logger, "KonnectExtension finalizer updated", konnectExtension) } return ctrl.Result{}, nil diff --git a/controller/dataplane/dataplanekonnectextension_rbac.go b/controller/dataplane/konnectextension_controller_rbac.go similarity index 72% rename from controller/dataplane/dataplanekonnectextension_rbac.go rename to controller/dataplane/konnectextension_controller_rbac.go index 060624eb4..541a011c0 100644 --- a/controller/dataplane/dataplanekonnectextension_rbac.go +++ b/controller/dataplane/konnectextension_controller_rbac.go @@ -1,9 +1,9 @@ package dataplane // ----------------------------------------------------------------------------- -// DataPlaneKonnectExtensionReconciler - RBAC +// KonnectExtensionReconciler - RBAC // ----------------------------------------------------------------------------- // +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanes,verbs=get;list;watch -// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanekonnectextensions,verbs=get;list;watch -// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=dataplanekonnectextensions/finalizers,verbs=update;patch +// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=konnectextensions,verbs=get;list;watch +// +kubebuilder:rbac:groups=gateway-operator.konghq.com,resources=konnectextensions/finalizers,verbs=update;patch diff --git a/controller/dataplane/konnect_extension_test.go b/controller/dataplane/konnectextension_test.go similarity index 89% rename from controller/dataplane/konnect_extension_test.go rename to controller/dataplane/konnectextension_test.go index 780b17466..787a1aa42 100644 --- a/controller/dataplane/konnect_extension_test.go +++ b/controller/dataplane/konnectextension_test.go @@ -23,7 +23,7 @@ import ( configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" ) -func TestApplyDataPlaneKonnectExtension(t *testing.T) { +func TestApplyKonnectExtension(t *testing.T) { s := scheme.Scheme require.NoError(t, operatorv1alpha1.AddToScheme(s)) require.NoError(t, operatorv1beta1.AddToScheme(s)) @@ -31,7 +31,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { tests := []struct { name string dataplane *operatorv1beta1.DataPlane - konnectExt *operatorv1alpha1.DataPlaneKonnectExtension + konnectExt *operatorv1alpha1.KonnectExtension secret *corev1.Secret expectedError error }{ @@ -56,7 +56,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { Extensions: []operatorv1alpha1.ExtensionRef{ { Group: operatorv1alpha1.SchemeGroupVersion.Group, - Kind: operatorv1alpha1.DataPlaneKonnectExtensionKind, + Kind: operatorv1alpha1.KonnectExtensionKind, NamespacedRef: operatorv1alpha1.NamespacedRef{ Name: "konnect-ext", Namespace: lo.ToPtr("other"), @@ -71,12 +71,12 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { }, }, }, - konnectExt: &operatorv1alpha1.DataPlaneKonnectExtension{ + konnectExt: &operatorv1alpha1.KonnectExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "konnect-ext", Namespace: "other", }, - Spec: operatorv1alpha1.DataPlaneKonnectExtensionSpec{ + Spec: operatorv1alpha1.KonnectExtensionSpec{ AuthConfiguration: operatorv1alpha1.KonnectControlPlaneAPIAuthConfiguration{ ClusterCertificateSecretRef: operatorv1alpha1.ClusterCertificateSecretRef{ Name: "cluster-cert-secret", @@ -102,7 +102,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { Extensions: []operatorv1alpha1.ExtensionRef{ { Group: operatorv1alpha1.SchemeGroupVersion.Group, - Kind: operatorv1alpha1.DataPlaneKonnectExtensionKind, + Kind: operatorv1alpha1.KonnectExtensionKind, NamespacedRef: operatorv1alpha1.NamespacedRef{ Name: "konnect-ext", }, @@ -129,7 +129,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { Extensions: []operatorv1alpha1.ExtensionRef{ { Group: operatorv1alpha1.SchemeGroupVersion.Group, - Kind: operatorv1alpha1.DataPlaneKonnectExtensionKind, + Kind: operatorv1alpha1.KonnectExtensionKind, NamespacedRef: operatorv1alpha1.NamespacedRef{ Name: "konnect-ext", }, @@ -143,12 +143,12 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { }, }, }, - konnectExt: &operatorv1alpha1.DataPlaneKonnectExtension{ + konnectExt: &operatorv1alpha1.KonnectExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "konnect-ext", Namespace: "default", }, - Spec: operatorv1alpha1.DataPlaneKonnectExtensionSpec{ + Spec: operatorv1alpha1.KonnectExtensionSpec{ AuthConfiguration: operatorv1alpha1.KonnectControlPlaneAPIAuthConfiguration{ ClusterCertificateSecretRef: operatorv1alpha1.ClusterCertificateSecretRef{ Name: "cluster-cert-secret", @@ -174,7 +174,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { Extensions: []operatorv1alpha1.ExtensionRef{ { Group: operatorv1alpha1.SchemeGroupVersion.Group, - Kind: operatorv1alpha1.DataPlaneKonnectExtensionKind, + Kind: operatorv1alpha1.KonnectExtensionKind, NamespacedRef: operatorv1alpha1.NamespacedRef{ Name: "konnect-ext", }, @@ -188,12 +188,12 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { }, }, }, - konnectExt: &operatorv1alpha1.DataPlaneKonnectExtension{ + konnectExt: &operatorv1alpha1.KonnectExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "konnect-ext", Namespace: "default", }, - Spec: operatorv1alpha1.DataPlaneKonnectExtensionSpec{ + Spec: operatorv1alpha1.KonnectExtensionSpec{ AuthConfiguration: operatorv1alpha1.KonnectControlPlaneAPIAuthConfiguration{ ClusterCertificateSecretRef: operatorv1alpha1.ClusterCertificateSecretRef{ Name: "cluster-cert-secret", @@ -224,7 +224,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { Extensions: []operatorv1alpha1.ExtensionRef{ { Group: operatorv1alpha1.SchemeGroupVersion.Group, - Kind: operatorv1alpha1.DataPlaneKonnectExtensionKind, + Kind: operatorv1alpha1.KonnectExtensionKind, NamespacedRef: operatorv1alpha1.NamespacedRef{ Name: "konnect-ext", }, @@ -252,12 +252,12 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { }, }, }, - konnectExt: &operatorv1alpha1.DataPlaneKonnectExtension{ + konnectExt: &operatorv1alpha1.KonnectExtension{ ObjectMeta: metav1.ObjectMeta{ Name: "konnect-ext", Namespace: "default", }, - Spec: operatorv1alpha1.DataPlaneKonnectExtensionSpec{ + Spec: operatorv1alpha1.KonnectExtensionSpec{ AuthConfiguration: operatorv1alpha1.KonnectControlPlaneAPIAuthConfiguration{ ClusterCertificateSecretRef: operatorv1alpha1.ClusterCertificateSecretRef{ Name: "cluster-cert-secret", @@ -291,7 +291,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { cl := fake.NewClientBuilder().WithScheme(s).WithRuntimeObjects(objs...).Build() dataplane := tt.dataplane.DeepCopy() - err := applyDataPlaneKonnectExtension(context.Background(), cl, dataplane) + err := applyKonnectExtension(context.Background(), cl, dataplane) if tt.expectedError != nil { require.ErrorIs(t, err, tt.expectedError) } else { @@ -314,7 +314,7 @@ func TestApplyDataPlaneKonnectExtension(t *testing.T) { } } -func getKongInKonnectEnvVars(konnectExt operatorv1alpha1.DataPlaneKonnectExtension) []corev1.EnvVar { +func getKongInKonnectEnvVars(konnectExt operatorv1alpha1.KonnectExtension) []corev1.EnvVar { envSet := []corev1.EnvVar{} for k, v := range dputils.KongInKonnectDefaults(dputils.KongInKonnectParams{ ControlPlane: *konnectExt.Spec.ControlPlaneRef.KonnectID, diff --git a/controller/dataplane/watch.go b/controller/dataplane/watch.go index db17ec748..9a40b0b6e 100644 --- a/controller/dataplane/watch.go +++ b/controller/dataplane/watch.go @@ -53,8 +53,8 @@ func DataPlaneWatchBuilder(mgr ctrl.Manager) *builder.Builder { WatchesRawSource( source.Kind( mgr.GetCache(), - &operatorv1alpha1.DataPlaneKonnectExtension{}, - handler.TypedEnqueueRequestsFromMapFunc(listDataPlanesReferencingDataPlaneKonnectExtension(mgr.GetClient())), + &operatorv1alpha1.KonnectExtension{}, + handler.TypedEnqueueRequestsFromMapFunc(listDataPlanesReferencingKonnectExtension(mgr.GetClient())), ), ) } @@ -88,21 +88,21 @@ func listDataPlanesReferencingKongPluginInstallation( } } -func listDataPlanesReferencingDataPlaneKonnectExtension( +func listDataPlanesReferencingKonnectExtension( c client.Client, -) handler.TypedMapFunc[*operatorv1alpha1.DataPlaneKonnectExtension, reconcile.Request] { +) handler.TypedMapFunc[*operatorv1alpha1.KonnectExtension, reconcile.Request] { return func( - ctx context.Context, ext *operatorv1alpha1.DataPlaneKonnectExtension, + ctx context.Context, ext *operatorv1alpha1.KonnectExtension, ) []reconcile.Request { logger := ctrllog.FromContext(ctx) - // Find all DataPlane resources referencing DataPlaneKonnectExtension - // that maps to the DataPlaneKonnectExtension enqueued for reconciliation. + // Find all DataPlane resources referencing KonnectExtension + // that maps to the KonnectExtension enqueued for reconciliation. var dataPlaneList operatorv1beta1.DataPlaneList if err := c.List(ctx, &dataPlaneList, client.MatchingFields{ - index.DataPlaneKonnectExtensionIndex: ext.Namespace + "/" + ext.Name, + index.KonnectExtensionIndex: ext.Namespace + "/" + ext.Name, }); err != nil { - logger.Error(err, "Failed to list DataPlanes in watch", operatorv1alpha1.DataPlaneKonnectExtensionKind) + logger.Error(err, "Failed to list DataPlanes in watch", operatorv1alpha1.KonnectExtensionKind) return nil } return lo.Map(dataPlaneList.Items, func(dp operatorv1beta1.DataPlane, _ int) reconcile.Request { diff --git a/docs/api-reference.md b/docs/api-reference.md index e11d5c360..ada323f17 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -1746,9 +1746,9 @@ In this section you will find types that the CRDs rely on. Package v1alpha1 contains API Schema definitions for the operator v1alpha1 API group - [AIGateway](#aigateway) -- [DataPlaneKonnectExtension](#dataplanekonnectextension) - [DataPlaneMetricsExtension](#dataplanemetricsextension) - [KongPluginInstallation](#kongplugininstallation) +- [KonnectExtension](#konnectextension) ### AIGateway @@ -1794,26 +1794,6 @@ See: https://kubernetes.io/docs/reference/using-api/cel/ -### DataPlaneKonnectExtension - - -DataPlaneKonnectExtension is the Schema for the dataplanekonnectextension API, -and is intended to be referenced as extension by the dataplane API. -If a DataPlane successfully refers a DataPlaneKonnectExtension, the DataPlane -deployment spec gets customized to include the konnect-related configuration. - - - -| Field | Description | -| --- | --- | -| `apiVersion` _string_ | `gateway-operator.konghq.com/v1alpha1` -| `kind` _string_ | `DataPlaneKonnectExtension` -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | -| `spec` _[DataPlaneKonnectExtensionSpec](#dataplanekonnectextensionspec)_ | Spec is the specification of the DataPlaneKonnectExtension resource. | -| `status` _[DataPlaneKonnectExtensionStatus](#dataplanekonnectextensionstatus)_ | Status is the status of the DataPlaneKonnectExtension resource. | - - - ### DataPlaneMetricsExtension @@ -1857,6 +1837,26 @@ and configured with KongPlugin CRD. +### KonnectExtension + + +KonnectExtension is the Schema for the KonnectExtension API, +and is intended to be referenced as extension by the dataplane API. +If a DataPlane successfully refers a KonnectExtension, the DataPlane +deployment spec gets customized to include the konnect-related configuration. + + + +| Field | Description | +| --- | --- | +| `apiVersion` _string_ | `gateway-operator.konghq.com/v1alpha1` +| `kind` _string_ | `KonnectExtension` +| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | +| `spec` _[KonnectExtensionSpec](#konnectextensionspec)_ | Spec is the specification of the KonnectExtension resource. | +| `status` _[KonnectExtensionStatus](#konnectextensionstatus)_ | Status is the status of the KonnectExtension resource. | + + + ### Types In this section you will find types that the CRDs rely on. @@ -2013,40 +2013,6 @@ ClusterCertificateSecretRef contains the reference to the Secret containing the _Appears in:_ - [KonnectControlPlaneAPIAuthConfiguration](#konnectcontrolplaneapiauthconfiguration) -#### DataPlaneKonnectExtensionSpec - - -DataPlaneKonnectExtensionSpec defines the desired state of DataPlaneKonnectExtension. - - - -| Field | Description | -| --- | --- | -| `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this DataPlaneKonnectExtension is associated with. | -| `controlPlaneRegion` _string_ | ControlPlaneRegion is the region of the Konnect Control Plane. | -| `serverHostname` _string_ | ServerHostname is the fully qualified domain name of the konnect server. This matches the RFC 1123 definition of a hostname with 1 notable exception that numeric IP addresses are not allowed.

Note that as per RFC1035 and RFC1123, a *label* must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character. No other punctuation is allowed. | -| `konnectControlPlaneAPIAuthConfiguration` _[KonnectControlPlaneAPIAuthConfiguration](#konnectcontrolplaneapiauthconfiguration)_ | AuthConfiguration must be used to configure the Konnect API authentication. | -| `clusterDataPlaneLabels` _object (keys:string, values:string)_ | ClusterDataPlaneLabels is a set of labels that will be applied to the Konnect DataPlane. | - - -_Appears in:_ -- [DataPlaneKonnectExtension](#dataplanekonnectextension) - -#### DataPlaneKonnectExtensionStatus - - -DataPlaneKonnectExtensionStatus defines the observed state of DataPlaneKonnectExtension. - - - -| Field | Description | -| --- | --- | -| `dataPlaneRefs` _[NamespacedRef](#namespacedref) array_ | DataPlaneRefs is the array of DataPlane references this is associated with. A new reference is set by the operator when this extension is associated with a DataPlane through its extensions spec. | - - -_Appears in:_ -- [DataPlaneKonnectExtension](#dataplanekonnectextension) - #### DataPlaneMetricsExtensionSpec @@ -2145,7 +2111,41 @@ KonnectControlPlaneAPIAuthConfiguration contains the configuration to authentica _Appears in:_ -- [DataPlaneKonnectExtensionSpec](#dataplanekonnectextensionspec) +- [KonnectExtensionSpec](#konnectextensionspec) + +#### KonnectExtensionSpec + + +KonnectExtensionSpec defines the desired state of KonnectExtension. + + + +| Field | Description | +| --- | --- | +| `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this KonnectExtension is associated with. | +| `controlPlaneRegion` _string_ | ControlPlaneRegion is the region of the Konnect Control Plane. | +| `serverHostname` _string_ | ServerHostname is the fully qualified domain name of the konnect server. This matches the RFC 1123 definition of a hostname with 1 notable exception that numeric IP addresses are not allowed.

Note that as per RFC1035 and RFC1123, a *label* must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character. No other punctuation is allowed. | +| `konnectControlPlaneAPIAuthConfiguration` _[KonnectControlPlaneAPIAuthConfiguration](#konnectcontrolplaneapiauthconfiguration)_ | AuthConfiguration must be used to configure the Konnect API authentication. | +| `clusterDataPlaneLabels` _object (keys:string, values:string)_ | ClusterDataPlaneLabels is a set of labels that will be applied to the Konnect DataPlane. | + + +_Appears in:_ +- [KonnectExtension](#konnectextension) + +#### KonnectExtensionStatus + + +KonnectExtensionStatus defines the observed state of KonnectExtension. + + + +| Field | Description | +| --- | --- | +| `dataPlaneRefs` _[NamespacedRef](#namespacedref) array_ | DataPlaneRefs is the array of DataPlane references this is associated with. A new reference is set by the operator when this extension is associated with a DataPlane through its extensions spec. | + + +_Appears in:_ +- [KonnectExtension](#konnectextension) #### LLMPrompt @@ -2261,9 +2261,9 @@ NamespacedRef is a reference to a namespaced resource. _Appears in:_ -- [DataPlaneKonnectExtensionStatus](#dataplanekonnectextensionstatus) - [DataPlaneMetricsExtensionStatus](#dataplanemetricsextensionstatus) - [ExtensionRef](#extensionref) +- [KonnectExtensionStatus](#konnectextensionstatus) #### ServiceSelector @@ -2548,7 +2548,7 @@ deploy the DataPlane. | `deployment` _[DataPlaneDeploymentOptions](#dataplanedeploymentoptions)_ | | | `network` _[DataPlaneNetworkOptions](#dataplanenetworkoptions)_ | | | `resources` _[DataPlaneResources](#dataplaneresources)_ | | -| `extensions` _ExtensionRef array_ | Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. | +| `extensions` _ExtensionRef array_ | Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. | | `pluginsToInstall` _[NamespacedName](#namespacedname) array_ | PluginsToInstall is a list of KongPluginInstallation resources that will be installed and available in the DataPlane. | @@ -2684,7 +2684,7 @@ DataPlaneSpec defines the desired state of DataPlane | `deployment` _[DataPlaneDeploymentOptions](#dataplanedeploymentoptions)_ | | | `network` _[DataPlaneNetworkOptions](#dataplanenetworkoptions)_ | | | `resources` _[DataPlaneResources](#dataplaneresources)_ | | -| `extensions` _ExtensionRef array_ | Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. | +| `extensions` _ExtensionRef array_ | Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. | | `pluginsToInstall` _[NamespacedName](#namespacedname) array_ | PluginsToInstall is a list of KongPluginInstallation resources that will be installed and available in the DataPlane. | @@ -2760,7 +2760,7 @@ configure and deploy a DataPlane object. | --- | --- | | `deployment` _[DataPlaneDeploymentOptions](#dataplanedeploymentoptions)_ | | | `network` _[GatewayConfigDataPlaneNetworkOptions](#gatewayconfigdataplanenetworkoptions)_ | | -| `extensions` _ExtensionRef array_ | Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. NOTE: since we have one extension only (DataPlaneKonnectExtension), we limit the amount of extensions to 1. | +| `extensions` _ExtensionRef array_ | Extensions provide additional or replacement features for the DataPlane resources to influence or enhance functionality. NOTE: since we have one extension only (KonnectExtension), we limit the amount of extensions to 1. | | `pluginsToInstall` _[NamespacedName](#namespacedname) array_ | PluginsToInstall is a list of KongPluginInstallation resources that will be installed and available in the Gateways (DataPlanes) that use this GatewayConfig. | diff --git a/internal/utils/index/index.go b/internal/utils/index/index.go index 4f04b9425..e83194ad5 100644 --- a/internal/utils/index/index.go +++ b/internal/utils/index/index.go @@ -20,9 +20,9 @@ const ( // in a form of list of namespace/name strings. KongPluginInstallationsIndex = "KongPluginInstallations" - // DataPlaneKonnectExtensionIndex is the key to be used to access the .spec.extensions indexed values, + // KonnectExtensionIndex is the key to be used to access the .spec.extensions indexed values, // in a form of list of namespace/name strings. - DataPlaneKonnectExtensionIndex = "DataPlaneKonnectExtension" + KonnectExtensionIndex = "KonnectExtension" ) // DataPlaneNameOnControlPlane indexes the ControlPlane .spec.dataplaneName field @@ -78,18 +78,18 @@ func KongPluginInstallationsOnDataPlane(ctx context.Context, c cache.Cache) erro } // DataPlaneOnDataPlaneKonnecExtension indexes the DataPlane .spec.extensions field -// on the "DataPlaneKonnectExtension" key. +// on the "KonnectExtension" key. func DataPlaneOnDataPlaneKonnecExtension(ctx context.Context, c cache.Cache) error { if _, err := c.GetInformer(ctx, &operatorv1beta1.DataPlane{}); err != nil { if meta.IsNoMatchError(err) { return nil } - return fmt.Errorf("failed to get informer for v1alpha1 DataPlaneKonnectExtension: %w, disabling indexing DataPlaneKonnectExtensions for DataPlanes' .spec.extensions", err) + return fmt.Errorf("failed to get informer for v1alpha1 KonnectExtension: %w, disabling indexing KonnectExtensions for DataPlanes' .spec.extensions", err) } return c.IndexField( ctx, &operatorv1beta1.DataPlane{}, - DataPlaneKonnectExtensionIndex, + KonnectExtensionIndex, func(o client.Object) []string { dp, ok := o.(*operatorv1beta1.DataPlane) if !ok { @@ -100,7 +100,7 @@ func DataPlaneOnDataPlaneKonnecExtension(ctx context.Context, c cache.Cache) err for _, ext := range dp.Spec.Extensions { namespace := dp.Namespace if ext.Group != operatorv1alpha1.SchemeGroupVersion.Group || - ext.Kind != operatorv1alpha1.DataPlaneKonnectExtensionKind { + ext.Kind != operatorv1alpha1.KonnectExtensionKind { continue } if ext.Namespace != nil && *ext.Namespace != namespace { diff --git a/modules/manager/controller_setup.go b/modules/manager/controller_setup.go index 5c8be9ddf..907d98aab 100644 --- a/modules/manager/controller_setup.go +++ b/modules/manager/controller_setup.go @@ -54,8 +54,8 @@ const ( DataPlaneOwnedSecretFinalizerControllerName = "DataPlaneOwnedSecretFinalizer" // DataPlaneOwnedDeploymentFinalizerControllerName is the name of the DataPlaneOwnedDeploymentFinalizer controller. DataPlaneOwnedDeploymentFinalizerControllerName = "DataPlaneOwnedDeploymentFinalizer" - // DataPlaneKonnectExtensionControllerName is the name of the DataPlaneKonnectExtension controller. - DataPlaneKonnectExtensionControllerName = "DataPlaneKonnectExtension" + // KonnectExtensionControllerName is the name of the KonnectExtension controller. + KonnectExtensionControllerName = "KonnectExtension" // AIGatewayControllerName is the name of the AIGateway controller. AIGatewayControllerName = "AIGateway" // KongPluginInstallationControllerName is the name of the KongPluginInstallation controller. @@ -178,7 +178,7 @@ func setupIndexes(ctx context.Context, mgr manager.Manager, cfg Config) error { } } if err := index.DataPlaneOnDataPlaneKonnecExtension(ctx, mgr.GetCache()); err != nil { - return fmt.Errorf("failed to setup index for DataPlanes on DataPlaneKonnectExtensions: %w", err) + return fmt.Errorf("failed to setup index for DataPlanes on KonnectExtensions: %w", err) } } return nil @@ -346,9 +346,9 @@ func SetupControllers(mgr manager.Manager, c *Config) (map[string]ControllerDef, c.DevelopmentMode, ), }, - DataPlaneKonnectExtensionControllerName: { + KonnectExtensionControllerName: { Enabled: c.DataPlaneControllerEnabled || c.DataPlaneBlueGreenControllerEnabled, - Controller: &dataplane.DataPlaneKonnectExtensionReconciler{ + Controller: &dataplane.KonnectExtensionReconciler{ Client: mgr.GetClient(), DevelopmentMode: c.DevelopmentMode, }, diff --git a/pkg/clientset/typed/apis/v1alpha1/apis_client.go b/pkg/clientset/typed/apis/v1alpha1/apis_client.go index 6a5917128..1844e2a54 100644 --- a/pkg/clientset/typed/apis/v1alpha1/apis_client.go +++ b/pkg/clientset/typed/apis/v1alpha1/apis_client.go @@ -29,9 +29,9 @@ import ( type ApisV1alpha1Interface interface { RESTClient() rest.Interface AIGatewaysGetter - DataPlaneKonnectExtensionsGetter DataPlaneMetricsExtensionsGetter KongPluginInstallationsGetter + KonnectExtensionsGetter } // ApisV1alpha1Client is used to interact with features provided by the apis group. @@ -43,10 +43,6 @@ func (c *ApisV1alpha1Client) AIGateways(namespace string) AIGatewayInterface { return newAIGateways(c, namespace) } -func (c *ApisV1alpha1Client) DataPlaneKonnectExtensions(namespace string) DataPlaneKonnectExtensionInterface { - return newDataPlaneKonnectExtensions(c, namespace) -} - func (c *ApisV1alpha1Client) DataPlaneMetricsExtensions(namespace string) DataPlaneMetricsExtensionInterface { return newDataPlaneMetricsExtensions(c, namespace) } @@ -55,6 +51,10 @@ func (c *ApisV1alpha1Client) KongPluginInstallations(namespace string) KongPlugi return newKongPluginInstallations(c, namespace) } +func (c *ApisV1alpha1Client) KonnectExtensions(namespace string) KonnectExtensionInterface { + return newKonnectExtensions(c, namespace) +} + // NewForConfig creates a new ApisV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/pkg/clientset/typed/apis/v1alpha1/dataplanekonnectextension.go b/pkg/clientset/typed/apis/v1alpha1/dataplanekonnectextension.go deleted file mode 100644 index 5c0a9b390..000000000 --- a/pkg/clientset/typed/apis/v1alpha1/dataplanekonnectextension.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2022 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - "context" - - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" - scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - gentype "k8s.io/client-go/gentype" -) - -// DataPlaneKonnectExtensionsGetter has a method to return a DataPlaneKonnectExtensionInterface. -// A group's client should implement this interface. -type DataPlaneKonnectExtensionsGetter interface { - DataPlaneKonnectExtensions(namespace string) DataPlaneKonnectExtensionInterface -} - -// DataPlaneKonnectExtensionInterface has methods to work with DataPlaneKonnectExtension resources. -type DataPlaneKonnectExtensionInterface interface { - Create(ctx context.Context, dataPlaneKonnectExtension *v1alpha1.DataPlaneKonnectExtension, opts v1.CreateOptions) (*v1alpha1.DataPlaneKonnectExtension, error) - Update(ctx context.Context, dataPlaneKonnectExtension *v1alpha1.DataPlaneKonnectExtension, opts v1.UpdateOptions) (*v1alpha1.DataPlaneKonnectExtension, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, dataPlaneKonnectExtension *v1alpha1.DataPlaneKonnectExtension, opts v1.UpdateOptions) (*v1alpha1.DataPlaneKonnectExtension, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.DataPlaneKonnectExtension, error) - List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.DataPlaneKonnectExtensionList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DataPlaneKonnectExtension, err error) - DataPlaneKonnectExtensionExpansion -} - -// dataPlaneKonnectExtensions implements DataPlaneKonnectExtensionInterface -type dataPlaneKonnectExtensions struct { - *gentype.ClientWithList[*v1alpha1.DataPlaneKonnectExtension, *v1alpha1.DataPlaneKonnectExtensionList] -} - -// newDataPlaneKonnectExtensions returns a DataPlaneKonnectExtensions -func newDataPlaneKonnectExtensions(c *ApisV1alpha1Client, namespace string) *dataPlaneKonnectExtensions { - return &dataPlaneKonnectExtensions{ - gentype.NewClientWithList[*v1alpha1.DataPlaneKonnectExtension, *v1alpha1.DataPlaneKonnectExtensionList]( - "dataplanekonnectextensions", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *v1alpha1.DataPlaneKonnectExtension { return &v1alpha1.DataPlaneKonnectExtension{} }, - func() *v1alpha1.DataPlaneKonnectExtensionList { return &v1alpha1.DataPlaneKonnectExtensionList{} }), - } -} diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go index c9a674ea5..afc35bfd4 100644 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go @@ -32,10 +32,6 @@ func (c *FakeApisV1alpha1) AIGateways(namespace string) v1alpha1.AIGatewayInterf return &FakeAIGateways{c, namespace} } -func (c *FakeApisV1alpha1) DataPlaneKonnectExtensions(namespace string) v1alpha1.DataPlaneKonnectExtensionInterface { - return &FakeDataPlaneKonnectExtensions{c, namespace} -} - func (c *FakeApisV1alpha1) DataPlaneMetricsExtensions(namespace string) v1alpha1.DataPlaneMetricsExtensionInterface { return &FakeDataPlaneMetricsExtensions{c, namespace} } @@ -44,6 +40,10 @@ func (c *FakeApisV1alpha1) KongPluginInstallations(namespace string) v1alpha1.Ko return &FakeKongPluginInstallations{c, namespace} } +func (c *FakeApisV1alpha1) KonnectExtensions(namespace string) v1alpha1.KonnectExtensionInterface { + return &FakeKonnectExtensions{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeApisV1alpha1) RESTClient() rest.Interface { diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanekonnectextension.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanekonnectextension.go deleted file mode 100644 index 1f30ad5b3..000000000 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanekonnectextension.go +++ /dev/null @@ -1,147 +0,0 @@ -/* -Copyright 2022 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - "context" - - v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeDataPlaneKonnectExtensions implements DataPlaneKonnectExtensionInterface -type FakeDataPlaneKonnectExtensions struct { - Fake *FakeApisV1alpha1 - ns string -} - -var dataplanekonnectextensionsResource = v1alpha1.SchemeGroupVersion.WithResource("dataplanekonnectextensions") - -var dataplanekonnectextensionsKind = v1alpha1.SchemeGroupVersion.WithKind("DataPlaneKonnectExtension") - -// Get takes name of the dataPlaneKonnectExtension, and returns the corresponding dataPlaneKonnectExtension object, and an error if there is any. -func (c *FakeDataPlaneKonnectExtensions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DataPlaneKonnectExtension, err error) { - emptyResult := &v1alpha1.DataPlaneKonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(dataplanekonnectextensionsResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneKonnectExtension), err -} - -// List takes label and field selectors, and returns the list of DataPlaneKonnectExtensions that match those selectors. -func (c *FakeDataPlaneKonnectExtensions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DataPlaneKonnectExtensionList, err error) { - emptyResult := &v1alpha1.DataPlaneKonnectExtensionList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(dataplanekonnectextensionsResource, dataplanekonnectextensionsKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.DataPlaneKonnectExtensionList{ListMeta: obj.(*v1alpha1.DataPlaneKonnectExtensionList).ListMeta} - for _, item := range obj.(*v1alpha1.DataPlaneKonnectExtensionList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested dataPlaneKonnectExtensions. -func (c *FakeDataPlaneKonnectExtensions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(dataplanekonnectextensionsResource, c.ns, opts)) - -} - -// Create takes the representation of a dataPlaneKonnectExtension and creates it. Returns the server's representation of the dataPlaneKonnectExtension, and an error, if there is any. -func (c *FakeDataPlaneKonnectExtensions) Create(ctx context.Context, dataPlaneKonnectExtension *v1alpha1.DataPlaneKonnectExtension, opts v1.CreateOptions) (result *v1alpha1.DataPlaneKonnectExtension, err error) { - emptyResult := &v1alpha1.DataPlaneKonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(dataplanekonnectextensionsResource, c.ns, dataPlaneKonnectExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneKonnectExtension), err -} - -// Update takes the representation of a dataPlaneKonnectExtension and updates it. Returns the server's representation of the dataPlaneKonnectExtension, and an error, if there is any. -func (c *FakeDataPlaneKonnectExtensions) Update(ctx context.Context, dataPlaneKonnectExtension *v1alpha1.DataPlaneKonnectExtension, opts v1.UpdateOptions) (result *v1alpha1.DataPlaneKonnectExtension, err error) { - emptyResult := &v1alpha1.DataPlaneKonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(dataplanekonnectextensionsResource, c.ns, dataPlaneKonnectExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneKonnectExtension), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeDataPlaneKonnectExtensions) UpdateStatus(ctx context.Context, dataPlaneKonnectExtension *v1alpha1.DataPlaneKonnectExtension, opts v1.UpdateOptions) (result *v1alpha1.DataPlaneKonnectExtension, err error) { - emptyResult := &v1alpha1.DataPlaneKonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceActionWithOptions(dataplanekonnectextensionsResource, "status", c.ns, dataPlaneKonnectExtension, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneKonnectExtension), err -} - -// Delete takes name of the dataPlaneKonnectExtension and deletes it. Returns an error if one occurs. -func (c *FakeDataPlaneKonnectExtensions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(dataplanekonnectextensionsResource, c.ns, name, opts), &v1alpha1.DataPlaneKonnectExtension{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeDataPlaneKonnectExtensions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(dataplanekonnectextensionsResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.DataPlaneKonnectExtensionList{}) - return err -} - -// Patch applies the patch and returns the patched dataPlaneKonnectExtension. -func (c *FakeDataPlaneKonnectExtensions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DataPlaneKonnectExtension, err error) { - emptyResult := &v1alpha1.DataPlaneKonnectExtension{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(dataplanekonnectextensionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1alpha1.DataPlaneKonnectExtension), err -} diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_konnectextension.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_konnectextension.go new file mode 100644 index 000000000..dba344ef1 --- /dev/null +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_konnectextension.go @@ -0,0 +1,147 @@ +/* +Copyright 2022 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeKonnectExtensions implements KonnectExtensionInterface +type FakeKonnectExtensions struct { + Fake *FakeApisV1alpha1 + ns string +} + +var konnectextensionsResource = v1alpha1.SchemeGroupVersion.WithResource("konnectextensions") + +var konnectextensionsKind = v1alpha1.SchemeGroupVersion.WithKind("KonnectExtension") + +// Get takes name of the konnectExtension, and returns the corresponding konnectExtension object, and an error if there is any. +func (c *FakeKonnectExtensions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KonnectExtension, err error) { + emptyResult := &v1alpha1.KonnectExtension{} + obj, err := c.Fake. + Invokes(testing.NewGetActionWithOptions(konnectextensionsResource, c.ns, name, options), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.KonnectExtension), err +} + +// List takes label and field selectors, and returns the list of KonnectExtensions that match those selectors. +func (c *FakeKonnectExtensions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KonnectExtensionList, err error) { + emptyResult := &v1alpha1.KonnectExtensionList{} + obj, err := c.Fake. + Invokes(testing.NewListActionWithOptions(konnectextensionsResource, konnectextensionsKind, c.ns, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.KonnectExtensionList{ListMeta: obj.(*v1alpha1.KonnectExtensionList).ListMeta} + for _, item := range obj.(*v1alpha1.KonnectExtensionList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested konnectExtensions. +func (c *FakeKonnectExtensions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchActionWithOptions(konnectextensionsResource, c.ns, opts)) + +} + +// Create takes the representation of a konnectExtension and creates it. Returns the server's representation of the konnectExtension, and an error, if there is any. +func (c *FakeKonnectExtensions) Create(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.CreateOptions) (result *v1alpha1.KonnectExtension, err error) { + emptyResult := &v1alpha1.KonnectExtension{} + obj, err := c.Fake. + Invokes(testing.NewCreateActionWithOptions(konnectextensionsResource, c.ns, konnectExtension, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.KonnectExtension), err +} + +// Update takes the representation of a konnectExtension and updates it. Returns the server's representation of the konnectExtension, and an error, if there is any. +func (c *FakeKonnectExtensions) Update(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (result *v1alpha1.KonnectExtension, err error) { + emptyResult := &v1alpha1.KonnectExtension{} + obj, err := c.Fake. + Invokes(testing.NewUpdateActionWithOptions(konnectextensionsResource, c.ns, konnectExtension, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.KonnectExtension), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeKonnectExtensions) UpdateStatus(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (result *v1alpha1.KonnectExtension, err error) { + emptyResult := &v1alpha1.KonnectExtension{} + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceActionWithOptions(konnectextensionsResource, "status", c.ns, konnectExtension, opts), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.KonnectExtension), err +} + +// Delete takes name of the konnectExtension and deletes it. Returns an error if one occurs. +func (c *FakeKonnectExtensions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(konnectextensionsResource, c.ns, name, opts), &v1alpha1.KonnectExtension{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeKonnectExtensions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionActionWithOptions(konnectextensionsResource, c.ns, opts, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.KonnectExtensionList{}) + return err +} + +// Patch applies the patch and returns the patched konnectExtension. +func (c *FakeKonnectExtensions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KonnectExtension, err error) { + emptyResult := &v1alpha1.KonnectExtension{} + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceActionWithOptions(konnectextensionsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) + + if obj == nil { + return emptyResult, err + } + return obj.(*v1alpha1.KonnectExtension), err +} diff --git a/pkg/clientset/typed/apis/v1alpha1/generated_expansion.go b/pkg/clientset/typed/apis/v1alpha1/generated_expansion.go index 6d868f32f..170edf4e0 100644 --- a/pkg/clientset/typed/apis/v1alpha1/generated_expansion.go +++ b/pkg/clientset/typed/apis/v1alpha1/generated_expansion.go @@ -20,8 +20,8 @@ package v1alpha1 type AIGatewayExpansion interface{} -type DataPlaneKonnectExtensionExpansion interface{} - type DataPlaneMetricsExtensionExpansion interface{} type KongPluginInstallationExpansion interface{} + +type KonnectExtensionExpansion interface{} diff --git a/pkg/clientset/typed/apis/v1alpha1/konnectextension.go b/pkg/clientset/typed/apis/v1alpha1/konnectextension.go new file mode 100644 index 000000000..cda1a9c22 --- /dev/null +++ b/pkg/clientset/typed/apis/v1alpha1/konnectextension.go @@ -0,0 +1,69 @@ +/* +Copyright 2022 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + + v1alpha1 "github.com/kong/gateway-operator/api/v1alpha1" + scheme "github.com/kong/gateway-operator/pkg/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// KonnectExtensionsGetter has a method to return a KonnectExtensionInterface. +// A group's client should implement this interface. +type KonnectExtensionsGetter interface { + KonnectExtensions(namespace string) KonnectExtensionInterface +} + +// KonnectExtensionInterface has methods to work with KonnectExtension resources. +type KonnectExtensionInterface interface { + Create(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.CreateOptions) (*v1alpha1.KonnectExtension, error) + Update(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (*v1alpha1.KonnectExtension, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, konnectExtension *v1alpha1.KonnectExtension, opts v1.UpdateOptions) (*v1alpha1.KonnectExtension, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.KonnectExtension, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.KonnectExtensionList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KonnectExtension, err error) + KonnectExtensionExpansion +} + +// konnectExtensions implements KonnectExtensionInterface +type konnectExtensions struct { + *gentype.ClientWithList[*v1alpha1.KonnectExtension, *v1alpha1.KonnectExtensionList] +} + +// newKonnectExtensions returns a KonnectExtensions +func newKonnectExtensions(c *ApisV1alpha1Client, namespace string) *konnectExtensions { + return &konnectExtensions{ + gentype.NewClientWithList[*v1alpha1.KonnectExtension, *v1alpha1.KonnectExtensionList]( + "konnectextensions", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *v1alpha1.KonnectExtension { return &v1alpha1.KonnectExtension{} }, + func() *v1alpha1.KonnectExtensionList { return &v1alpha1.KonnectExtensionList{} }), + } +} diff --git a/pkg/consts/dataplane.go b/pkg/consts/dataplane.go index 00a1a350e..0e6e1bf77 100644 --- a/pkg/consts/dataplane.go +++ b/pkg/consts/dataplane.go @@ -180,11 +180,11 @@ const ( ) // ----------------------------------------------------------------------------- -// Consts - DataPlaneKonnectExtension Finalizers +// Consts - KonnectExtension Finalizers // ----------------------------------------------------------------------------- const ( - // DataPlaneExtensionFinalizer is the finalizer added to DataPlaneKonnectExtension + // DataPlaneExtensionFinalizer is the finalizer added to KonnectExtension // to ensure that the resources are not deleted when in use by a dataplane. DataPlaneExtensionFinalizer = "gateway-operator.konghq.com/extension-in-use" )