From 13d36c4c628c61362ab80c9335e1450422d23be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Wed, 31 Jul 2024 20:21:03 +0200 Subject: [PATCH] feat(crd): add Konnect API group --- Makefile | 3 +- api/configuration/v1/kongconsumer_types.go | 5 +- api/configuration/v1alpha1/kongroute_types.go | 6 +- .../v1alpha1/kongservice_types.go | 6 +- .../v1alpha1/zz_generated.deepcopy.go | 111 -------------- api/konnect/v1alpha1/doc.go | 20 +++ api/konnect/v1alpha1/groupversion_info.go | 41 +++++ .../konnect_apiauthconfiguration_types.go | 1 + .../v1alpha1/konnect_configuration.go | 0 api/konnect/v1alpha1/zz_generated.deepcopy.go | 137 +++++++++++++++++ ...ghq.com_konnectapiauthconfigurations.yaml} | 4 +- config/crd/kustomization.yaml | 4 +- docs/api-reference.md | 67 --------- pkg/clientset/clientset.go | 13 ++ pkg/clientset/fake/clientset_generated.go | 7 + pkg/clientset/fake/register.go | 2 + pkg/clientset/scheme/register.go | 2 + .../v1alpha1/configuration_client.go | 5 - .../fake/fake_configuration_client.go | 4 - .../configuration/v1alpha1/fake/fake_route.go | 141 ------------------ .../v1alpha1/fake/fake_service.go | 141 ------------------ .../v1alpha1/generated_expansion.go | 2 - pkg/clientset/typed/konnect/v1alpha1/doc.go | 20 +++ .../typed/konnect/v1alpha1/fake/doc.go | 20 +++ .../v1alpha1/fake/fake_konnect_client.go | 40 +++++ .../fake/fake_konnectapiauthconfiguration.go | 4 +- .../konnect/v1alpha1/generated_expansion.go | 21 +++ .../typed/konnect/v1alpha1/konnect_client.go | 107 +++++++++++++ .../v1alpha1/konnectapiauthconfiguration.go | 4 +- 29 files changed, 453 insertions(+), 485 deletions(-) create mode 100644 api/konnect/v1alpha1/doc.go create mode 100644 api/konnect/v1alpha1/groupversion_info.go rename api/{configuration => konnect}/v1alpha1/konnect_apiauthconfiguration_types.go (98%) rename api/{configuration => konnect}/v1alpha1/konnect_configuration.go (100%) create mode 100644 api/konnect/v1alpha1/zz_generated.deepcopy.go rename config/crd/bases/{configuration.konghq.com_konnectapiauthconfigurations.yaml => konnect.konghq.com_konnectapiauthconfigurations.yaml} (98%) delete mode 100644 pkg/clientset/typed/configuration/v1alpha1/fake/fake_route.go delete mode 100644 pkg/clientset/typed/configuration/v1alpha1/fake/fake_service.go create mode 100644 pkg/clientset/typed/konnect/v1alpha1/doc.go create mode 100644 pkg/clientset/typed/konnect/v1alpha1/fake/doc.go create mode 100644 pkg/clientset/typed/konnect/v1alpha1/fake/fake_konnect_client.go rename pkg/clientset/typed/{configuration => konnect}/v1alpha1/fake/fake_konnectapiauthconfiguration.go (98%) create mode 100644 pkg/clientset/typed/konnect/v1alpha1/generated_expansion.go create mode 100644 pkg/clientset/typed/konnect/v1alpha1/konnect_client.go rename pkg/clientset/typed/{configuration => konnect}/v1alpha1/konnectapiauthconfiguration.go (97%) diff --git a/Makefile b/Makefile index fbb6f2d..8ea7e80 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,7 @@ verify.generators: verify.repo generate verify.diff # Build - Generators # ------------------------------------------------------------------------------ -CRD_GEN_PATHS ?= ./api/configuration/... +CRD_GEN_PATHS ?= ./api/configuration/...;./api/konnect/... CRD_INCUBATOR_GEN_PATHS ?= ./api/incubator/... CRD_OPTIONS ?= "+crd:allowDangerousTypes=true" @@ -151,6 +151,7 @@ generate.clientsets: client-gen --input configuration/v1 \ --input configuration/v1alpha1 \ --input configuration/v1beta1 \ + --input konnect/v1alpha1 \ --input incubator/v1alpha1 \ --output-dir pkg/ \ --output-pkg $(REPO_URL)/pkg/ diff --git a/api/configuration/v1/kongconsumer_types.go b/api/configuration/v1/kongconsumer_types.go index 689a885..adaa8f7 100644 --- a/api/configuration/v1/kongconsumer_types.go +++ b/api/configuration/v1/kongconsumer_types.go @@ -20,6 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" + konnectv1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" ) // +genclient @@ -72,7 +73,7 @@ func (c KongConsumer) GetTypeName() string { func (c *KongConsumer) SetKonnectLabels(labels map[string]string) { } -func (c *KongConsumer) GetKonnectAPIAuthConfigurationRef() configurationv1alpha1.KonnectAPIAuthConfigurationRef { +func (c *KongConsumer) GetKonnectAPIAuthConfigurationRef() konnectv1alpha1.KonnectAPIAuthConfigurationRef { return c.Spec.KonnectConfiguration.APIAuthConfigurationRef } @@ -91,7 +92,7 @@ type KongConsumerSpec struct { ControlPlaneRef configurationv1alpha1.ControlPlaneRef `json:"controlPlaneRef,omitempty"` // KonnectConfiguration holds the Konnect configuration like authentication configuration. - KonnectConfiguration configurationv1alpha1.KonnectConfiguration `json:"konnect,omitempty"` + KonnectConfiguration konnectv1alpha1.KonnectConfiguration `json:"konnect,omitempty"` } // +kubebuilder:object:root=true diff --git a/api/configuration/v1alpha1/kongroute_types.go b/api/configuration/v1alpha1/kongroute_types.go index 2fcaaef..3ee4c45 100644 --- a/api/configuration/v1alpha1/kongroute_types.go +++ b/api/configuration/v1alpha1/kongroute_types.go @@ -19,6 +19,8 @@ package v1alpha1 import ( sdkkonnectgocomp "github.com/Kong/sdk-konnect-go/models/components" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + konnectv1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" ) // TODO(pmalek): expression field is not in OpenAPI spec but error message references it: @@ -51,7 +53,7 @@ func (c KongRoute) GetTypeName() string { return "KongRoute" } -func (c *KongRoute) GetKonnectAPIAuthConfigurationRef() KonnectAPIAuthConfigurationRef { +func (c *KongRoute) GetKonnectAPIAuthConfigurationRef() konnectv1alpha1.KonnectAPIAuthConfigurationRef { return c.Spec.KonnectConfiguration.APIAuthConfigurationRef } @@ -77,7 +79,7 @@ type KongRouteSpec struct { // KonnectConfiguration holds the Konnect configuration like authentication configuration. // +kubebuilder:validation:Required - KonnectConfiguration KonnectConfiguration `json:"konnect,omitempty"` + KonnectConfiguration konnectv1alpha1.KonnectConfiguration `json:"konnect,omitempty"` KongRouteAPISpec `json:",inline"` } diff --git a/api/configuration/v1alpha1/kongservice_types.go b/api/configuration/v1alpha1/kongservice_types.go index c57c8fe..4888454 100644 --- a/api/configuration/v1alpha1/kongservice_types.go +++ b/api/configuration/v1alpha1/kongservice_types.go @@ -19,6 +19,8 @@ package v1alpha1 import ( sdkkonnectgocomp "github.com/Kong/sdk-konnect-go/models/components" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + konnectv1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" ) // KongService is the schema for Services API which defines a Kong Service. @@ -52,7 +54,7 @@ func (c KongService) GetTypeName() string { func (c *KongService) SetKonnectLabels(labels map[string]string) { } -func (c *KongService) GetKonnectAPIAuthConfigurationRef() KonnectAPIAuthConfigurationRef { +func (c *KongService) GetKonnectAPIAuthConfigurationRef() konnectv1alpha1.KonnectAPIAuthConfigurationRef { return c.Spec.KonnectConfiguration.APIAuthConfigurationRef } @@ -74,7 +76,7 @@ type KongServiceSpec struct { // KonnectConfiguration holds the Konnect configuration like authentication configuration. // +kubebuilder:validation:Required - KonnectConfiguration KonnectConfiguration `json:"konnect,omitempty"` + KonnectConfiguration konnectv1alpha1.KonnectConfiguration `json:"konnect,omitempty"` KongServiceAPISpec `json:",inline"` } diff --git a/api/configuration/v1alpha1/zz_generated.deepcopy.go b/api/configuration/v1alpha1/zz_generated.deepcopy.go index ee5c733..5fd10f2 100644 --- a/api/configuration/v1alpha1/zz_generated.deepcopy.go +++ b/api/configuration/v1alpha1/zz_generated.deepcopy.go @@ -1020,117 +1020,6 @@ func (in *KongVaultStatus) DeepCopy() *KongVaultStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KonnectAPIAuthConfiguration) DeepCopyInto(out *KonnectAPIAuthConfiguration) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec - in.Status.DeepCopyInto(&out.Status) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfiguration. -func (in *KonnectAPIAuthConfiguration) DeepCopy() *KonnectAPIAuthConfiguration { - if in == nil { - return nil - } - out := new(KonnectAPIAuthConfiguration) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KonnectAPIAuthConfiguration) 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 *KonnectAPIAuthConfigurationList) DeepCopyInto(out *KonnectAPIAuthConfigurationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]KonnectAPIAuthConfiguration, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationList. -func (in *KonnectAPIAuthConfigurationList) DeepCopy() *KonnectAPIAuthConfigurationList { - if in == nil { - return nil - } - out := new(KonnectAPIAuthConfigurationList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KonnectAPIAuthConfigurationList) 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 *KonnectAPIAuthConfigurationRef) DeepCopyInto(out *KonnectAPIAuthConfigurationRef) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationRef. -func (in *KonnectAPIAuthConfigurationRef) DeepCopy() *KonnectAPIAuthConfigurationRef { - if in == nil { - return nil - } - out := new(KonnectAPIAuthConfigurationRef) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KonnectAPIAuthConfigurationSpec) DeepCopyInto(out *KonnectAPIAuthConfigurationSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationSpec. -func (in *KonnectAPIAuthConfigurationSpec) DeepCopy() *KonnectAPIAuthConfigurationSpec { - if in == nil { - return nil - } - out := new(KonnectAPIAuthConfigurationSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KonnectAPIAuthConfigurationStatus) DeepCopyInto(out *KonnectAPIAuthConfigurationStatus) { - *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationStatus. -func (in *KonnectAPIAuthConfigurationStatus) DeepCopy() *KonnectAPIAuthConfigurationStatus { - if in == nil { - return nil - } - out := new(KonnectAPIAuthConfigurationStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KonnectEntityStatus) DeepCopyInto(out *KonnectEntityStatus) { *out = *in diff --git a/api/konnect/v1alpha1/doc.go b/api/konnect/v1alpha1/doc.go new file mode 100644 index 0000000..f22bee8 --- /dev/null +++ b/api/konnect/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 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. +*/ + +// Package v1alpha1 contains API Schema definitions for the konnect.konghq.com v1alpha1 API group. +// +kubebuilder:object:generate=true +// +groupName=konnect.konghq.com +package v1alpha1 diff --git a/api/konnect/v1alpha1/groupversion_info.go b/api/konnect/v1alpha1/groupversion_info.go new file mode 100644 index 0000000..0fa8915 --- /dev/null +++ b/api/konnect/v1alpha1/groupversion_info.go @@ -0,0 +1,41 @@ +/* +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. +*/ + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects. + GroupVersion = schema.GroupVersion{Group: "konnect.konghq.com", Version: "v1alpha1"} + + // SchemeGroupVersion is a convenience var for generated clientsets. + SchemeGroupVersion = GroupVersion + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +// Resource takes an unqualified resource and returns a Group qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/api/configuration/v1alpha1/konnect_apiauthconfiguration_types.go b/api/konnect/v1alpha1/konnect_apiauthconfiguration_types.go similarity index 98% rename from api/configuration/v1alpha1/konnect_apiauthconfiguration_types.go rename to api/konnect/v1alpha1/konnect_apiauthconfiguration_types.go index d3f23b7..fafdff1 100644 --- a/api/configuration/v1alpha1/konnect_apiauthconfiguration_types.go +++ b/api/konnect/v1alpha1/konnect_apiauthconfiguration_types.go @@ -11,6 +11,7 @@ func init() { // KonnectAPIAuthConfiguration is the Schema for the Konnect configuration type. // // +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:resource:scope=Namespaced // +kubebuilder:object:root=true // +kubebuilder:object:generate=true diff --git a/api/configuration/v1alpha1/konnect_configuration.go b/api/konnect/v1alpha1/konnect_configuration.go similarity index 100% rename from api/configuration/v1alpha1/konnect_configuration.go rename to api/konnect/v1alpha1/konnect_configuration.go diff --git a/api/konnect/v1alpha1/zz_generated.deepcopy.go b/api/konnect/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..9f2865f --- /dev/null +++ b/api/konnect/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,137 @@ +//go:build !ignore_autogenerated + +/* +Copyright 2021 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 controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KonnectAPIAuthConfiguration) DeepCopyInto(out *KonnectAPIAuthConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfiguration. +func (in *KonnectAPIAuthConfiguration) DeepCopy() *KonnectAPIAuthConfiguration { + if in == nil { + return nil + } + out := new(KonnectAPIAuthConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KonnectAPIAuthConfiguration) 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 *KonnectAPIAuthConfigurationList) DeepCopyInto(out *KonnectAPIAuthConfigurationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KonnectAPIAuthConfiguration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationList. +func (in *KonnectAPIAuthConfigurationList) DeepCopy() *KonnectAPIAuthConfigurationList { + if in == nil { + return nil + } + out := new(KonnectAPIAuthConfigurationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KonnectAPIAuthConfigurationList) 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 *KonnectAPIAuthConfigurationRef) DeepCopyInto(out *KonnectAPIAuthConfigurationRef) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationRef. +func (in *KonnectAPIAuthConfigurationRef) DeepCopy() *KonnectAPIAuthConfigurationRef { + if in == nil { + return nil + } + out := new(KonnectAPIAuthConfigurationRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KonnectAPIAuthConfigurationSpec) DeepCopyInto(out *KonnectAPIAuthConfigurationSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationSpec. +func (in *KonnectAPIAuthConfigurationSpec) DeepCopy() *KonnectAPIAuthConfigurationSpec { + if in == nil { + return nil + } + out := new(KonnectAPIAuthConfigurationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KonnectAPIAuthConfigurationStatus) DeepCopyInto(out *KonnectAPIAuthConfigurationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonnectAPIAuthConfigurationStatus. +func (in *KonnectAPIAuthConfigurationStatus) DeepCopy() *KonnectAPIAuthConfigurationStatus { + if in == nil { + return nil + } + out := new(KonnectAPIAuthConfigurationStatus) + in.DeepCopyInto(out) + return out +} diff --git a/config/crd/bases/configuration.konghq.com_konnectapiauthconfigurations.yaml b/config/crd/bases/konnect.konghq.com_konnectapiauthconfigurations.yaml similarity index 98% rename from config/crd/bases/configuration.konghq.com_konnectapiauthconfigurations.yaml rename to config/crd/bases/konnect.konghq.com_konnectapiauthconfigurations.yaml index 2d7b5f6..e184c52 100644 --- a/config/crd/bases/configuration.konghq.com_konnectapiauthconfigurations.yaml +++ b/config/crd/bases/konnect.konghq.com_konnectapiauthconfigurations.yaml @@ -4,9 +4,9 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.15.0 - name: konnectapiauthconfigurations.configuration.konghq.com + name: konnectapiauthconfigurations.konnect.konghq.com spec: - group: configuration.konghq.com + group: konnect.konghq.com names: kind: KonnectAPIAuthConfiguration listKind: KonnectAPIAuthConfigurationList diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 566f7bd..5e30698 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -17,5 +17,7 @@ resources: - bases/configuration.konghq.com_kongcustomentities.yaml - bases/configuration.konghq.com_kongservices.yaml - bases/configuration.konghq.com_kongroutes.yaml -- bases/configuration.konghq.com_konnectapiauthconfigurations.yaml + +- bases/konnect.konghq.com_konnectapiauthconfigurations.yaml + #+kubebuilder:scaffold:crdkustomizeresource diff --git a/docs/api-reference.md b/docs/api-reference.md index 99ab4ec..3e72871 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -336,7 +336,6 @@ Package v1alpha1 contains API Schema definitions for the configuration.konghq.co - [KongRoute](#kongroute) - [KongService](#kongservice) - [KongVault](#kongvault) -- [KonnectAPIAuthConfiguration](#konnectapiauthconfiguration) ### IngressClassParameters @@ -452,22 +451,6 @@ See: https://docs.konghq.com/gateway/latest/kong-enterprise/secrets-management/ -### KonnectAPIAuthConfiguration - - -KonnectAPIAuthConfiguration is the Schema for the Konnect configuration type. - - - -| Field | Description | -| --- | --- | -| `apiVersion` _string_ | `configuration.konghq.com/v1alpha1` -| `kind` _string_ | `KonnectAPIAuthConfiguration` -| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | -| `spec` _[KonnectAPIAuthConfigurationSpec](#konnectapiauthconfigurationspec)_ | Spec is the specification of the KonnectAPIAuthConfiguration resource. | - - - ### Types In this section you will find types that the CRDs rely on. @@ -806,56 +789,6 @@ _Appears in:_ -#### KonnectAPIAuthConfigurationRef - - - - - - -| Field | Description | -| --- | --- | -| `name` _string_ | Name is the name of the KonnectAPIAuthConfiguration resource. | - - -_Appears in:_ -- [KonnectConfiguration](#konnectconfiguration) - -#### KonnectAPIAuthConfigurationSpec - - -KonnectAPIAuthConfigurationSpec is the specification of the KonnectAPIAuthConfiguration resource. - - - -| Field | Description | -| --- | --- | -| `token` _string_ | Token is the Konnect token used to authenticate with the Konnect API. | -| `serverURL` _string_ | ServerURL is the URL of the Konnect server. TODO(pmalek): do we want this validation? | - - -_Appears in:_ -- [KonnectAPIAuthConfiguration](#konnectapiauthconfiguration) - - - -#### KonnectConfiguration - - - - - - -| Field | Description | -| --- | --- | -| `authRef` _[KonnectAPIAuthConfigurationRef](#konnectapiauthconfigurationref)_ | APIAuthConfigurationRef is the reference to the API Auth Configuration that should be used for this Konnect Configuration. | - - -_Appears in:_ -- [KongConsumerSpec](#kongconsumerspec) -- [KongRouteSpec](#kongroutespec) -- [KongServiceSpec](#kongservicespec) - #### KonnectEntityStatus diff --git a/pkg/clientset/clientset.go b/pkg/clientset/clientset.go index f0a4f5a..690f48e 100644 --- a/pkg/clientset/clientset.go +++ b/pkg/clientset/clientset.go @@ -26,6 +26,7 @@ import ( configurationv1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/configuration/v1alpha1" configurationv1beta1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/configuration/v1beta1" incubatorv1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/incubator/v1alpha1" + konnectv1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/konnect/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -37,6 +38,7 @@ type Interface interface { ConfigurationV1alpha1() configurationv1alpha1.ConfigurationV1alpha1Interface ConfigurationV1beta1() configurationv1beta1.ConfigurationV1beta1Interface IncubatorV1alpha1() incubatorv1alpha1.IncubatorV1alpha1Interface + KonnectV1alpha1() konnectv1alpha1.KonnectV1alpha1Interface } // Clientset contains the clients for groups. @@ -46,6 +48,7 @@ type Clientset struct { configurationV1alpha1 *configurationv1alpha1.ConfigurationV1alpha1Client configurationV1beta1 *configurationv1beta1.ConfigurationV1beta1Client incubatorV1alpha1 *incubatorv1alpha1.IncubatorV1alpha1Client + konnectV1alpha1 *konnectv1alpha1.KonnectV1alpha1Client } // ConfigurationV1 retrieves the ConfigurationV1Client @@ -68,6 +71,11 @@ func (c *Clientset) IncubatorV1alpha1() incubatorv1alpha1.IncubatorV1alpha1Inter return c.incubatorV1alpha1 } +// KonnectV1alpha1 retrieves the KonnectV1alpha1Client +func (c *Clientset) KonnectV1alpha1() konnectv1alpha1.KonnectV1alpha1Interface { + return c.konnectV1alpha1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -128,6 +136,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.konnectV1alpha1, err = konnectv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -153,6 +165,7 @@ func New(c rest.Interface) *Clientset { cs.configurationV1alpha1 = configurationv1alpha1.New(c) cs.configurationV1beta1 = configurationv1beta1.New(c) cs.incubatorV1alpha1 = incubatorv1alpha1.New(c) + cs.konnectV1alpha1 = konnectv1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/clientset/fake/clientset_generated.go b/pkg/clientset/fake/clientset_generated.go index cd7fe23..88c3ab7 100644 --- a/pkg/clientset/fake/clientset_generated.go +++ b/pkg/clientset/fake/clientset_generated.go @@ -28,6 +28,8 @@ import ( fakeconfigurationv1beta1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/configuration/v1beta1/fake" incubatorv1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/incubator/v1alpha1" fakeincubatorv1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/incubator/v1alpha1/fake" + konnectv1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/konnect/v1alpha1" + fakekonnectv1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/konnect/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -104,3 +106,8 @@ func (c *Clientset) ConfigurationV1beta1() configurationv1beta1.ConfigurationV1b func (c *Clientset) IncubatorV1alpha1() incubatorv1alpha1.IncubatorV1alpha1Interface { return &fakeincubatorv1alpha1.FakeIncubatorV1alpha1{Fake: &c.Fake} } + +// KonnectV1alpha1 retrieves the KonnectV1alpha1Client +func (c *Clientset) KonnectV1alpha1() konnectv1alpha1.KonnectV1alpha1Interface { + return &fakekonnectv1alpha1.FakeKonnectV1alpha1{Fake: &c.Fake} +} diff --git a/pkg/clientset/fake/register.go b/pkg/clientset/fake/register.go index f70ee4e..594ef7f 100644 --- a/pkg/clientset/fake/register.go +++ b/pkg/clientset/fake/register.go @@ -23,6 +23,7 @@ import ( configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" configurationv1beta1 "github.com/kong/kubernetes-configuration/api/configuration/v1beta1" incubatorv1alpha1 "github.com/kong/kubernetes-configuration/api/incubator/v1alpha1" + konnectv1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -38,6 +39,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ configurationv1alpha1.AddToScheme, configurationv1beta1.AddToScheme, incubatorv1alpha1.AddToScheme, + konnectv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/clientset/scheme/register.go b/pkg/clientset/scheme/register.go index 23e5d90..44e16ee 100644 --- a/pkg/clientset/scheme/register.go +++ b/pkg/clientset/scheme/register.go @@ -23,6 +23,7 @@ import ( configurationv1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" configurationv1beta1 "github.com/kong/kubernetes-configuration/api/configuration/v1beta1" incubatorv1alpha1 "github.com/kong/kubernetes-configuration/api/incubator/v1alpha1" + konnectv1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -38,6 +39,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ configurationv1alpha1.AddToScheme, configurationv1beta1.AddToScheme, incubatorv1alpha1.AddToScheme, + konnectv1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/clientset/typed/configuration/v1alpha1/configuration_client.go b/pkg/clientset/typed/configuration/v1alpha1/configuration_client.go index 7ef6e03..593985b 100644 --- a/pkg/clientset/typed/configuration/v1alpha1/configuration_client.go +++ b/pkg/clientset/typed/configuration/v1alpha1/configuration_client.go @@ -35,7 +35,6 @@ type ConfigurationV1alpha1Interface interface { KongRoutesGetter KongServicesGetter KongVaultsGetter - KonnectAPIAuthConfigurationsGetter } // ConfigurationV1alpha1Client is used to interact with features provided by the configuration.konghq.com group. @@ -71,10 +70,6 @@ func (c *ConfigurationV1alpha1Client) KongVaults() KongVaultInterface { return newKongVaults(c) } -func (c *ConfigurationV1alpha1Client) KonnectAPIAuthConfigurations(namespace string) KonnectAPIAuthConfigurationInterface { - return newKonnectAPIAuthConfigurations(c, namespace) -} - // NewForConfig creates a new ConfigurationV1alpha1Client 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/configuration/v1alpha1/fake/fake_configuration_client.go b/pkg/clientset/typed/configuration/v1alpha1/fake/fake_configuration_client.go index a6e5c12..a418265 100644 --- a/pkg/clientset/typed/configuration/v1alpha1/fake/fake_configuration_client.go +++ b/pkg/clientset/typed/configuration/v1alpha1/fake/fake_configuration_client.go @@ -56,10 +56,6 @@ func (c *FakeConfigurationV1alpha1) KongVaults() v1alpha1.KongVaultInterface { return &FakeKongVaults{c} } -func (c *FakeConfigurationV1alpha1) KonnectAPIAuthConfigurations(namespace string) v1alpha1.KonnectAPIAuthConfigurationInterface { - return &FakeKonnectAPIAuthConfigurations{c, namespace} -} - // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeConfigurationV1alpha1) RESTClient() rest.Interface { diff --git a/pkg/clientset/typed/configuration/v1alpha1/fake/fake_route.go b/pkg/clientset/typed/configuration/v1alpha1/fake/fake_route.go deleted file mode 100644 index c1a1e96..0000000 --- a/pkg/clientset/typed/configuration/v1alpha1/fake/fake_route.go +++ /dev/null @@ -1,141 +0,0 @@ -/* -Copyright 2021 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/kubernetes-configuration/api/configuration/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" -) - -// FakeRoutes implements RouteInterface -type FakeRoutes struct { - Fake *FakeConfigurationV1alpha1 - ns string -} - -var routesResource = v1alpha1.SchemeGroupVersion.WithResource("routes") - -var routesKind = v1alpha1.SchemeGroupVersion.WithKind("Route") - -// Get takes name of the route, and returns the corresponding route object, and an error if there is any. -func (c *FakeRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KongRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(routesResource, c.ns, name), &v1alpha1.KongRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongRoute), err -} - -// List takes label and field selectors, and returns the list of Routes that match those selectors. -func (c *FakeRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KongRouteList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(routesResource, routesKind, c.ns, opts), &v1alpha1.KongRouteList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.KongRouteList{ListMeta: obj.(*v1alpha1.KongRouteList).ListMeta} - for _, item := range obj.(*v1alpha1.KongRouteList).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 routes. -func (c *FakeRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(routesResource, c.ns, opts)) - -} - -// Create takes the representation of a route and creates it. Returns the server's representation of the route, and an error, if there is any. -func (c *FakeRoutes) Create(ctx context.Context, route *v1alpha1.KongRoute, opts v1.CreateOptions) (result *v1alpha1.KongRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(routesResource, c.ns, route), &v1alpha1.KongRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongRoute), err -} - -// Update takes the representation of a route and updates it. Returns the server's representation of the route, and an error, if there is any. -func (c *FakeRoutes) Update(ctx context.Context, route *v1alpha1.KongRoute, opts v1.UpdateOptions) (result *v1alpha1.KongRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(routesResource, c.ns, route), &v1alpha1.KongRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongRoute), 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 *FakeRoutes) UpdateStatus(ctx context.Context, route *v1alpha1.KongRoute, opts v1.UpdateOptions) (*v1alpha1.KongRoute, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(routesResource, "status", c.ns, route), &v1alpha1.KongRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongRoute), err -} - -// Delete takes name of the route and deletes it. Returns an error if one occurs. -func (c *FakeRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(routesResource, c.ns, name, opts), &v1alpha1.KongRoute{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(routesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.KongRouteList{}) - return err -} - -// Patch applies the patch and returns the patched route. -func (c *FakeRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KongRoute, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(routesResource, c.ns, name, pt, data, subresources...), &v1alpha1.KongRoute{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongRoute), err -} diff --git a/pkg/clientset/typed/configuration/v1alpha1/fake/fake_service.go b/pkg/clientset/typed/configuration/v1alpha1/fake/fake_service.go deleted file mode 100644 index cd4c061..0000000 --- a/pkg/clientset/typed/configuration/v1alpha1/fake/fake_service.go +++ /dev/null @@ -1,141 +0,0 @@ -/* -Copyright 2021 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/kubernetes-configuration/api/configuration/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" -) - -// FakeServices implements ServiceInterface -type FakeServices struct { - Fake *FakeConfigurationV1alpha1 - ns string -} - -var servicesResource = v1alpha1.SchemeGroupVersion.WithResource("services") - -var servicesKind = v1alpha1.SchemeGroupVersion.WithKind("Service") - -// Get takes name of the service, and returns the corresponding service object, and an error if there is any. -func (c *FakeServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KongService, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(servicesResource, c.ns, name), &v1alpha1.KongService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongService), err -} - -// List takes label and field selectors, and returns the list of Services that match those selectors. -func (c *FakeServices) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KongServiceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(servicesResource, servicesKind, c.ns, opts), &v1alpha1.KongServiceList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha1.KongServiceList{ListMeta: obj.(*v1alpha1.KongServiceList).ListMeta} - for _, item := range obj.(*v1alpha1.KongServiceList).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 services. -func (c *FakeServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(servicesResource, c.ns, opts)) - -} - -// Create takes the representation of a service and creates it. Returns the server's representation of the service, and an error, if there is any. -func (c *FakeServices) Create(ctx context.Context, service *v1alpha1.KongService, opts v1.CreateOptions) (result *v1alpha1.KongService, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(servicesResource, c.ns, service), &v1alpha1.KongService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongService), err -} - -// Update takes the representation of a service and updates it. Returns the server's representation of the service, and an error, if there is any. -func (c *FakeServices) Update(ctx context.Context, service *v1alpha1.KongService, opts v1.UpdateOptions) (result *v1alpha1.KongService, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(servicesResource, c.ns, service), &v1alpha1.KongService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongService), 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 *FakeServices) UpdateStatus(ctx context.Context, service *v1alpha1.KongService, opts v1.UpdateOptions) (*v1alpha1.KongService, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(servicesResource, "status", c.ns, service), &v1alpha1.KongService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongService), err -} - -// Delete takes name of the service and deletes it. Returns an error if one occurs. -func (c *FakeServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(servicesResource, c.ns, name, opts), &v1alpha1.KongService{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(servicesResource, c.ns, listOpts) - - _, err := c.Fake.Invokes(action, &v1alpha1.KongServiceList{}) - return err -} - -// Patch applies the patch and returns the patched service. -func (c *FakeServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KongService, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(servicesResource, c.ns, name, pt, data, subresources...), &v1alpha1.KongService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha1.KongService), err -} diff --git a/pkg/clientset/typed/configuration/v1alpha1/generated_expansion.go b/pkg/clientset/typed/configuration/v1alpha1/generated_expansion.go index f8ae02e..5c589a0 100644 --- a/pkg/clientset/typed/configuration/v1alpha1/generated_expansion.go +++ b/pkg/clientset/typed/configuration/v1alpha1/generated_expansion.go @@ -31,5 +31,3 @@ type KongRouteExpansion interface{} type KongServiceExpansion interface{} type KongVaultExpansion interface{} - -type KonnectAPIAuthConfigurationExpansion interface{} diff --git a/pkg/clientset/typed/konnect/v1alpha1/doc.go b/pkg/clientset/typed/konnect/v1alpha1/doc.go new file mode 100644 index 0000000..eb49441 --- /dev/null +++ b/pkg/clientset/typed/konnect/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 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. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/clientset/typed/konnect/v1alpha1/fake/doc.go b/pkg/clientset/typed/konnect/v1alpha1/fake/doc.go new file mode 100644 index 0000000..4bdd022 --- /dev/null +++ b/pkg/clientset/typed/konnect/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 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 has the automatically generated clients. +package fake diff --git a/pkg/clientset/typed/konnect/v1alpha1/fake/fake_konnect_client.go b/pkg/clientset/typed/konnect/v1alpha1/fake/fake_konnect_client.go new file mode 100644 index 0000000..d5d4e06 --- /dev/null +++ b/pkg/clientset/typed/konnect/v1alpha1/fake/fake_konnect_client.go @@ -0,0 +1,40 @@ +/* +Copyright 2021 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 ( + v1alpha1 "github.com/kong/kubernetes-configuration/pkg/clientset/typed/konnect/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeKonnectV1alpha1 struct { + *testing.Fake +} + +func (c *FakeKonnectV1alpha1) KonnectAPIAuthConfigurations(namespace string) v1alpha1.KonnectAPIAuthConfigurationInterface { + return &FakeKonnectAPIAuthConfigurations{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeKonnectV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clientset/typed/configuration/v1alpha1/fake/fake_konnectapiauthconfiguration.go b/pkg/clientset/typed/konnect/v1alpha1/fake/fake_konnectapiauthconfiguration.go similarity index 98% rename from pkg/clientset/typed/configuration/v1alpha1/fake/fake_konnectapiauthconfiguration.go rename to pkg/clientset/typed/konnect/v1alpha1/fake/fake_konnectapiauthconfiguration.go index 9f1a8fa..c483493 100644 --- a/pkg/clientset/typed/configuration/v1alpha1/fake/fake_konnectapiauthconfiguration.go +++ b/pkg/clientset/typed/konnect/v1alpha1/fake/fake_konnectapiauthconfiguration.go @@ -21,7 +21,7 @@ package fake import ( "context" - v1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" + v1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" @@ -31,7 +31,7 @@ import ( // FakeKonnectAPIAuthConfigurations implements KonnectAPIAuthConfigurationInterface type FakeKonnectAPIAuthConfigurations struct { - Fake *FakeConfigurationV1alpha1 + Fake *FakeKonnectV1alpha1 ns string } diff --git a/pkg/clientset/typed/konnect/v1alpha1/generated_expansion.go b/pkg/clientset/typed/konnect/v1alpha1/generated_expansion.go new file mode 100644 index 0000000..c913ce4 --- /dev/null +++ b/pkg/clientset/typed/konnect/v1alpha1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright 2021 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 + +type KonnectAPIAuthConfigurationExpansion interface{} diff --git a/pkg/clientset/typed/konnect/v1alpha1/konnect_client.go b/pkg/clientset/typed/konnect/v1alpha1/konnect_client.go new file mode 100644 index 0000000..d825a0f --- /dev/null +++ b/pkg/clientset/typed/konnect/v1alpha1/konnect_client.go @@ -0,0 +1,107 @@ +/* +Copyright 2021 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 ( + "net/http" + + v1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" + "github.com/kong/kubernetes-configuration/pkg/clientset/scheme" + rest "k8s.io/client-go/rest" +) + +type KonnectV1alpha1Interface interface { + RESTClient() rest.Interface + KonnectAPIAuthConfigurationsGetter +} + +// KonnectV1alpha1Client is used to interact with features provided by the konnect.konghq.com group. +type KonnectV1alpha1Client struct { + restClient rest.Interface +} + +func (c *KonnectV1alpha1Client) KonnectAPIAuthConfigurations(namespace string) KonnectAPIAuthConfigurationInterface { + return newKonnectAPIAuthConfigurations(c, namespace) +} + +// NewForConfig creates a new KonnectV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*KonnectV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new KonnectV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KonnectV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &KonnectV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new KonnectV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *KonnectV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new KonnectV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *KonnectV1alpha1Client { + return &KonnectV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *KonnectV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clientset/typed/configuration/v1alpha1/konnectapiauthconfiguration.go b/pkg/clientset/typed/konnect/v1alpha1/konnectapiauthconfiguration.go similarity index 97% rename from pkg/clientset/typed/configuration/v1alpha1/konnectapiauthconfiguration.go rename to pkg/clientset/typed/konnect/v1alpha1/konnectapiauthconfiguration.go index 9878c68..9036814 100644 --- a/pkg/clientset/typed/configuration/v1alpha1/konnectapiauthconfiguration.go +++ b/pkg/clientset/typed/konnect/v1alpha1/konnectapiauthconfiguration.go @@ -22,7 +22,7 @@ import ( "context" "time" - v1alpha1 "github.com/kong/kubernetes-configuration/api/configuration/v1alpha1" + v1alpha1 "github.com/kong/kubernetes-configuration/api/konnect/v1alpha1" scheme "github.com/kong/kubernetes-configuration/pkg/clientset/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -57,7 +57,7 @@ type konnectAPIAuthConfigurations struct { } // newKonnectAPIAuthConfigurations returns a KonnectAPIAuthConfigurations -func newKonnectAPIAuthConfigurations(c *ConfigurationV1alpha1Client, namespace string) *konnectAPIAuthConfigurations { +func newKonnectAPIAuthConfigurations(c *KonnectV1alpha1Client, namespace string) *konnectAPIAuthConfigurations { return &konnectAPIAuthConfigurations{ client: c.RESTClient(), ns: namespace,