diff --git a/CHANGELOG.md b/CHANGELOG.md index 1075f9416..4864cbced 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,8 +53,10 @@ - Added command line flags to configure the certificate generator job's images. [#516](https://github.com/Kong/gateway-operator/pull/516) - Add `KongPluginBinding` reconciler for Konnect Plugins. - [#513](https://github.com/Kong/gateway-operator/pull/513) - [#535](https://github.com/Kong/gateway-operator/pull/535) + [#513](https://github.com/Kong/gateway-operator/pull/513), [#535](https://github.com/Kong/gateway-operator/pull/535) +- The `DataPlaneKonnectExtension` 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) ### Fixed diff --git a/api/v1alpha1/dataplane_konnect_extension_types.go b/api/v1alpha1/dataplane_konnect_extension_types.go new file mode 100644 index 000000000..fe4d1feb6 --- /dev/null +++ b/api/v1alpha1/dataplane_konnect_extension_types.go @@ -0,0 +1,98 @@ +package v1alpha1 + +/* +Copyright 2024 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. +*/ + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" +) + +func init() { + SchemeBuilder.Register(&DataPlaneKonnectExtension{}, &DataPlaneKonnectExtensionList{}) +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:categories=kong;all +// +kubebuilder:subresource:status + +// 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. +type DataPlaneKonnectExtension 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"` +} + +// +kubebuilder:object:root=true + +// DataPlaneKonnectExtensionList contains a list of DataPlaneKonnectExtension. +type DataPlaneKonnectExtensionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DataPlaneKonnectExtension `json:"items"` +} + +// DataPlaneKonnectExtensionSpec defines the desired state of DataPlaneKonnectExtension. +type DataPlaneKonnectExtensionSpec struct { + // ControlPlaneRef is a reference to a ControlPlane this DataPlaneKonnectExtension is associated with. + // +kubebuilder:validation:Required + ControlPlaneRef configurationv1alpha1.ControlPlaneRef `json:"controlPlaneRef"` + + // ControlPlaneRegion is the region of the Konnect Control Plane. + // + // +kubebuilder:example:=us + // +kubebuilder:validation:Required + ControlPlaneRegion string `json:"controlPlaneRegion"` + + // 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. + // + // +kubebuilder:example:=foo.example.com + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=253 + // +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` + ServerHostname string `json:"serverHostname"` + + // ClusterCertificateSecretName is a name of the Secret containing the Konnect Control Plane's cluster certificate. + // +kubebuilder:validation:Required + ClusterCertificateSecretName string `json:"clusterCertificateSecretName"` + + // ClusterDataPlaneLabels is a set of labels that will be applied to the Konnect DataPlane. + // +optional + ClusterDataPlaneLabels map[string]string `json:"clusterDataPlaneLabels,omitempty"` +} + +// DataPlaneKonnectExtensionStatus defines the observed state of DataPlaneKonnectExtension. +type DataPlaneKonnectExtensionStatus 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. + // + // +kube:validation:Optional + DataPlaneRefs []NamespacedRef `json:"dataPlaneRefs,omitempty"` +} diff --git a/api/v1alpha1/extensionref_types.go b/api/v1alpha1/extensionref_types.go index 338d52251..ac892f05f 100644 --- a/api/v1alpha1/extensionref_types.go +++ b/api/v1alpha1/extensionref_types.go @@ -20,6 +20,8 @@ package v1alpha1 // defines extended behavior for a resource (e.g. ControlPlane). type ExtensionRef struct { // Group is the group of the extension resource. + // +kubebuilder:validation:Optional + // +kubebuilder:default=gateway-operator.konghq.com Group string `json:"group"` // Kind is kind of the extension resource. diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 5e55ed208..2f1265469 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -260,6 +260,110 @@ func (in *CloudHostedLargeLanguageModel) DeepCopy() *CloudHostedLargeLanguageMod 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) + 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 diff --git a/api/v1beta1/dataplane_types.go b/api/v1beta1/dataplane_types.go index 27d889bd7..7e4ed597c 100644 --- a/api/v1beta1/dataplane_types.go +++ b/api/v1beta1/dataplane_types.go @@ -21,6 +21,8 @@ import ( policyv1 "k8s.io/api/policy/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/kong/gateway-operator/api/v1alpha1" ) func init() { @@ -32,6 +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:printcolumn:name="Ready",description="The Resource is ready",type=string,JSONPath=`.status.conditions[?(@.type=='Ready')].status` // DataPlane is the Schema for the dataplanes API @@ -68,6 +71,15 @@ type DataPlaneOptions struct { // +optional Resources DataPlaneResources `json:"resources"` + + // 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. + // + // +optional + // +kubebuilder:validation:MinItems=0 + // +kubebuilder:validation:MaxItems=1 + Extensions []v1alpha1.ExtensionRef `json:"extensions,omitempty"` } // DataPlaneResources defines the resources that will be created and managed diff --git a/api/v1beta1/gatewayconfiguration_types.go b/api/v1beta1/gatewayconfiguration_types.go index 790791c5d..9bfeffe3f 100644 --- a/api/v1beta1/gatewayconfiguration_types.go +++ b/api/v1beta1/gatewayconfiguration_types.go @@ -18,16 +18,19 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/kong/gateway-operator/api/v1alpha1" ) func init() { SchemeBuilder.Register(&GatewayConfiguration{}, &GatewayConfigurationList{}) } -//+genclient -//+kubebuilder:object:root=true -//+kubebuilder:subresource:status -//+kubebuilder:resource:shortName=kogc,categories=kong;all +// +genclient +// +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" // GatewayConfiguration is the Schema for the gatewayconfigurations API type GatewayConfiguration struct { @@ -61,6 +64,15 @@ type GatewayConfigDataPlaneOptions struct { // +optional Network GatewayConfigDataPlaneNetworkOptions `json:"network"` + + // 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. + // + // +optional + // +kubebuilder:validation:MinItems=0 + // +kubebuilder:validation:MaxItems=1 + Extensions []v1alpha1.ExtensionRef `json:"extensions,omitempty"` } // GatewayConfigDataPlaneNetworkOptions defines network related options for a DataPlane. diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index e2bc900e9..5b1052697 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -339,6 +339,13 @@ func (in *DataPlaneOptions) DeepCopyInto(out *DataPlaneOptions) { in.Deployment.DeepCopyInto(&out.Deployment) in.Network.DeepCopyInto(&out.Network) in.Resources.DeepCopyInto(&out.Resources) + if in.Extensions != nil { + in, out := &in.Extensions, &out.Extensions + *out = make([]v1alpha1.ExtensionRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataPlaneOptions. @@ -605,6 +612,13 @@ func (in *GatewayConfigDataPlaneOptions) DeepCopyInto(out *GatewayConfigDataPlan *out = *in in.Deployment.DeepCopyInto(&out.Deployment) in.Network.DeepCopyInto(&out.Network) + if in.Extensions != nil { + in, out := &in.Extensions, &out.Extensions + *out = make([]v1alpha1.ExtensionRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayConfigDataPlaneOptions. diff --git a/config/crd/bases/gateway-operator.konghq.com_controlplanes.yaml b/config/crd/bases/gateway-operator.konghq.com_controlplanes.yaml index 2ea6e571f..57e5a46bc 100644 --- a/config/crd/bases/gateway-operator.konghq.com_controlplanes.yaml +++ b/config/crd/bases/gateway-operator.konghq.com_controlplanes.yaml @@ -8094,6 +8094,7 @@ spec: defines extended behavior for a resource (e.g. ControlPlane). properties: group: + default: gateway-operator.konghq.com description: Group is the group of the extension resource. type: string kind: @@ -8114,7 +8115,6 @@ spec: This field MUST not be set when referring to cluster-scoped resources. type: string required: - - group - kind - name type: object diff --git a/config/crd/bases/gateway-operator.konghq.com_dataplanekonnectextensions.yaml b/config/crd/bases/gateway-operator.konghq.com_dataplanekonnectextensions.yaml new file mode 100644 index 000000000..9286d5094 --- /dev/null +++ b/config/crd/bases/gateway-operator.konghq.com_dataplanekonnectextensions.yaml @@ -0,0 +1,157 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.16.2 + name: dataplanekonnectextensions.gateway-operator.konghq.com +spec: + group: gateway-operator.konghq.com + names: + categories: + - kong + - all + kind: DataPlaneKonnectExtension + listKind: DataPlaneKonnectExtensionList + plural: dataplanekonnectextensions + singular: dataplanekonnectextension + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + 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. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Spec is the specification of the DataPlaneKonnectExtension + resource. + properties: + clusterCertificateSecretName: + description: ClusterCertificateSecretName is a name of the Secret + containing the Konnect Control Plane's cluster certificate. + type: string + clusterDataPlaneLabels: + additionalProperties: + type: string + description: ClusterDataPlaneLabels is a set of labels that will be + applied to the Konnect DataPlane. + type: object + controlPlaneRef: + description: ControlPlaneRef is a reference to a ControlPlane this + DataPlaneKonnectExtension is associated with. + properties: + konnectID: + description: |- + KonnectID is the schema for the KonnectID type. + This field is required when the Type is konnectID. + type: string + konnectNamespacedRef: + description: |- + 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. + properties: + name: + description: Name is the name of the Konnect Control Plane. + type: string + required: + - name + type: object + type: + description: |- + Type can be one of: + - konnectID + - konnectNamespacedRef + enum: + - konnectID + - konnectNamespacedRef + type: string + type: object + x-kubernetes-validations: + - message: when type is konnectNamespacedRef, konnectNamespacedRef + must be set + rule: 'self.type == ''konnectNamespacedRef'' ? has(self.konnectNamespacedRef) + : true' + - message: when type is konnectID, konnectID must be set + rule: 'self.type == ''konnectID'' ? has(self.konnectID) : true' + controlPlaneRegion: + description: ControlPlaneRegion is the region of the Konnect Control + Plane. + example: us + type: string + serverHostname: + description: |- + 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. + example: foo.example.com + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + required: + - clusterCertificateSecretName + - controlPlaneRef + - controlPlaneRegion + - serverHostname + type: object + status: + description: Status is the status of the DataPlaneKonnectExtension resource. + properties: + dataPlaneRefs: + description: |- + 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. + items: + description: NamespacedRef is a reference to a namespaced resource. + properties: + name: + description: Name is the name of the referred resource. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: |- + Namespace is the namespace of the referred resource. + + For namespace-scoped resources if no Namespace is provided then the + namespace of the parent object MUST be used. + + This field MUST not be set when referring to cluster-scoped resources. + type: string + required: + - name + type: object + type: array + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml b/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml index 677372ad1..da4ae0dce 100644 --- a/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml +++ b/config/crd/bases/gateway-operator.konghq.com_dataplanes.yaml @@ -8769,6 +8769,44 @@ spec: x-kubernetes-validations: - message: Using both replicas and scaling fields is not allowed. rule: '!(has(self.scaling) && has(self.replicas))' + extensions: + 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. + items: + description: |- + ExtensionRef corresponds to another resource in the Kubernetes cluster which + defines extended behavior for a resource (e.g. ControlPlane). + properties: + group: + default: gateway-operator.konghq.com + description: Group is the group of the extension resource. + type: string + kind: + description: Kind is kind of the extension resource. + type: string + name: + description: Name is the name of the referred resource. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: |- + Namespace is the namespace of the referred resource. + + For namespace-scoped resources if no Namespace is provided then the + namespace of the parent object MUST be used. + + This field MUST not be set when referring to cluster-scoped resources. + type: string + required: + - kind + - name + type: object + maxItems: 1 + minItems: 0 + type: array network: description: DataPlaneNetworkOptions defines network related options for a DataPlane. @@ -9272,6 +9310,11 @@ spec: - replicas type: object type: object + 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' 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 12ef88bc9..9fee13c15 100644 --- a/config/crd/bases/gateway-operator.konghq.com_gatewayconfigurations.yaml +++ b/config/crd/bases/gateway-operator.konghq.com_gatewayconfigurations.yaml @@ -8200,6 +8200,7 @@ spec: defines extended behavior for a resource (e.g. ControlPlane). properties: group: + default: gateway-operator.konghq.com description: Group is the group of the extension resource. type: string kind: @@ -8220,7 +8221,6 @@ spec: This field MUST not be set when referring to cluster-scoped resources. type: string required: - - group - kind - name type: object @@ -17062,6 +17062,44 @@ spec: x-kubernetes-validations: - message: Using both replicas and scaling fields is not allowed. rule: '!(has(self.scaling) && has(self.replicas))' + extensions: + 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. + items: + description: |- + ExtensionRef corresponds to another resource in the Kubernetes cluster which + defines extended behavior for a resource (e.g. ControlPlane). + properties: + group: + default: gateway-operator.konghq.com + description: Group is the group of the extension resource. + type: string + kind: + description: Kind is kind of the extension resource. + type: string + name: + description: Name is the name of the referred resource. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: |- + Namespace is the namespace of the referred resource. + + For namespace-scoped resources if no Namespace is provided then the + namespace of the parent object MUST be used. + + This field MUST not be set when referring to cluster-scoped resources. + type: string + required: + - kind + - name + type: object + maxItems: 1 + minItems: 0 + type: array network: description: GatewayConfigDataPlaneNetworkOptions defines network related options for a DataPlane. @@ -17205,6 +17243,11 @@ spec: x-kubernetes-list-type: map type: object type: object + 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'') + : true' served: true storage: true subresources: diff --git a/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml b/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml index 677372ad1..da4ae0dce 100644 --- a/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml +++ b/config/crd/dataplane/gateway-operator.konghq.com_dataplanes.yaml @@ -8769,6 +8769,44 @@ spec: x-kubernetes-validations: - message: Using both replicas and scaling fields is not allowed. rule: '!(has(self.scaling) && has(self.replicas))' + extensions: + 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. + items: + description: |- + ExtensionRef corresponds to another resource in the Kubernetes cluster which + defines extended behavior for a resource (e.g. ControlPlane). + properties: + group: + default: gateway-operator.konghq.com + description: Group is the group of the extension resource. + type: string + kind: + description: Kind is kind of the extension resource. + type: string + name: + description: Name is the name of the referred resource. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: |- + Namespace is the namespace of the referred resource. + + For namespace-scoped resources if no Namespace is provided then the + namespace of the parent object MUST be used. + + This field MUST not be set when referring to cluster-scoped resources. + type: string + required: + - kind + - name + type: object + maxItems: 1 + minItems: 0 + type: array network: description: DataPlaneNetworkOptions defines network related options for a DataPlane. @@ -9272,6 +9310,11 @@ spec: - replicas type: object type: object + 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' served: true storage: true subresources: diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index edd37ec2b..951282420 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -10,6 +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 #+kubebuilder:scaffold:crdkustomizeresource # patches: diff --git a/config/samples/dataplane-konnect-extension.yaml b/config/samples/dataplane-konnect-extension.yaml new file mode 100644 index 000000000..c958c6847 --- /dev/null +++ b/config/samples/dataplane-konnect-extension.yaml @@ -0,0 +1,57 @@ +# Ensure that you create a secret containing your cluster certificate before applying this +# kubectl create secret tls konnect-client-tls -n kong --cert=./tls.crt --key=./tls.key +# --- +# apiVersion: v1 +# kind: Secret +# metadata: +# name: konnect-client-tls +# type: kubernetes.io/tls +# stringData: +# tls.crt: | +# -----BEGIN CERTIFICATE----- +# MIIDhDCCAm6gAwIBAgIBATALBgkqhkiG9w0BAQ0wLDEqMAkGA1UEBhMCVVMwHQYD... +# zy5lW2IG5AjNDV8VBCthVj5j1UENTVi4rLhu8j/kfb9gNhvqaN8UcA== +# -----END CERTIFICATE----- +# tls.key: | +# -----BEGIN PRIVATE KEY----- +# MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQChCERwsegdWSnS... +# WSK9kndNKpFI4vPvuw6j2JJl +# -----END PRIVATE KEY----- +# --- +apiVersion: gateway-operator.konghq.com/v1alpha1 +kind: DataPlaneKonnectExtension +metadata: + name: my-konnect-config +spec: + controlPlaneRef: + type: konnectID + konnectID: + serverHostname: your.konnect.server + controlPlaneRegion: eu + clusterCertificateSecretName: konnect-client-tls +--- +apiVersion: gateway-operator.konghq.com/v1beta1 +kind: DataPlane +metadata: + name: konnect-extension-example +spec: + extensions: + - kind: DataPlaneKonnectExtension + name: my-konnect-config + group: gateway-operator.konghq.com + deployment: + replicas: 3 + podTemplateSpec: + metadata: + labels: + dataplane-pod-label: example + annotations: + dataplane-pod-annotation: example + spec: + containers: + - name: proxy + # renovate: datasource=docker versioning=docker + image: kong/kong-gateway:3.7 + readinessProbe: + initialDelaySeconds: 1 + periodSeconds: 1 diff --git a/docs/api-reference.md b/docs/api-reference.md index 24e1462a1..393320b5c 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -10,6 +10,7 @@ Package v1alpha1 contains API Schema definitions for the operator v1alpha1 API group - [AIGateway](#aigateway) +- [DataPlaneKonnectExtension](#dataplanekonnectextension) - [DataPlaneMetricsExtension](#dataplanemetricsextension) - [KongPluginInstallation](#kongplugininstallation) ### AIGateway @@ -57,6 +58,26 @@ 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 @@ -241,6 +262,40 @@ Azure, e.t.c.). _Appears in:_ - [LargeLanguageModels](#largelanguagemodels) +#### 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. | +| `clusterCertificateSecretName` _string_ | ClusterCertificateSecretName is a name of the Secret containing the Konnect Control Plane's cluster certificate. | +| `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 @@ -307,6 +362,9 @@ defines extended behavior for a resource (e.g. ControlPlane). _Appears in:_ - [ControlPlaneOptions](#controlplaneoptions) - [ControlPlaneSpec](#controlplanespec) +- [DataPlaneOptions](#dataplaneoptions) +- [DataPlaneSpec](#dataplanespec) +- [GatewayConfigDataPlaneOptions](#gatewayconfigdataplaneoptions) @@ -458,6 +516,7 @@ NamespacedRef is a reference to a namespaced resource. _Appears in:_ +- [DataPlaneKonnectExtensionStatus](#dataplanekonnectextensionstatus) - [DataPlaneMetricsExtensionStatus](#dataplanemetricsextensionstatus) - [ExtensionRef](#extensionref) @@ -744,6 +803,7 @@ deploy the DataPlane. | `deployment` _[DataPlaneDeploymentOptions](#dataplanedeploymentoptions)_ | | | `network` _[DataPlaneNetworkOptions](#dataplanenetworkoptions)_ | | | `resources` _[DataPlaneResources](#dataplaneresources)_ | | +| `extensions` _[ExtensionRef](#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. | _Appears in:_ @@ -878,6 +938,7 @@ DataPlaneSpec defines the desired state of DataPlane | `deployment` _[DataPlaneDeploymentOptions](#dataplanedeploymentoptions)_ | | | `network` _[DataPlaneNetworkOptions](#dataplanenetworkoptions)_ | | | `resources` _[DataPlaneResources](#dataplaneresources)_ | | +| `extensions` _[ExtensionRef](#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. | _Appears in:_ @@ -952,6 +1013,7 @@ configure and deploy a DataPlane object. | --- | --- | | `deployment` _[DataPlaneDeploymentOptions](#dataplanedeploymentoptions)_ | | | `network` _[GatewayConfigDataPlaneNetworkOptions](#gatewayconfigdataplanenetworkoptions)_ | | +| `extensions` _[ExtensionRef](#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. | _Appears in:_ diff --git a/pkg/clientset/typed/apis/v1alpha1/apis_client.go b/pkg/clientset/typed/apis/v1alpha1/apis_client.go index d60120dc2..6a5917128 100644 --- a/pkg/clientset/typed/apis/v1alpha1/apis_client.go +++ b/pkg/clientset/typed/apis/v1alpha1/apis_client.go @@ -29,6 +29,7 @@ import ( type ApisV1alpha1Interface interface { RESTClient() rest.Interface AIGatewaysGetter + DataPlaneKonnectExtensionsGetter DataPlaneMetricsExtensionsGetter KongPluginInstallationsGetter } @@ -42,6 +43,10 @@ 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) } diff --git a/pkg/clientset/typed/apis/v1alpha1/dataplanekonnectextension.go b/pkg/clientset/typed/apis/v1alpha1/dataplanekonnectextension.go new file mode 100644 index 000000000..5c0a9b390 --- /dev/null +++ b/pkg/clientset/typed/apis/v1alpha1/dataplanekonnectextension.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" +) + +// 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 2ce93e15a..c9a674ea5 100644 --- a/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go @@ -32,6 +32,10 @@ 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} } diff --git a/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanekonnectextension.go b/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanekonnectextension.go new file mode 100644 index 000000000..1f30ad5b3 --- /dev/null +++ b/pkg/clientset/typed/apis/v1alpha1/fake/fake_dataplanekonnectextension.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" +) + +// 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/generated_expansion.go b/pkg/clientset/typed/apis/v1alpha1/generated_expansion.go index c74037b5d..6d868f32f 100644 --- a/pkg/clientset/typed/apis/v1alpha1/generated_expansion.go +++ b/pkg/clientset/typed/apis/v1alpha1/generated_expansion.go @@ -20,6 +20,8 @@ package v1alpha1 type AIGatewayExpansion interface{} +type DataPlaneKonnectExtensionExpansion interface{} + type DataPlaneMetricsExtensionExpansion interface{} type KongPluginInstallationExpansion interface{}