From ef6357629098d5af89ace2cf97e17e5572a327c4 Mon Sep 17 00:00:00 2001 From: Patryk Orwat Date: Sun, 15 Sep 2024 17:01:29 +0200 Subject: [PATCH] renamed module location to github.com, working on plan resource --- artifacts/deployment/rbac.yaml | 3 + docs/local-development.md | 1 + go.mod | 2 +- hack/build-image.sh | 4 +- hack/update-codegen.sh | 2 +- main.go | 2 +- .../hykubeinitializer/hykubeinitializer.go | 2 +- .../hykubeinitializer_test.go | 6 +- pkg/admission/hykubeinitializer/interfaces.go | 2 +- pkg/apis/hykube/doc.go | 2 +- pkg/apis/hykube/fuzzer/fuzzer.go | 2 +- pkg/apis/hykube/install/install.go | 4 +- pkg/apis/hykube/install/roundtrip_test.go | 2 +- pkg/apis/hykube/register.go | 3 + pkg/apis/hykube/types.go | 26 ++ pkg/apis/hykube/v1alpha1/conversion.go | 2 +- pkg/apis/hykube/v1alpha1/defaults.go | 5 + pkg/apis/hykube/v1alpha1/doc.go | 4 +- pkg/apis/hykube/v1alpha1/register.go | 3 + pkg/apis/hykube/v1alpha1/types.go | 31 +++ .../v1alpha1/zz_generated.conversion.go | 100 +++++++- .../hykube/v1alpha1/zz_generated.deepcopy.go | 92 +++++++ .../hykube/v1alpha1/zz_generated.defaults.go | 13 + pkg/apis/hykube/validation/validation.go | 9 +- pkg/apis/hykube/zz_generated.deepcopy.go | 76 ++++++ pkg/apiserver/apiserver.go | 10 +- pkg/apiserver/scheme_test.go | 2 +- pkg/cmd/server/db.go | 2 +- pkg/cmd/server/start.go | 12 +- pkg/generated/applyconfiguration/utils.go | 8 +- .../clientset/versioned/clientset.go | 2 +- .../versioned/fake/clientset_generated.go | 8 +- .../clientset/versioned/fake/register.go | 2 +- .../clientset/versioned/scheme/register.go | 2 +- .../v1alpha1/fake/fake_hykube_client.go | 6 +- .../hykube/v1alpha1/fake/fake_provider.go | 4 +- .../hykube/v1alpha1/generated_expansion.go | 2 + .../typed/hykube/v1alpha1/hykube_client.go | 9 +- .../typed/hykube/v1alpha1/provider.go | 6 +- .../informers/externalversions/factory.go | 6 +- .../informers/externalversions/generic.go | 4 +- .../externalversions/hykube/interface.go | 4 +- .../hykube/v1alpha1/interface.go | 9 +- .../hykube/v1alpha1/provider.go | 8 +- .../internalinterfaces/factory_interfaces.go | 2 +- .../hykube/v1alpha1/expansion_generated.go | 8 + .../listers/hykube/v1alpha1/provider.go | 2 +- pkg/generated/openapi/zz_generated.openapi.go | 241 +++++++++++++----- pkg/registry/hykube/plan/etcd.go | 58 +++++ pkg/registry/hykube/plan/hashicorp.go | 79 ++++++ pkg/registry/hykube/plan/strategy.go | 103 ++++++++ pkg/registry/hykube/plan/watch.go | 47 ++++ pkg/registry/hykube/provider/etcd.go | 4 +- pkg/registry/hykube/provider/hashicorp.go | 8 +- pkg/registry/hykube/provider/strategy.go | 4 +- pkg/registry/hykube/provider/watch.go | 2 +- 56 files changed, 929 insertions(+), 133 deletions(-) create mode 100644 pkg/registry/hykube/plan/etcd.go create mode 100644 pkg/registry/hykube/plan/hashicorp.go create mode 100644 pkg/registry/hykube/plan/strategy.go create mode 100644 pkg/registry/hykube/plan/watch.go diff --git a/artifacts/deployment/rbac.yaml b/artifacts/deployment/rbac.yaml index 6b87c28..f704e4c 100644 --- a/artifacts/deployment/rbac.yaml +++ b/artifacts/deployment/rbac.yaml @@ -15,3 +15,6 @@ rules: - apiGroups: ["apiextensions.k8s.io"] resources: ['customresourcedefinitions'] verbs: ['list', 'watch', 'create', 'update', 'delete'] +- apiGroups: ["*.hykube.io"] + resources: ['*'] + verbs: ['list'] diff --git a/docs/local-development.md b/docs/local-development.md index fbdb410..5484857 100644 --- a/docs/local-development.md +++ b/docs/local-development.md @@ -104,6 +104,7 @@ Once the provider is ready, you can add a test AWS S3 bucket: ```shell kubectl create -f artifacts/aws-test/s3-bucket.yaml +kubectl delete -f artifacts/aws-test/s3-bucket.yaml # aws-s3-bucket.aws.hykube.io/test-bucket created ``` diff --git a/go.mod b/go.mod index 40e56ca..a68fbd1 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module hykube.io/apiserver +module github.com/infrapot/hykube go 1.22.0 diff --git a/hack/build-image.sh b/hack/build-image.sh index 6932505..abe78c8 100755 --- a/hack/build-image.sh +++ b/hack/build-image.sh @@ -23,11 +23,11 @@ source "${KUBE_ROOT}/hack/lib/util.sh" # Register function to be called on EXIT to remove generated binary. function cleanup { - rm "${KUBE_ROOT}/staging/src/hykube.io/apiserver/artifacts/simple-image/kube-sample-apiserver" + rm "${KUBE_ROOT}/staging/src/github.com/infrapot/hykube/artifacts/simple-image/kube-sample-apiserver" } trap cleanup EXIT -pushd "${KUBE_ROOT}/staging/src/hykube.io/apiserver" +pushd "${KUBE_ROOT}/staging/src/github.com/infrapot/hykube" cp -v ../../../../_output/local/bin/linux/amd64/sample-apiserver ./artifacts/simple-image/kube-sample-apiserver docker build -t kube-sample-apiserver:latest ./artifacts/simple-image popd diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 23138ba..83a9d80 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -23,7 +23,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code- source "${CODEGEN_PKG}/kube_codegen.sh" -THIS_PKG="hykube.io/apiserver" +THIS_PKG="github.com/infrapot/hykube" API_KNOWN_VIOLATIONS_DIR="${SCRIPT_ROOT}/hack" kube::codegen::gen_helpers \ diff --git a/main.go b/main.go index 40531db..e1656d3 100644 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ package main import ( "os" - "hykube.io/apiserver/pkg/cmd/server" + "github.com/infrapot/hykube/pkg/cmd/server" genericapiserver "k8s.io/apiserver/pkg/server" "k8s.io/component-base/cli" ) diff --git a/pkg/admission/hykubeinitializer/hykubeinitializer.go b/pkg/admission/hykubeinitializer/hykubeinitializer.go index bc5098b..b7e9381 100644 --- a/pkg/admission/hykubeinitializer/hykubeinitializer.go +++ b/pkg/admission/hykubeinitializer/hykubeinitializer.go @@ -17,7 +17,7 @@ limitations under the License. package hykubeinitializer import ( - informers "hykube.io/apiserver/pkg/generated/informers/externalversions" + informers "github.com/infrapot/hykube/pkg/generated/informers/externalversions" "k8s.io/apiserver/pkg/admission" ) diff --git a/pkg/admission/hykubeinitializer/hykubeinitializer_test.go b/pkg/admission/hykubeinitializer/hykubeinitializer_test.go index 6256add..9ac0c4f 100644 --- a/pkg/admission/hykubeinitializer/hykubeinitializer_test.go +++ b/pkg/admission/hykubeinitializer/hykubeinitializer_test.go @@ -21,9 +21,9 @@ import ( "testing" "time" - "hykube.io/apiserver/pkg/admission/hykubeinitializer" - "hykube.io/apiserver/pkg/generated/clientset/versioned/fake" - informers "hykube.io/apiserver/pkg/generated/informers/externalversions" + "github.com/infrapot/hykube/pkg/admission/hykubeinitializer" + "github.com/infrapot/hykube/pkg/generated/clientset/versioned/fake" + informers "github.com/infrapot/hykube/pkg/generated/informers/externalversions" "k8s.io/apiserver/pkg/admission" ) diff --git a/pkg/admission/hykubeinitializer/interfaces.go b/pkg/admission/hykubeinitializer/interfaces.go index c042dc0..3322bef 100644 --- a/pkg/admission/hykubeinitializer/interfaces.go +++ b/pkg/admission/hykubeinitializer/interfaces.go @@ -17,7 +17,7 @@ limitations under the License. package hykubeinitializer import ( - informers "hykube.io/apiserver/pkg/generated/informers/externalversions" + informers "github.com/infrapot/hykube/pkg/generated/informers/externalversions" "k8s.io/apiserver/pkg/admission" ) diff --git a/pkg/apis/hykube/doc.go b/pkg/apis/hykube/doc.go index dfcca93..d70b038 100644 --- a/pkg/apis/hykube/doc.go +++ b/pkg/apis/hykube/doc.go @@ -12,4 +12,4 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html // +groupName=hykube.io // Package hykube is the internal version of the API. -package hykube // import "hykube.io/apiserver/pkg/apis/hykube" +package hykube // import "github.com/infrapot/hykube/pkg/apis/hykube" diff --git a/pkg/apis/hykube/fuzzer/fuzzer.go b/pkg/apis/hykube/fuzzer/fuzzer.go index 3d5656d..622305a 100644 --- a/pkg/apis/hykube/fuzzer/fuzzer.go +++ b/pkg/apis/hykube/fuzzer/fuzzer.go @@ -12,7 +12,7 @@ package fuzzer import ( fuzz "github.com/google/gofuzz" - "hykube.io/apiserver/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube" runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer" ) diff --git a/pkg/apis/hykube/install/install.go b/pkg/apis/hykube/install/install.go index 983c1d0..6f40f87 100644 --- a/pkg/apis/hykube/install/install.go +++ b/pkg/apis/hykube/install/install.go @@ -11,8 +11,8 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package install import ( - "hykube.io/apiserver/pkg/apis/hykube" - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" + "github.com/infrapot/hykube/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" ) diff --git a/pkg/apis/hykube/install/roundtrip_test.go b/pkg/apis/hykube/install/roundtrip_test.go index a8c353d..d141bff 100644 --- a/pkg/apis/hykube/install/roundtrip_test.go +++ b/pkg/apis/hykube/install/roundtrip_test.go @@ -13,7 +13,7 @@ package install import ( "testing" - hykubefuzzer "hykube.io/apiserver/pkg/apis/hykube/fuzzer" + hykubefuzzer "github.com/infrapot/hykube/pkg/apis/hykube/fuzzer" "k8s.io/apimachinery/pkg/api/apitesting/roundtrip" ) diff --git a/pkg/apis/hykube/register.go b/pkg/apis/hykube/register.go index 0ac444c..c28cbff 100644 --- a/pkg/apis/hykube/register.go +++ b/pkg/apis/hykube/register.go @@ -43,6 +43,9 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Provider{}, &ProviderList{}, + + &Plan{}, + &PlanList{}, ) return nil } diff --git a/pkg/apis/hykube/types.go b/pkg/apis/hykube/types.go index edeee9b..9162939 100644 --- a/pkg/apis/hykube/types.go +++ b/pkg/apis/hykube/types.go @@ -40,3 +40,29 @@ type Provider struct { Status string Filename string } + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PlanList is a list of Plan objects. +type PlanList struct { + metav1.TypeMeta + metav1.ListMeta + + Items []Plan +} + +// PlanSpec is the specification of a Provider. +type PlanSpec struct { + // TODO provider specific configuration +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type Plan struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec PlanSpec + Status string +} diff --git a/pkg/apis/hykube/v1alpha1/conversion.go b/pkg/apis/hykube/v1alpha1/conversion.go index 1b6b0d2..0d7898b 100644 --- a/pkg/apis/hykube/v1alpha1/conversion.go +++ b/pkg/apis/hykube/v1alpha1/conversion.go @@ -11,7 +11,7 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package v1alpha1 import ( - "hykube.io/apiserver/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube" "k8s.io/apimachinery/pkg/conversion" ) diff --git a/pkg/apis/hykube/v1alpha1/defaults.go b/pkg/apis/hykube/v1alpha1/defaults.go index b29513b..bdb8a1d 100644 --- a/pkg/apis/hykube/v1alpha1/defaults.go +++ b/pkg/apis/hykube/v1alpha1/defaults.go @@ -22,3 +22,8 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error { func SetDefaults_ProviderSpec(obj *ProviderSpec) { } + +// SetDefaults_PlanSpec sets defaults for Plan spec +func SetDefaults_PlanSpec(p *PlanSpec) { + +} diff --git a/pkg/apis/hykube/v1alpha1/doc.go b/pkg/apis/hykube/v1alpha1/doc.go index 3358385..34fad18 100644 --- a/pkg/apis/hykube/v1alpha1/doc.go +++ b/pkg/apis/hykube/v1alpha1/doc.go @@ -10,10 +10,10 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html // +k8s:openapi-gen=true // +k8s:deepcopy-gen=package -// +k8s:conversion-gen=hykube.io/apiserver/pkg/apis/hykube +// +k8s:conversion-gen=github.com/infrapot/hykube/pkg/apis/hykube // +k8s:defaulter-gen=TypeMeta // +k8s:prerelease-lifecycle-gen=true // +groupName=hykube.io // Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 // import "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" +package v1alpha1 // import "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" diff --git a/pkg/apis/hykube/v1alpha1/register.go b/pkg/apis/hykube/v1alpha1/register.go index 4215c43..90b7335 100644 --- a/pkg/apis/hykube/v1alpha1/register.go +++ b/pkg/apis/hykube/v1alpha1/register.go @@ -50,6 +50,9 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &Provider{}, &ProviderList{}, + + &Plan{}, + &PlanList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/hykube/v1alpha1/types.go b/pkg/apis/hykube/v1alpha1/types.go index d701e65..6b0464f 100644 --- a/pkg/apis/hykube/v1alpha1/types.go +++ b/pkg/apis/hykube/v1alpha1/types.go @@ -46,3 +46,34 @@ type Provider struct { Status string `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` Filename string `json:"filename,omitempty" protobuf:"bytes,4,opt,name=filename"` } + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.0 +// +k8s:prerelease-lifecycle-gen:removed=1.10 + +// PlanList is a list of Plan objects. +type PlanList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Items []Plan `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +type PlanSpec struct { +} + +type PlanStatus struct { +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.0 +// +k8s:prerelease-lifecycle-gen:removed=1.10 + +type Plan struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + Spec PlanSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + Status string `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} diff --git a/pkg/apis/hykube/v1alpha1/zz_generated.conversion.go b/pkg/apis/hykube/v1alpha1/zz_generated.conversion.go index df36c18..a81168d 100644 --- a/pkg/apis/hykube/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/hykube/v1alpha1/zz_generated.conversion.go @@ -17,7 +17,7 @@ package v1alpha1 import ( unsafe "unsafe" - hykube "hykube.io/apiserver/pkg/apis/hykube" + hykube "github.com/infrapot/hykube/pkg/apis/hykube" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -29,6 +29,36 @@ func init() { // RegisterConversions adds conversion functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*Plan)(nil), (*hykube.Plan)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Plan_To_hykube_Plan(a.(*Plan), b.(*hykube.Plan), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*hykube.Plan)(nil), (*Plan)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_hykube_Plan_To_v1alpha1_Plan(a.(*hykube.Plan), b.(*Plan), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PlanList)(nil), (*hykube.PlanList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PlanList_To_hykube_PlanList(a.(*PlanList), b.(*hykube.PlanList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*hykube.PlanList)(nil), (*PlanList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_hykube_PlanList_To_v1alpha1_PlanList(a.(*hykube.PlanList), b.(*PlanList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*PlanSpec)(nil), (*hykube.PlanSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PlanSpec_To_hykube_PlanSpec(a.(*PlanSpec), b.(*hykube.PlanSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*hykube.PlanSpec)(nil), (*PlanSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_hykube_PlanSpec_To_v1alpha1_PlanSpec(a.(*hykube.PlanSpec), b.(*PlanSpec), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*Provider)(nil), (*hykube.Provider)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_Provider_To_hykube_Provider(a.(*Provider), b.(*hykube.Provider), scope) }); err != nil { @@ -62,6 +92,74 @@ func RegisterConversions(s *runtime.Scheme) error { return nil } +func autoConvert_v1alpha1_Plan_To_hykube_Plan(in *Plan, out *hykube.Plan, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_PlanSpec_To_hykube_PlanSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + out.Status = in.Status + return nil +} + +// Convert_v1alpha1_Plan_To_hykube_Plan is an autogenerated conversion function. +func Convert_v1alpha1_Plan_To_hykube_Plan(in *Plan, out *hykube.Plan, s conversion.Scope) error { + return autoConvert_v1alpha1_Plan_To_hykube_Plan(in, out, s) +} + +func autoConvert_hykube_Plan_To_v1alpha1_Plan(in *hykube.Plan, out *Plan, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_hykube_PlanSpec_To_v1alpha1_PlanSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + out.Status = in.Status + return nil +} + +// Convert_hykube_Plan_To_v1alpha1_Plan is an autogenerated conversion function. +func Convert_hykube_Plan_To_v1alpha1_Plan(in *hykube.Plan, out *Plan, s conversion.Scope) error { + return autoConvert_hykube_Plan_To_v1alpha1_Plan(in, out, s) +} + +func autoConvert_v1alpha1_PlanList_To_hykube_PlanList(in *PlanList, out *hykube.PlanList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]hykube.Plan)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_PlanList_To_hykube_PlanList is an autogenerated conversion function. +func Convert_v1alpha1_PlanList_To_hykube_PlanList(in *PlanList, out *hykube.PlanList, s conversion.Scope) error { + return autoConvert_v1alpha1_PlanList_To_hykube_PlanList(in, out, s) +} + +func autoConvert_hykube_PlanList_To_v1alpha1_PlanList(in *hykube.PlanList, out *PlanList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Plan)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_hykube_PlanList_To_v1alpha1_PlanList is an autogenerated conversion function. +func Convert_hykube_PlanList_To_v1alpha1_PlanList(in *hykube.PlanList, out *PlanList, s conversion.Scope) error { + return autoConvert_hykube_PlanList_To_v1alpha1_PlanList(in, out, s) +} + +func autoConvert_v1alpha1_PlanSpec_To_hykube_PlanSpec(in *PlanSpec, out *hykube.PlanSpec, s conversion.Scope) error { + return nil +} + +// Convert_v1alpha1_PlanSpec_To_hykube_PlanSpec is an autogenerated conversion function. +func Convert_v1alpha1_PlanSpec_To_hykube_PlanSpec(in *PlanSpec, out *hykube.PlanSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_PlanSpec_To_hykube_PlanSpec(in, out, s) +} + +func autoConvert_hykube_PlanSpec_To_v1alpha1_PlanSpec(in *hykube.PlanSpec, out *PlanSpec, s conversion.Scope) error { + return nil +} + +// Convert_hykube_PlanSpec_To_v1alpha1_PlanSpec is an autogenerated conversion function. +func Convert_hykube_PlanSpec_To_v1alpha1_PlanSpec(in *hykube.PlanSpec, out *PlanSpec, s conversion.Scope) error { + return autoConvert_hykube_PlanSpec_To_v1alpha1_PlanSpec(in, out, s) +} + func autoConvert_v1alpha1_Provider_To_hykube_Provider(in *Provider, out *hykube.Provider, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha1_ProviderSpec_To_hykube_ProviderSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/pkg/apis/hykube/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/hykube/v1alpha1/zz_generated.deepcopy.go index 554fefe..9809f87 100644 --- a/pkg/apis/hykube/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/hykube/v1alpha1/zz_generated.deepcopy.go @@ -18,6 +18,98 @@ import ( 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 *Plan) DeepCopyInto(out *Plan) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Plan. +func (in *Plan) DeepCopy() *Plan { + if in == nil { + return nil + } + out := new(Plan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Plan) 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 *PlanList) DeepCopyInto(out *PlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Plan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlanList. +func (in *PlanList) DeepCopy() *PlanList { + if in == nil { + return nil + } + out := new(PlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PlanList) 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 *PlanSpec) DeepCopyInto(out *PlanSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlanSpec. +func (in *PlanSpec) DeepCopy() *PlanSpec { + if in == nil { + return nil + } + out := new(PlanSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlanStatus) DeepCopyInto(out *PlanStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlanStatus. +func (in *PlanStatus) DeepCopy() *PlanStatus { + if in == nil { + return nil + } + out := new(PlanStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Provider) DeepCopyInto(out *Provider) { *out = *in diff --git a/pkg/apis/hykube/v1alpha1/zz_generated.defaults.go b/pkg/apis/hykube/v1alpha1/zz_generated.defaults.go index 81cd228..9155a65 100644 --- a/pkg/apis/hykube/v1alpha1/zz_generated.defaults.go +++ b/pkg/apis/hykube/v1alpha1/zz_generated.defaults.go @@ -22,11 +22,24 @@ import ( // Public to allow building arbitrary schemes. // All generated defaulters are covering - they call all nested defaulters. func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&Plan{}, func(obj interface{}) { SetObjectDefaults_Plan(obj.(*Plan)) }) + scheme.AddTypeDefaultingFunc(&PlanList{}, func(obj interface{}) { SetObjectDefaults_PlanList(obj.(*PlanList)) }) scheme.AddTypeDefaultingFunc(&Provider{}, func(obj interface{}) { SetObjectDefaults_Provider(obj.(*Provider)) }) scheme.AddTypeDefaultingFunc(&ProviderList{}, func(obj interface{}) { SetObjectDefaults_ProviderList(obj.(*ProviderList)) }) return nil } +func SetObjectDefaults_Plan(in *Plan) { + SetDefaults_PlanSpec(&in.Spec) +} + +func SetObjectDefaults_PlanList(in *PlanList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_Plan(a) + } +} + func SetObjectDefaults_Provider(in *Provider) { SetDefaults_ProviderSpec(&in.Spec) } diff --git a/pkg/apis/hykube/validation/validation.go b/pkg/apis/hykube/validation/validation.go index c198985..e2a6922 100644 --- a/pkg/apis/hykube/validation/validation.go +++ b/pkg/apis/hykube/validation/validation.go @@ -17,7 +17,7 @@ limitations under the License. package validation import ( - "hykube.io/apiserver/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube" "k8s.io/apimachinery/pkg/util/validation/field" ) @@ -40,3 +40,10 @@ func ValidateProviderSpec(s *hykube.ProviderSpec, fldPath *field.Path) field.Err return allErrs } + +// ValidatePlan validates a Plan. +func ValidatePlan(f *hykube.Plan) field.ErrorList { + allErrs := field.ErrorList{} + + return allErrs +} diff --git a/pkg/apis/hykube/zz_generated.deepcopy.go b/pkg/apis/hykube/zz_generated.deepcopy.go index c4f7dff..9cea7b5 100644 --- a/pkg/apis/hykube/zz_generated.deepcopy.go +++ b/pkg/apis/hykube/zz_generated.deepcopy.go @@ -18,6 +18,82 @@ import ( 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 *Plan) DeepCopyInto(out *Plan) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Plan. +func (in *Plan) DeepCopy() *Plan { + if in == nil { + return nil + } + out := new(Plan) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Plan) 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 *PlanList) DeepCopyInto(out *PlanList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Plan, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlanList. +func (in *PlanList) DeepCopy() *PlanList { + if in == nil { + return nil + } + out := new(PlanList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PlanList) 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 *PlanSpec) DeepCopyInto(out *PlanSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlanSpec. +func (in *PlanSpec) DeepCopy() *PlanSpec { + if in == nil { + return nil + } + out := new(PlanSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Provider) DeepCopyInto(out *Provider) { *out = *in diff --git a/pkg/apiserver/apiserver.go b/pkg/apiserver/apiserver.go index 55c1392..1d667b6 100644 --- a/pkg/apiserver/apiserver.go +++ b/pkg/apiserver/apiserver.go @@ -17,7 +17,7 @@ limitations under the License. package apiserver import ( - "hykube.io/apiserver/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -25,9 +25,10 @@ import ( "k8s.io/apiserver/pkg/registry/rest" genericapiserver "k8s.io/apiserver/pkg/server" - "hykube.io/apiserver/pkg/apis/hykube/install" - hykuberegistry "hykube.io/apiserver/pkg/registry" - providerstorage "hykube.io/apiserver/pkg/registry/hykube/provider" + "github.com/infrapot/hykube/pkg/apis/hykube/install" + hykuberegistry "github.com/infrapot/hykube/pkg/registry" + planstorage "github.com/infrapot/hykube/pkg/registry/hykube/plan" + providerstorage "github.com/infrapot/hykube/pkg/registry/hykube/provider" ) var ( @@ -108,6 +109,7 @@ func (c completedConfig) New() (*HykubeServer, error) { v1alpha1storage := map[string]rest.Storage{} v1alpha1storage["providers"] = hykuberegistry.RESTInPeace(providerstorage.NewREST(Scheme, c.GenericConfig.RESTOptionsGetter)) + v1alpha1storage["plans"] = hykuberegistry.RESTInPeace(planstorage.NewREST(Scheme, c.GenericConfig.RESTOptionsGetter)) apiGroupInfo.VersionedResourcesStorageMap["v1alpha1"] = v1alpha1storage if err := s.GenericAPIServer.InstallAPIGroup(&apiGroupInfo); err != nil { diff --git a/pkg/apiserver/scheme_test.go b/pkg/apiserver/scheme_test.go index 92ac825..275041d 100644 --- a/pkg/apiserver/scheme_test.go +++ b/pkg/apiserver/scheme_test.go @@ -19,7 +19,7 @@ package apiserver import ( "testing" - hykubefuzzer "hykube.io/apiserver/pkg/apis/hykube/fuzzer" + hykubefuzzer "github.com/infrapot/hykube/pkg/apis/hykube/fuzzer" "k8s.io/apimachinery/pkg/api/apitesting/roundtrip" ) diff --git a/pkg/cmd/server/db.go b/pkg/cmd/server/db.go index 8ccaba5..ce42088 100644 --- a/pkg/cmd/server/db.go +++ b/pkg/cmd/server/db.go @@ -12,8 +12,8 @@ package server import ( "context" + "github.com/infrapot/hykube/pkg/apiserver" "github.com/k3s-io/kine/pkg/endpoint" - "hykube.io/apiserver/pkg/apiserver" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" diff --git a/pkg/cmd/server/start.go b/pkg/cmd/server/start.go index 935352e..8238efe 100644 --- a/pkg/cmd/server/start.go +++ b/pkg/cmd/server/start.go @@ -26,12 +26,12 @@ import ( "k8s.io/component-base/featuregate" "net" - "hykube.io/apiserver/pkg/admission/hykubeinitializer" - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" - "hykube.io/apiserver/pkg/apiserver" - clientset "hykube.io/apiserver/pkg/generated/clientset/versioned" - informers "hykube.io/apiserver/pkg/generated/informers/externalversions" - sampleopenapi "hykube.io/apiserver/pkg/generated/openapi" + "github.com/infrapot/hykube/pkg/admission/hykubeinitializer" + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + "github.com/infrapot/hykube/pkg/apiserver" + clientset "github.com/infrapot/hykube/pkg/generated/clientset/versioned" + informers "github.com/infrapot/hykube/pkg/generated/informers/externalversions" + sampleopenapi "github.com/infrapot/hykube/pkg/generated/openapi" utilerrors "k8s.io/apimachinery/pkg/util/errors" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/version" diff --git a/pkg/generated/applyconfiguration/utils.go b/pkg/generated/applyconfiguration/utils.go index d14e719..38525de 100644 --- a/pkg/generated/applyconfiguration/utils.go +++ b/pkg/generated/applyconfiguration/utils.go @@ -12,9 +12,9 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package applyconfiguration import ( - v1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" - hykubev1alpha1 "hykube.io/apiserver/pkg/generated/applyconfiguration/hykube/v1alpha1" - internal "hykube.io/apiserver/pkg/generated/applyconfiguration/internal" + v1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/generated/applyconfiguration/hykube/v1alpha1" + internal "github.com/infrapot/hykube/pkg/generated/applyconfiguration/internal" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" testing "k8s.io/client-go/testing" @@ -25,6 +25,8 @@ import ( func ForKind(kind schema.GroupVersionKind) interface{} { switch kind { // Group=hykube.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithKind("Plan"): + return &hykubev1alpha1.PlanApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("Provider"): return &hykubev1alpha1.ProviderApplyConfiguration{} case v1alpha1.SchemeGroupVersion.WithKind("ProviderSpec"): diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index cbb7058..f7d0e55 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -15,7 +15,7 @@ import ( "fmt" "net/http" - hykubev1alpha1 "hykube.io/apiserver/pkg/generated/clientset/versioned/typed/hykube/v1alpha1" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/generated/clientset/versioned/typed/hykube/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 963269f..35f34a4 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -12,10 +12,10 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package fake import ( - applyconfiguration "hykube.io/apiserver/pkg/generated/applyconfiguration" - clientset "hykube.io/apiserver/pkg/generated/clientset/versioned" - hykubev1alpha1 "hykube.io/apiserver/pkg/generated/clientset/versioned/typed/hykube/v1alpha1" - fakehykubev1alpha1 "hykube.io/apiserver/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake" + applyconfiguration "github.com/infrapot/hykube/pkg/generated/applyconfiguration" + clientset "github.com/infrapot/hykube/pkg/generated/clientset/versioned" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/generated/clientset/versioned/typed/hykube/v1alpha1" + fakehykubev1alpha1 "github.com/infrapot/hykube/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index bbca247..3720fa7 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -12,7 +12,7 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package fake import ( - hykubev1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index ba0a739..84f924e 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -12,7 +12,7 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package scheme import ( - hykubev1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_hykube_client.go b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_hykube_client.go index c1130f1..626a043 100644 --- a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_hykube_client.go +++ b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_hykube_client.go @@ -12,7 +12,7 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package fake import ( - v1alpha1 "hykube.io/apiserver/pkg/generated/clientset/versioned/typed/hykube/v1alpha1" + v1alpha1 "github.com/infrapot/hykube/pkg/generated/clientset/versioned/typed/hykube/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) @@ -21,6 +21,10 @@ type FakeHykubeV1alpha1 struct { *testing.Fake } +func (c *FakeHykubeV1alpha1) Plans(namespace string) v1alpha1.PlanInterface { + return &FakePlans{c, namespace} +} + func (c *FakeHykubeV1alpha1) Providers(namespace string) v1alpha1.ProviderInterface { return &FakeProviders{c, namespace} } diff --git a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_provider.go b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_provider.go index 5a28d74..73d4a01 100644 --- a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_provider.go +++ b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/fake/fake_provider.go @@ -16,8 +16,8 @@ import ( json "encoding/json" "fmt" - v1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" - hykubev1alpha1 "hykube.io/apiserver/pkg/generated/applyconfiguration/hykube/v1alpha1" + v1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/generated/applyconfiguration/hykube/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/generated_expansion.go index fdc7bdf..2dbfa19 100644 --- a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/generated_expansion.go @@ -11,4 +11,6 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package v1alpha1 +type PlanExpansion interface{} + type ProviderExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/hykube_client.go b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/hykube_client.go index 7d6be36..484afe7 100644 --- a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/hykube_client.go +++ b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/hykube_client.go @@ -14,13 +14,14 @@ package v1alpha1 import ( "net/http" - v1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" - "hykube.io/apiserver/pkg/generated/clientset/versioned/scheme" + v1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + "github.com/infrapot/hykube/pkg/generated/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) type HykubeV1alpha1Interface interface { RESTClient() rest.Interface + PlansGetter ProvidersGetter } @@ -29,6 +30,10 @@ type HykubeV1alpha1Client struct { restClient rest.Interface } +func (c *HykubeV1alpha1Client) Plans(namespace string) PlanInterface { + return newPlans(c, namespace) +} + func (c *HykubeV1alpha1Client) Providers(namespace string) ProviderInterface { return newProviders(c, namespace) } diff --git a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/provider.go b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/provider.go index 5952c04..6a72b9c 100644 --- a/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/provider.go +++ b/pkg/generated/clientset/versioned/typed/hykube/v1alpha1/provider.go @@ -14,9 +14,9 @@ package v1alpha1 import ( "context" - v1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" - hykubev1alpha1 "hykube.io/apiserver/pkg/generated/applyconfiguration/hykube/v1alpha1" - scheme "hykube.io/apiserver/pkg/generated/clientset/versioned/scheme" + v1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/generated/applyconfiguration/hykube/v1alpha1" + scheme "github.com/infrapot/hykube/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index de54c29..c41e6de 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -16,9 +16,9 @@ import ( sync "sync" time "time" - versioned "hykube.io/apiserver/pkg/generated/clientset/versioned" - hykube "hykube.io/apiserver/pkg/generated/informers/externalversions/hykube" - internalinterfaces "hykube.io/apiserver/pkg/generated/informers/externalversions/internalinterfaces" + versioned "github.com/infrapot/hykube/pkg/generated/clientset/versioned" + hykube "github.com/infrapot/hykube/pkg/generated/informers/externalversions/hykube" + internalinterfaces "github.com/infrapot/hykube/pkg/generated/informers/externalversions/internalinterfaces" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index fb8a991..df2714a 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -14,7 +14,7 @@ package externalversions import ( "fmt" - v1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" + v1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -46,6 +46,8 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=hykube.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("plans"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Hykube().V1alpha1().Plans().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("providers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Hykube().V1alpha1().Providers().Informer()}, nil diff --git a/pkg/generated/informers/externalversions/hykube/interface.go b/pkg/generated/informers/externalversions/hykube/interface.go index 7ea8a05..3d55056 100644 --- a/pkg/generated/informers/externalversions/hykube/interface.go +++ b/pkg/generated/informers/externalversions/hykube/interface.go @@ -12,8 +12,8 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package hykube import ( - v1alpha1 "hykube.io/apiserver/pkg/generated/informers/externalversions/hykube/v1alpha1" - internalinterfaces "hykube.io/apiserver/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/infrapot/hykube/pkg/generated/informers/externalversions/hykube/v1alpha1" + internalinterfaces "github.com/infrapot/hykube/pkg/generated/informers/externalversions/internalinterfaces" ) // Interface provides access to each of this group's versions. diff --git a/pkg/generated/informers/externalversions/hykube/v1alpha1/interface.go b/pkg/generated/informers/externalversions/hykube/v1alpha1/interface.go index 2af797c..6e1f69e 100644 --- a/pkg/generated/informers/externalversions/hykube/v1alpha1/interface.go +++ b/pkg/generated/informers/externalversions/hykube/v1alpha1/interface.go @@ -12,11 +12,13 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package v1alpha1 import ( - internalinterfaces "hykube.io/apiserver/pkg/generated/informers/externalversions/internalinterfaces" + internalinterfaces "github.com/infrapot/hykube/pkg/generated/informers/externalversions/internalinterfaces" ) // Interface provides access to all the informers in this group version. type Interface interface { + // Plans returns a PlanInformer. + Plans() PlanInformer // Providers returns a ProviderInformer. Providers() ProviderInformer } @@ -32,6 +34,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// Plans returns a PlanInformer. +func (v *version) Plans() PlanInformer { + return &planInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // Providers returns a ProviderInformer. func (v *version) Providers() ProviderInformer { return &providerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/generated/informers/externalversions/hykube/v1alpha1/provider.go b/pkg/generated/informers/externalversions/hykube/v1alpha1/provider.go index 96c0d71..c1b0240 100644 --- a/pkg/generated/informers/externalversions/hykube/v1alpha1/provider.go +++ b/pkg/generated/informers/externalversions/hykube/v1alpha1/provider.go @@ -15,10 +15,10 @@ import ( "context" time "time" - hykubev1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" - versioned "hykube.io/apiserver/pkg/generated/clientset/versioned" - internalinterfaces "hykube.io/apiserver/pkg/generated/informers/externalversions/internalinterfaces" - v1alpha1 "hykube.io/apiserver/pkg/generated/listers/hykube/v1alpha1" + hykubev1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + versioned "github.com/infrapot/hykube/pkg/generated/clientset/versioned" + internalinterfaces "github.com/infrapot/hykube/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/infrapot/hykube/pkg/generated/listers/hykube/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" diff --git a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index 065dd7e..f4f6f73 100644 --- a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -14,7 +14,7 @@ package internalinterfaces import ( time "time" - versioned "hykube.io/apiserver/pkg/generated/clientset/versioned" + versioned "github.com/infrapot/hykube/pkg/generated/clientset/versioned" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" cache "k8s.io/client-go/tools/cache" diff --git a/pkg/generated/listers/hykube/v1alpha1/expansion_generated.go b/pkg/generated/listers/hykube/v1alpha1/expansion_generated.go index 76494f9..e15f67f 100644 --- a/pkg/generated/listers/hykube/v1alpha1/expansion_generated.go +++ b/pkg/generated/listers/hykube/v1alpha1/expansion_generated.go @@ -11,6 +11,14 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package v1alpha1 +// PlanListerExpansion allows custom methods to be added to +// PlanLister. +type PlanListerExpansion interface{} + +// PlanNamespaceListerExpansion allows custom methods to be added to +// PlanNamespaceLister. +type PlanNamespaceListerExpansion interface{} + // ProviderListerExpansion allows custom methods to be added to // ProviderLister. type ProviderListerExpansion interface{} diff --git a/pkg/generated/listers/hykube/v1alpha1/provider.go b/pkg/generated/listers/hykube/v1alpha1/provider.go index f6d6fe7..a4c40c2 100644 --- a/pkg/generated/listers/hykube/v1alpha1/provider.go +++ b/pkg/generated/listers/hykube/v1alpha1/provider.go @@ -12,7 +12,7 @@ For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html package v1alpha1 import ( - v1alpha1 "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" + v1alpha1 "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/listers" "k8s.io/client-go/tools/cache" diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 09b29c6..5cc3271 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -22,63 +22,182 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1.Provider": schema_pkg_apis_hykube_v1alpha1_Provider(ref), - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1.ProviderList": schema_pkg_apis_hykube_v1alpha1_ProviderList(ref), - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1.ProviderSpec": schema_pkg_apis_hykube_v1alpha1_ProviderSpec(ref), - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1.ProviderStatus": schema_pkg_apis_hykube_v1alpha1_ProviderStatus(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), - "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), - "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), - "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), - "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), - "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.Plan": schema_pkg_apis_hykube_v1alpha1_Plan(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.PlanList": schema_pkg_apis_hykube_v1alpha1_PlanList(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.PlanSpec": schema_pkg_apis_hykube_v1alpha1_PlanSpec(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.PlanStatus": schema_pkg_apis_hykube_v1alpha1_PlanStatus(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.Provider": schema_pkg_apis_hykube_v1alpha1_Provider(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.ProviderList": schema_pkg_apis_hykube_v1alpha1_ProviderList(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.ProviderSpec": schema_pkg_apis_hykube_v1alpha1_ProviderSpec(ref), + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.ProviderStatus": schema_pkg_apis_hykube_v1alpha1_ProviderStatus(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroup": schema_pkg_apis_meta_v1_APIGroup(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIGroupList": schema_pkg_apis_meta_v1_APIGroupList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResource": schema_pkg_apis_meta_v1_APIResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIResourceList": schema_pkg_apis_meta_v1_APIResourceList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.APIVersions": schema_pkg_apis_meta_v1_APIVersions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ApplyOptions": schema_pkg_apis_meta_v1_ApplyOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.CreateOptions": schema_pkg_apis_meta_v1_CreateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.DeleteOptions": schema_pkg_apis_meta_v1_DeleteOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration": schema_pkg_apis_meta_v1_Duration(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldSelectorRequirement": schema_pkg_apis_meta_v1_FieldSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.FieldsV1": schema_pkg_apis_meta_v1_FieldsV1(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GetOptions": schema_pkg_apis_meta_v1_GetOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupKind": schema_pkg_apis_meta_v1_GroupKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupResource": schema_pkg_apis_meta_v1_GroupResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersion": schema_pkg_apis_meta_v1_GroupVersion(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionForDiscovery": schema_pkg_apis_meta_v1_GroupVersionForDiscovery(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionKind": schema_pkg_apis_meta_v1_GroupVersionKind(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.GroupVersionResource": schema_pkg_apis_meta_v1_GroupVersionResource(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.InternalEvent": schema_pkg_apis_meta_v1_InternalEvent(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector": schema_pkg_apis_meta_v1_LabelSelector(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelectorRequirement": schema_pkg_apis_meta_v1_LabelSelectorRequirement(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.List": schema_pkg_apis_meta_v1_List(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta": schema_pkg_apis_meta_v1_ListMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ListOptions": schema_pkg_apis_meta_v1_ListOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ManagedFieldsEntry": schema_pkg_apis_meta_v1_ManagedFieldsEntry(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.MicroTime": schema_pkg_apis_meta_v1_MicroTime(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta": schema_pkg_apis_meta_v1_ObjectMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.OwnerReference": schema_pkg_apis_meta_v1_OwnerReference(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadata": schema_pkg_apis_meta_v1_PartialObjectMetadata(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PartialObjectMetadataList": schema_pkg_apis_meta_v1_PartialObjectMetadataList(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Patch": schema_pkg_apis_meta_v1_Patch(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.PatchOptions": schema_pkg_apis_meta_v1_PatchOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Preconditions": schema_pkg_apis_meta_v1_Preconditions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.RootPaths": schema_pkg_apis_meta_v1_RootPaths(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.ServerAddressByClientCIDR": schema_pkg_apis_meta_v1_ServerAddressByClientCIDR(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Status": schema_pkg_apis_meta_v1_Status(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusCause": schema_pkg_apis_meta_v1_StatusCause(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.StatusDetails": schema_pkg_apis_meta_v1_StatusDetails(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Table": schema_pkg_apis_meta_v1_Table(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableColumnDefinition": schema_pkg_apis_meta_v1_TableColumnDefinition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableOptions": schema_pkg_apis_meta_v1_TableOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRow": schema_pkg_apis_meta_v1_TableRow(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TableRowCondition": schema_pkg_apis_meta_v1_TableRowCondition(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Timestamp": schema_pkg_apis_meta_v1_Timestamp(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta": schema_pkg_apis_meta_v1_TypeMeta(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.UpdateOptions": schema_pkg_apis_meta_v1_UpdateOptions(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.WatchEvent": schema_pkg_apis_meta_v1_WatchEvent(ref), + "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), + "k8s.io/apimachinery/pkg/runtime.TypeMeta": schema_k8sio_apimachinery_pkg_runtime_TypeMeta(ref), + "k8s.io/apimachinery/pkg/runtime.Unknown": schema_k8sio_apimachinery_pkg_runtime_Unknown(ref), + "k8s.io/apimachinery/pkg/version.Info": schema_k8sio_apimachinery_pkg_version_Info(ref), + } +} + +func schema_pkg_apis_hykube_v1alpha1_Plan(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.PlanSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.PlanSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_hykube_v1alpha1_PlanList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PlanList is a list of Plan objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.Plan"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.Plan", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_hykube_v1alpha1_PlanSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + }, + }, + } +} + +func schema_pkg_apis_hykube_v1alpha1_PlanStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + }, + }, } } @@ -111,7 +230,7 @@ func schema_pkg_apis_hykube_v1alpha1_Provider(ref common.ReferenceCallback) comm "spec": { SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, - Ref: ref("hykube.io/apiserver/pkg/apis/hykube/v1alpha1.ProviderSpec"), + Ref: ref("github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.ProviderSpec"), }, }, "status": { @@ -130,7 +249,7 @@ func schema_pkg_apis_hykube_v1alpha1_Provider(ref common.ReferenceCallback) comm }, }, Dependencies: []string{ - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1.ProviderSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.ProviderSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, } } @@ -168,7 +287,7 @@ func schema_pkg_apis_hykube_v1alpha1_ProviderList(ref common.ReferenceCallback) Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ Default: map[string]interface{}{}, - Ref: ref("hykube.io/apiserver/pkg/apis/hykube/v1alpha1.Provider"), + Ref: ref("github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.Provider"), }, }, }, @@ -179,7 +298,7 @@ func schema_pkg_apis_hykube_v1alpha1_ProviderList(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1.Provider", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1.Provider", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, } } diff --git a/pkg/registry/hykube/plan/etcd.go b/pkg/registry/hykube/plan/etcd.go new file mode 100644 index 0000000..898e7ee --- /dev/null +++ b/pkg/registry/hykube/plan/etcd.go @@ -0,0 +1,58 @@ +/* + * Copyright 2024 by infrapot + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. + * + * For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + */ + +package plan + +import ( + "context" + "github.com/infrapot/hykube/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/registry" + "k8s.io/apimachinery/pkg/apis/meta/internalversion" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/registry/generic" + genericregistry "k8s.io/apiserver/pkg/registry/generic/registry" + "k8s.io/apiserver/pkg/registry/rest" +) + +// NewREST returns a RESTStorage object that will work against API services. +func NewREST(scheme *runtime.Scheme, optsGetter generic.RESTOptionsGetter) (*registry.REST, error) { + strategy := NewStrategy(scheme) + + store := &genericregistry.Store{ + NewFunc: func() runtime.Object { return &hykube.Plan{} }, + NewListFunc: func() runtime.Object { return &hykube.PlanList{} }, + PredicateFunc: MatchPlan, + DefaultQualifiedResource: hykube.Resource("plans"), + SingularQualifiedResource: hykube.Resource("plan"), + + CreateStrategy: strategy, + UpdateStrategy: strategy, + DeleteStrategy: strategy, + + // TODO: define table converter that exposes more than name/creation timestamp + TableConvertor: rest.NewDefaultTableConvertor(hykube.Resource("plans")), + } + options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: GetAttrs} + if err := store.CompleteWithOptions(options); err != nil { + return nil, err + } + + watch, err := store.Watch(context.TODO(), &internalversion.ListOptions{}) + if err != nil { + return nil, err + } + watcher := watcher{ + watch: watch, + hashicorpPlan: NewHashicorpPlan(store), + } + watcher.Start() + + return ®istry.REST{Store: store}, nil +} diff --git a/pkg/registry/hykube/plan/hashicorp.go b/pkg/registry/hykube/plan/hashicorp.go new file mode 100644 index 0000000..e1ff632 --- /dev/null +++ b/pkg/registry/hykube/plan/hashicorp.go @@ -0,0 +1,79 @@ +/* + * Copyright 2024 by infrapot + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. + * + * For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + */ + +package plan + +import ( + "context" + "fmt" + "github.com/go-resty/resty/v2" + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" + genericregistry "k8s.io/apiserver/pkg/registry/generic/registry" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/rest" + "time" +) + +type hashicorpPlan struct { + client *resty.Client + store *genericregistry.Store +} + +const dataDir = "/data" + +func (h *hashicorpPlan) Plan(ctx context.Context, plan *v1alpha1.Plan) error { + //config, err := rest.InClusterConfig() + //if err != nil { + // return err + //} + + //res, err := h.getResources(ctx, config) + //if err != nil { + // return err + //} + + //res.Object + + return nil +} + +func (h *hashicorpPlan) getResources(ctx context.Context, config *rest.Config) (*unstructured.UnstructuredList, error) { + client, err := dynamic.NewForConfig(config) + if err != nil { + return nil, fmt.Errorf("cannot get k8s config : %w", err) + } + + res, err := client.Resource(schema.GroupVersionResource{ + Group: "aws.hykube.io", + Version: "v1", + Resource: "aws-s3-buckets", + }).List(ctx, metav1.ListOptions{}) + if err != nil { + return nil, fmt.Errorf("cannot get resources : %w", err) + } + return res, nil +} + +type HashicorpPlan interface { + Plan(ctx context.Context, provider *v1alpha1.Plan) error +} + +func NewHashicorpPlan(store *genericregistry.Store) HashicorpPlan { + client := resty.New(). + SetRetryCount(3). + SetRetryWaitTime(1 * time.Second) + return &hashicorpPlan{ + client: client, + store: store, + } +} diff --git a/pkg/registry/hykube/plan/strategy.go b/pkg/registry/hykube/plan/strategy.go new file mode 100644 index 0000000..bf7d925 --- /dev/null +++ b/pkg/registry/hykube/plan/strategy.go @@ -0,0 +1,103 @@ +/* + * Copyright 2024 by infrapot + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. + * + * For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + */ + +package plan + +import ( + "context" + "fmt" + "github.com/infrapot/hykube/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube/validation" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apiserver/pkg/registry/generic" + "k8s.io/apiserver/pkg/storage" + "k8s.io/apiserver/pkg/storage/names" +) + +// NewStrategy creates and returns a planStrategy instance +func NewStrategy(typer runtime.ObjectTyper) planStrategy { + return planStrategy{ + typer, + names.SimpleNameGenerator, + } +} + +// GetAttrs returns labels.Set, fields.Set, and error in case the given runtime.Object is not the entity +func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) { + apiServer, ok := obj.(*hykube.Plan) + if !ok { + return nil, nil, fmt.Errorf("given object is not a Plan") + } + return labels.Set(apiServer.ObjectMeta.Labels), SelectableFields(apiServer), nil +} + +// MatchPlan is the filter used by the generic etcd backend to watch events +// from etcd to clients of the apiServer only interested in specific labels/fields. +func MatchPlan(label labels.Selector, field fields.Selector) storage.SelectionPredicate { + return storage.SelectionPredicate{ + Label: label, + Field: field, + GetAttrs: GetAttrs, + } +} + +// SelectableFields returns a field set that represents the object. +func SelectableFields(obj *hykube.Plan) fields.Set { + return generic.ObjectMetaFieldsSet(&obj.ObjectMeta, true) +} + +type planStrategy struct { + runtime.ObjectTyper + names.NameGenerator +} + +func (planStrategy) NamespaceScoped() bool { + return true +} + +func (p planStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) { + obj.(*hykube.Plan).Status = "Initiated" +} + +func (planStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) { +} + +func (planStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { + entity := obj.(*hykube.Plan) + return validation.ValidatePlan(entity) +} + +// WarningsOnCreate returns warnings for the creation of the given object. +func (planStrategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string { + return nil +} + +func (planStrategy) AllowCreateOnUpdate() bool { + return false +} + +func (planStrategy) AllowUnconditionalUpdate() bool { + return false +} + +func (planStrategy) Canonicalize(obj runtime.Object) { +} + +func (planStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { + return field.ErrorList{} +} + +// WarningsOnUpdate returns warnings for the given update. +func (planStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { + return nil +} diff --git a/pkg/registry/hykube/plan/watch.go b/pkg/registry/hykube/plan/watch.go new file mode 100644 index 0000000..d0278a6 --- /dev/null +++ b/pkg/registry/hykube/plan/watch.go @@ -0,0 +1,47 @@ +/* + * Copyright 2024 by infrapot + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. + * + * For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + */ + +package plan + +import ( + "context" + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" + watch2 "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/klog/v2" +) + +type watcher struct { + watch watch2.Interface + hashicorpPlan HashicorpPlan +} + +func (p *watcher) Start() { + + go func() { + for { + //var event *watch2.Event + event := <-p.watch.ResultChan() + if event.Type == watch2.Added { + dto := event.Object.(*v1alpha1.Plan) + + ctx := request.WithNamespace(context.TODO(), dto.Namespace) + + klog.Infof("Found added event for: %v", dto.Name) + + err := p.hashicorpPlan.Plan(ctx, dto) + + if err != nil { + klog.ErrorS(err, "Couldn't initialize entity: %s", dto.Name) + } + } + } + }() +} diff --git a/pkg/registry/hykube/provider/etcd.go b/pkg/registry/hykube/provider/etcd.go index 86fcea4..9661c40 100644 --- a/pkg/registry/hykube/provider/etcd.go +++ b/pkg/registry/hykube/provider/etcd.go @@ -18,8 +18,8 @@ package provider import ( "context" - "hykube.io/apiserver/pkg/apis/hykube" - "hykube.io/apiserver/pkg/registry" + "github.com/infrapot/hykube/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/registry" "k8s.io/apimachinery/pkg/apis/meta/internalversion" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apiserver/pkg/registry/generic" diff --git a/pkg/registry/hykube/provider/hashicorp.go b/pkg/registry/hykube/provider/hashicorp.go index 1973cad..b238377 100644 --- a/pkg/registry/hykube/provider/hashicorp.go +++ b/pkg/registry/hykube/provider/hashicorp.go @@ -21,9 +21,9 @@ import ( "github.com/hashicorp/go-plugin" tfplugin "github.com/hashicorp/terraform/plugin" "github.com/hashicorp/terraform/providers" + "github.com/infrapot/hykube/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" "github.com/zclconf/go-cty/cty" - "hykube.io/apiserver/pkg/apis/hykube" - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" "io" apiextensionv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" crd_clientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" @@ -264,7 +264,7 @@ func (h *hashicorpProvider) getProviderSchema(providerPath string, verbose bool) func (h *hashicorpProvider) addCDRs(schemaResponse *providers.GetSchemaResponse, provider *v1alpha1.Provider) error { config, err := rest.InClusterConfig() if err != nil { - return err + return fmt.Errorf("cannot get k8s config : %w", err) } crdClient, err := crd_clientset.NewForConfig(config) @@ -273,7 +273,7 @@ func (h *hashicorpProvider) addCDRs(schemaResponse *providers.GetSchemaResponse, trueVal := true if err != nil { - return err + return fmt.Errorf("cannot get CRD client : %w", err) } klog.Infof("Schema has %d resource types", len(schemaResponse.ResourceTypes)) for k, v := range schemaResponse.ResourceTypes { diff --git a/pkg/registry/hykube/provider/strategy.go b/pkg/registry/hykube/provider/strategy.go index 1687428..19bd49f 100644 --- a/pkg/registry/hykube/provider/strategy.go +++ b/pkg/registry/hykube/provider/strategy.go @@ -19,8 +19,8 @@ package provider import ( "context" "fmt" - "hykube.io/apiserver/pkg/apis/hykube" - "hykube.io/apiserver/pkg/apis/hykube/validation" + "github.com/infrapot/hykube/pkg/apis/hykube" + "github.com/infrapot/hykube/pkg/apis/hykube/validation" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/registry/hykube/provider/watch.go b/pkg/registry/hykube/provider/watch.go index b17c4f9..b074d04 100644 --- a/pkg/registry/hykube/provider/watch.go +++ b/pkg/registry/hykube/provider/watch.go @@ -12,7 +12,7 @@ package provider import ( "context" - "hykube.io/apiserver/pkg/apis/hykube/v1alpha1" + "github.com/infrapot/hykube/pkg/apis/hykube/v1alpha1" watch2 "k8s.io/apimachinery/pkg/watch" "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/klog/v2"