From cc21eb0e4da2dfc9b7a1d6a69485c4ffde480087 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Fri, 21 Feb 2025 01:58:29 +0000 Subject: [PATCH] Move CR APIs to k3s-io/api Signed-off-by: Brad Davidson (cherry picked from commit 5894af30ffd535986451c2ff3ed4a79408354e9e) Signed-off-by: Brad Davidson --- go.mod | 14 +- go.sum | 19 +- hack/crdgen.go | 2 +- main.go | 2 - pkg/agent/https/https.go | 2 +- pkg/apis/k3s.cattle.io/v1/doc.go | 21 -- pkg/apis/k3s.cattle.io/v1/types.go | 105 ------- .../k3s.cattle.io/v1/zz_generated_deepcopy.go | 267 ------------------ .../v1/zz_generated_list_types.go | 59 ---- .../k3s.cattle.io/v1/zz_generated_register.go | 63 ----- .../k3s.cattle.io/zz_generated_register.go | 24 -- pkg/cli/etcdsnapshot/etcd_snapshot.go | 2 +- pkg/codegen/cleanup/main.go | 12 - pkg/codegen/main.go | 22 -- pkg/crd/crds.go | 2 +- pkg/daemons/config/types.go | 2 +- pkg/deploy/controller.go | 4 +- pkg/etcd/snapshot.go | 2 +- pkg/etcd/snapshot/types.go | 2 +- pkg/etcd/snapshot_controller.go | 6 +- pkg/etcd/snapshot_handler.go | 2 +- .../clientset/versioned/clientset.go | 120 -------- .../versioned/fake/clientset_generated.go | 89 ------ pkg/generated/clientset/versioned/fake/doc.go | 20 -- .../clientset/versioned/fake/register.go | 56 ---- .../clientset/versioned/scheme/doc.go | 20 -- .../clientset/versioned/scheme/register.go | 56 ---- .../versioned/typed/k3s.cattle.io/v1/addon.go | 67 ----- .../versioned/typed/k3s.cattle.io/v1/doc.go | 20 -- .../k3s.cattle.io/v1/etcdsnapshotfile.go | 69 ----- .../typed/k3s.cattle.io/v1/fake/doc.go | 20 -- .../typed/k3s.cattle.io/v1/fake/fake_addon.go | 134 --------- .../v1/fake/fake_etcdsnapshotfile.go | 138 --------- .../v1/fake/fake_k3s.cattle.io_client.go | 44 --- .../k3s.cattle.io/v1/generated_expansion.go | 23 -- .../k3s.cattle.io/v1/k3s.cattle.io_client.go | 112 -------- .../controllers/k3s.cattle.io/factory.go | 72 ----- .../controllers/k3s.cattle.io/interface.go | 43 --- .../controllers/k3s.cattle.io/v1/addon.go | 39 --- .../k3s.cattle.io/v1/etcdsnapshotfile.go | 208 -------------- .../controllers/k3s.cattle.io/v1/interface.go | 54 ---- pkg/secretsencrypt/config.go | 2 +- pkg/server/context.go | 2 +- pkg/util/apierrors.go | 2 +- scripts/test-mods | 2 +- 45 files changed, 30 insertions(+), 2016 deletions(-) delete mode 100644 pkg/apis/k3s.cattle.io/v1/doc.go delete mode 100644 pkg/apis/k3s.cattle.io/v1/types.go delete mode 100644 pkg/apis/k3s.cattle.io/v1/zz_generated_deepcopy.go delete mode 100644 pkg/apis/k3s.cattle.io/v1/zz_generated_list_types.go delete mode 100644 pkg/apis/k3s.cattle.io/v1/zz_generated_register.go delete mode 100644 pkg/apis/k3s.cattle.io/zz_generated_register.go delete mode 100644 pkg/codegen/cleanup/main.go delete mode 100644 pkg/generated/clientset/versioned/clientset.go delete mode 100644 pkg/generated/clientset/versioned/fake/clientset_generated.go delete mode 100644 pkg/generated/clientset/versioned/fake/doc.go delete mode 100644 pkg/generated/clientset/versioned/fake/register.go delete mode 100644 pkg/generated/clientset/versioned/scheme/doc.go delete mode 100644 pkg/generated/clientset/versioned/scheme/register.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/addon.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/doc.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/etcdsnapshotfile.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/doc.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_addon.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_etcdsnapshotfile.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_k3s.cattle.io_client.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/generated_expansion.go delete mode 100644 pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/k3s.cattle.io_client.go delete mode 100644 pkg/generated/controllers/k3s.cattle.io/factory.go delete mode 100644 pkg/generated/controllers/k3s.cattle.io/interface.go delete mode 100644 pkg/generated/controllers/k3s.cattle.io/v1/addon.go delete mode 100644 pkg/generated/controllers/k3s.cattle.io/v1/etcdsnapshotfile.go delete mode 100644 pkg/generated/controllers/k3s.cattle.io/v1/interface.go diff --git a/go.mod b/go.mod index 32852220c0..8e1236ed1b 100644 --- a/go.mod +++ b/go.mod @@ -75,6 +75,8 @@ replace ( k8s.io/sample-cli-plugin => github.com/k3s-io/kubernetes/staging/src/k8s.io/sample-cli-plugin v1.31.6-k3s1 k8s.io/sample-controller => github.com/k3s-io/kubernetes/staging/src/k8s.io/sample-controller v1.31.6-k3s1 sigs.k8s.io/cri-tools => github.com/k3s-io/cri-tools v1.31.0-k3s2 + sigs.k8s.io/json => sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd + sigs.k8s.io/structured-merge-diff/v4 => sigs.k8s.io/structured-merge-diff/v4 v4.4.1 sourcegraph.com/sourcegraph/go-diff => github.com/sourcegraph/go-diff v0.6.0 ) @@ -112,6 +114,7 @@ require ( github.com/ipfs/go-log/v2 v2.5.1 github.com/joho/godotenv v1.5.1 github.com/json-iterator/go v1.1.12 + github.com/k3s-io/api v0.1.0-k3s1.30 github.com/k3s-io/helm-controller v0.16.6 github.com/k3s-io/kine v0.13.9 github.com/klauspost/compress v1.17.11 @@ -158,7 +161,7 @@ require ( google.golang.org/grpc v1.70.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.31.6 - k8s.io/apimachinery v0.31.6 + k8s.io/apimachinery v0.32.2 k8s.io/apiserver v0.31.6 k8s.io/cli-runtime v0.31.6 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible @@ -172,7 +175,7 @@ require ( k8s.io/kube-proxy v0.0.0 k8s.io/kubectl v0.31.6 k8s.io/kubernetes v1.31.2 - k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 sigs.k8s.io/cri-tools v0.0.0-00010101000000-000000000000 sigs.k8s.io/yaml v1.4.0 ) @@ -489,17 +492,14 @@ require ( gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.31.6 // indirect - k8s.io/code-generator v0.31.6 // indirect k8s.io/controller-manager v0.25.4 // indirect k8s.io/csi-translation-lib v0.0.0 // indirect k8s.io/dynamic-resource-allocation v0.0.0 // indirect k8s.io/endpointslice v0.0.0 // indirect - k8s.io/gengo v0.0.0-20240826214909-a7b603a56eb7 // indirect - k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 // indirect k8s.io/kms v0.0.0 // indirect k8s.io/kube-aggregator v0.31.6 // indirect k8s.io/kube-controller-manager v0.0.0 // indirect - k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect k8s.io/kube-scheduler v0.0.0 // indirect k8s.io/kubelet v0.31.6 // indirect k8s.io/metrics v0.0.0 // indirect @@ -512,7 +512,7 @@ require ( sigs.k8s.io/kustomize/api v0.17.2 // indirect sigs.k8s.io/kustomize/kustomize/v5 v5.4.2 // indirect sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect tags.cncf.io/container-device-interface v0.8.0 // indirect tags.cncf.io/container-device-interface/specs-go v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index d937b0b51d..a4dc22e9e4 100644 --- a/go.sum +++ b/go.sum @@ -637,7 +637,6 @@ github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+u github.com/google/go-pkcs11 v0.2.1-0.20230907215043-c6f79328ddf9/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= @@ -814,6 +813,8 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/k3s-io/api v0.1.0-k3s1.30 h1:JHjmeYaXciWnOqL5fz/Yc+L21AonLvZGJsdiHnZIBe0= +github.com/k3s-io/api v0.1.0-k3s1.30/go.mod h1:PgSMkvAOeDd0ohsqnY7bx7Zrco6KZwzIwf/YXd+9jaY= github.com/k3s-io/containerd/v2 v2.0.2-k3s2 h1:gikcTRjqQLUELa68fyoVj9KaTWvZiG6hs/ilG+cwHy0= github.com/k3s-io/containerd/v2 v2.0.2-k3s2/go.mod h1:ZMICr2EXuBKAwsUwbLZSua6cKzTGOVOuu8l6a+8pyHw= github.com/k3s-io/cri-dockerd v0.3.15-k3s1.31-3 h1:TH3zSbIM9zSZMeWKcWjQqeja3FsmJYwLUHglD7nuUEc= @@ -862,8 +863,6 @@ github.com/k3s-io/kubernetes/staging/src/k8s.io/cloud-provider v1.31.6-k3s1 h1:9 github.com/k3s-io/kubernetes/staging/src/k8s.io/cloud-provider v1.31.6-k3s1/go.mod h1:aq39X+7JBHuYgLje0hmtOFnNwDFGxC3kMnxy6TK0IfE= github.com/k3s-io/kubernetes/staging/src/k8s.io/cluster-bootstrap v1.31.6-k3s1 h1:t/nSyInEax2JxL8h4fVafmN5RctUzmYfPTuN2Zgbvnk= github.com/k3s-io/kubernetes/staging/src/k8s.io/cluster-bootstrap v1.31.6-k3s1/go.mod h1:sC54xeBDUh723Sh3/rBJpYmjuu2TFYRg8jbiGa+2gR4= -github.com/k3s-io/kubernetes/staging/src/k8s.io/code-generator v1.31.6-k3s1 h1:mRs4zm7hQgyY4qDj32ZcxuZSxSK6ltDh/b+g3z1kWOY= -github.com/k3s-io/kubernetes/staging/src/k8s.io/code-generator v1.31.6-k3s1/go.mod h1:kpHioo65EeiEH6lBGgJq/xueL4Kr7PUMp7J4J5TTg4c= github.com/k3s-io/kubernetes/staging/src/k8s.io/component-base v1.31.6-k3s1 h1:6z0+mEcipN0PbuoENOjV10CsRRT0MDQCjMA/jrfR1+g= github.com/k3s-io/kubernetes/staging/src/k8s.io/component-base v1.31.6-k3s1/go.mod h1:PFOdhUAVD6O6z1yuKxWS3EKXSKdZhKjOlCrcuJRxOBA= github.com/k3s-io/kubernetes/staging/src/k8s.io/component-helpers v1.31.6-k3s1 h1:+bTBNGK1wO1DZWU7LaY+qnlRFzq2RPqeUvI5gUybVD8= @@ -1717,7 +1716,6 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -1951,14 +1949,10 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= k8s.io/cri-client v0.31.6 h1:I1twvv4HZK7YuIQSlacnEeyx4UKgTsGLoBvkQAdFfU8= k8s.io/cri-client v0.31.6/go.mod h1:N2Wdhtcy5HvA/u57HHe95yGIA0WeHHBXkX0f1XyhwjA= -k8s.io/gengo v0.0.0-20240826214909-a7b603a56eb7 h1:HCbtr1pVu/ElMcTTs18KdMtH5y6f7PQvrjh1QZj3qCI= -k8s.io/gengo v0.0.0-20240826214909-a7b603a56eb7/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= -k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7 h1:cErOOTkQ3JW19o4lo91fFurouhP8NcoBvb7CkvhZZpk= -k8s.io/gengo/v2 v2.0.0-20240826214909-a7b603a56eb7/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= -k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 h1:1dWzkmJrrprYvjGwh9kEUxmcUV/CtNU8QM7h1FLWQOo= -k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38/go.mod h1:coRQXBK9NxO98XUv3ZD6AK3xzHCxV6+b7lrquKwaKzA= -k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 h1:b2FmK8YH+QEwq/Sy2uAEhmqL5nPfGYbJOcaqjeYYZoA= -k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= lukechampine.com/blake3 v1.3.0 h1:sJ3XhFINmHSrYCgl958hscfIa3bw8x4DqMP3u1YvoYE= lukechampine.com/blake3 v1.3.0/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= @@ -2013,7 +2007,6 @@ sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrL sigs.k8s.io/kustomize/kyaml v0.17.1/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= -sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= tags.cncf.io/container-device-interface v0.8.0 h1:8bCFo/g9WODjWx3m6EYl3GfUG31eKJbaggyBDxEldRc= diff --git a/hack/crdgen.go b/hack/crdgen.go index 74094ccf53..e875940b28 100644 --- a/hack/crdgen.go +++ b/hack/crdgen.go @@ -4,7 +4,7 @@ import ( "os" k3scrd "github.com/k3s-io/k3s/pkg/crd" - _ "github.com/k3s-io/k3s/pkg/generated/controllers/k3s.cattle.io/v1" + _ "github.com/k3s-io/api/pkg/generated/controllers/k3s.cattle.io/v1" "github.com/rancher/wrangler/v3/pkg/crd" ) diff --git a/main.go b/main.go index 7859d13a4d..78ac760b99 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,3 @@ -//go:generate go run pkg/codegen/cleanup/main.go -//go:generate rm -rf pkg/generated //go:generate go run pkg/codegen/main.go //go:generate go fmt pkg/deploy/zz_generated_bindata.go //go:generate go fmt pkg/static/zz_generated_bindata.go diff --git a/pkg/agent/https/https.go b/pkg/agent/https/https.go index 282cebed4a..33e001be97 100644 --- a/pkg/agent/https/https.go +++ b/pkg/agent/https/https.go @@ -8,7 +8,7 @@ import ( "github.com/gorilla/mux" "github.com/k3s-io/k3s/pkg/daemons/config" - "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/scheme" + "github.com/k3s-io/api/pkg/generated/clientset/versioned/scheme" "github.com/k3s-io/k3s/pkg/util" "github.com/k3s-io/k3s/pkg/version" "k8s.io/apiserver/pkg/apis/apiserver" diff --git a/pkg/apis/k3s.cattle.io/v1/doc.go b/pkg/apis/k3s.cattle.io/v1/doc.go deleted file mode 100644 index 1be22ca536..0000000000 --- a/pkg/apis/k3s.cattle.io/v1/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -// +k8s:deepcopy-gen=package -// +groupName=k3s.cattle.io -package v1 diff --git a/pkg/apis/k3s.cattle.io/v1/types.go b/pkg/apis/k3s.cattle.io/v1/types.go deleted file mode 100644 index c52e8eee51..0000000000 --- a/pkg/apis/k3s.cattle.io/v1/types.go +++ /dev/null @@ -1,105 +0,0 @@ -package v1 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:noStatus -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Addon is used to track application of a manifest file on disk. It mostly exists so that the wrangler DesiredSet -// Apply controller has an object to track as the owner, and ensure that all created resources are tracked when the -// manifest is modified or removed. -type Addon struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec provides information about the on-disk manifest backing this resource. - Spec AddonSpec `json:"spec,omitempty"` -} - -type AddonSpec struct { - // Source is the Path on disk to the manifest file that this Addon tracks. - Source string `json:"source,omitempty" column:""` - // Checksum is the SHA256 checksum of the most recently successfully applied manifest file. - Checksum string `json:"checksum,omitempty" column:""` -} - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ETCDSnapshot tracks a point-in-time snapshot of the etcd datastore. -type ETCDSnapshotFile struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - // Spec defines properties of an etcd snapshot file - Spec ETCDSnapshotSpec `json:"spec,omitempty"` - // Status represents current information about a snapshot. - Status ETCDSnapshotStatus `json:"status,omitempty"` -} - -// ETCDSnapshotSpec desribes an etcd snapshot file -type ETCDSnapshotSpec struct { - // SnapshotName contains the base name of the snapshot file. CLI actions that act - // on snapshots stored locally or within a pre-configured S3 bucket and - // prefix usually take the snapshot name as their argument. - SnapshotName string `json:"snapshotName" column:""` - // NodeName contains the name of the node that took the snapshot. - NodeName string `json:"nodeName" column:"name=Node"` - // Location is the absolute file:// or s3:// URI address of the snapshot. - Location string `json:"location" column:""` - // Metadata contains point-in-time snapshot of the contents of the - // k3s-etcd-snapshot-extra-metadata ConfigMap's data field, at the time the - // snapshot was taken. This is intended to contain data about cluster state - // that may be important for an external system to have available when restoring - // the snapshot. - Metadata map[string]string `json:"metadata,omitempty"` - // S3 contains extra metadata about the S3 storage system holding the - // snapshot. This is guaranteed to be set for all snapshots uploaded to S3. - // If not specified, the snapshot was not uploaded to S3. - S3 *ETCDSnapshotS3 `json:"s3,omitempty"` -} - -// ETCDSnapshotS3 holds information about the S3 storage system holding the snapshot. -type ETCDSnapshotS3 struct { - // Endpoint is the host or host:port of the S3 service - Endpoint string `json:"endpoint,omitempty"` - // EndpointCA is the path on disk to the S3 service's trusted CA list. Leave empty to use the OS CA bundle. - EndpointCA string `json:"endpointCA,omitempty"` - // SkipSSLVerify is true if TLS certificate verification is disabled - SkipSSLVerify bool `json:"skipSSLVerify,omitempty"` - // Bucket is the bucket holding the snapshot - Bucket string `json:"bucket,omitempty"` - // Region is the region of the S3 service - Region string `json:"region,omitempty"` - // Prefix is the prefix in which the snapshot file is stored. - Prefix string `json:"prefix,omitempty"` - // Insecure is true if the S3 service uses HTTP instead of HTTPS - Insecure bool `json:"insecure,omitempty"` -} - -// ETCDSnapshotStatus is the status of the ETCDSnapshotFile object. -type ETCDSnapshotStatus struct { - // Size is the size of the snapshot file, in bytes. If not specified, the snapshot failed. - Size *resource.Quantity `json:"size,omitempty" column:""` - // CreationTime is the timestamp when the snapshot was taken by etcd. - CreationTime *metav1.Time `json:"creationTime,omitempty" column:""` - // ReadyToUse indicates that the snapshot is available to be restored. - ReadyToUse *bool `json:"readyToUse,omitempty"` - // Error is the last observed error during snapshot creation, if any. - // If the snapshot is retried, this field will be cleared on success. - Error *ETCDSnapshotError `json:"error,omitempty"` -} - -// ETCDSnapshotError describes an error encountered during snapshot creation. -type ETCDSnapshotError struct { - // Time is the timestamp when the error was encountered. - Time *metav1.Time `json:"time,omitempty"` - // Message is a string detailing the encountered error during snapshot creation if specified. - // NOTE: message may be logged, and it should not contain sensitive information. - Message *string `json:"message,omitempty"` -} diff --git a/pkg/apis/k3s.cattle.io/v1/zz_generated_deepcopy.go b/pkg/apis/k3s.cattle.io/v1/zz_generated_deepcopy.go deleted file mode 100644 index 1679c1e7ff..0000000000 --- a/pkg/apis/k3s.cattle.io/v1/zz_generated_deepcopy.go +++ /dev/null @@ -1,267 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -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 *Addon) DeepCopyInto(out *Addon) { - *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 Addon. -func (in *Addon) DeepCopy() *Addon { - if in == nil { - return nil - } - out := new(Addon) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Addon) 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 *AddonList) DeepCopyInto(out *AddonList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Addon, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonList. -func (in *AddonList) DeepCopy() *AddonList { - if in == nil { - return nil - } - out := new(AddonList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *AddonList) 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 *AddonSpec) DeepCopyInto(out *AddonSpec) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddonSpec. -func (in *AddonSpec) DeepCopy() *AddonSpec { - if in == nil { - return nil - } - out := new(AddonSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ETCDSnapshotError) DeepCopyInto(out *ETCDSnapshotError) { - *out = *in - if in.Time != nil { - in, out := &in.Time, &out.Time - *out = (*in).DeepCopy() - } - if in.Message != nil { - in, out := &in.Message, &out.Message - *out = new(string) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ETCDSnapshotError. -func (in *ETCDSnapshotError) DeepCopy() *ETCDSnapshotError { - if in == nil { - return nil - } - out := new(ETCDSnapshotError) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ETCDSnapshotFile) DeepCopyInto(out *ETCDSnapshotFile) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ETCDSnapshotFile. -func (in *ETCDSnapshotFile) DeepCopy() *ETCDSnapshotFile { - if in == nil { - return nil - } - out := new(ETCDSnapshotFile) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ETCDSnapshotFile) 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 *ETCDSnapshotFileList) DeepCopyInto(out *ETCDSnapshotFileList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]ETCDSnapshotFile, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ETCDSnapshotFileList. -func (in *ETCDSnapshotFileList) DeepCopy() *ETCDSnapshotFileList { - if in == nil { - return nil - } - out := new(ETCDSnapshotFileList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ETCDSnapshotFileList) 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 *ETCDSnapshotS3) DeepCopyInto(out *ETCDSnapshotS3) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ETCDSnapshotS3. -func (in *ETCDSnapshotS3) DeepCopy() *ETCDSnapshotS3 { - if in == nil { - return nil - } - out := new(ETCDSnapshotS3) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ETCDSnapshotSpec) DeepCopyInto(out *ETCDSnapshotSpec) { - *out = *in - if in.Metadata != nil { - in, out := &in.Metadata, &out.Metadata - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } - if in.S3 != nil { - in, out := &in.S3, &out.S3 - *out = new(ETCDSnapshotS3) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ETCDSnapshotSpec. -func (in *ETCDSnapshotSpec) DeepCopy() *ETCDSnapshotSpec { - if in == nil { - return nil - } - out := new(ETCDSnapshotSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ETCDSnapshotStatus) DeepCopyInto(out *ETCDSnapshotStatus) { - *out = *in - if in.Size != nil { - in, out := &in.Size, &out.Size - x := (*in).DeepCopy() - *out = &x - } - if in.CreationTime != nil { - in, out := &in.CreationTime, &out.CreationTime - *out = (*in).DeepCopy() - } - if in.ReadyToUse != nil { - in, out := &in.ReadyToUse, &out.ReadyToUse - *out = new(bool) - **out = **in - } - if in.Error != nil { - in, out := &in.Error, &out.Error - *out = new(ETCDSnapshotError) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ETCDSnapshotStatus. -func (in *ETCDSnapshotStatus) DeepCopy() *ETCDSnapshotStatus { - if in == nil { - return nil - } - out := new(ETCDSnapshotStatus) - in.DeepCopyInto(out) - return out -} diff --git a/pkg/apis/k3s.cattle.io/v1/zz_generated_list_types.go b/pkg/apis/k3s.cattle.io/v1/zz_generated_list_types.go deleted file mode 100644 index c00d6ac70a..0000000000 --- a/pkg/apis/k3s.cattle.io/v1/zz_generated_list_types.go +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -// +k8s:deepcopy-gen=package -// +groupName=k3s.cattle.io -package v1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// AddonList is a list of Addon resources -type AddonList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []Addon `json:"items"` -} - -func NewAddon(namespace, name string, obj Addon) *Addon { - obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("Addon").ToAPIVersionAndKind() - obj.Name = name - obj.Namespace = namespace - return &obj -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ETCDSnapshotFileList is a list of ETCDSnapshotFile resources -type ETCDSnapshotFileList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []ETCDSnapshotFile `json:"items"` -} - -func NewETCDSnapshotFile(namespace, name string, obj ETCDSnapshotFile) *ETCDSnapshotFile { - obj.APIVersion, obj.Kind = SchemeGroupVersion.WithKind("ETCDSnapshotFile").ToAPIVersionAndKind() - obj.Name = name - obj.Namespace = namespace - return &obj -} diff --git a/pkg/apis/k3s.cattle.io/v1/zz_generated_register.go b/pkg/apis/k3s.cattle.io/v1/zz_generated_register.go deleted file mode 100644 index 90761711f7..0000000000 --- a/pkg/apis/k3s.cattle.io/v1/zz_generated_register.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -// +k8s:deepcopy-gen=package -// +groupName=k3s.cattle.io -package v1 - -import ( - k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -var ( - AddonResourceName = "addons" - ETCDSnapshotFileResourceName = "etcdsnapshotfiles" -) - -// SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: k3s.GroupName, Version: "v1"} - -// Kind takes an unqualified kind and returns back a Group qualified GroupKind -func Kind(kind string) schema.GroupKind { - return SchemeGroupVersion.WithKind(kind).GroupKind() -} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} - -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &Addon{}, - &AddonList{}, - &ETCDSnapshotFile{}, - &ETCDSnapshotFileList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/pkg/apis/k3s.cattle.io/zz_generated_register.go b/pkg/apis/k3s.cattle.io/zz_generated_register.go deleted file mode 100644 index ffbf9ef6b4..0000000000 --- a/pkg/apis/k3s.cattle.io/zz_generated_register.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package k3s - -const ( - // Package-wide consts from generator "zz_generated_register". - GroupName = "k3s.cattle.io" -) diff --git a/pkg/cli/etcdsnapshot/etcd_snapshot.go b/pkg/cli/etcdsnapshot/etcd_snapshot.go index 876b0ea7de..a77eeaa6bf 100644 --- a/pkg/cli/etcdsnapshot/etcd_snapshot.go +++ b/pkg/cli/etcdsnapshot/etcd_snapshot.go @@ -12,7 +12,7 @@ import ( "text/tabwriter" "time" - k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" + k3s "github.com/k3s-io/api/k3s.cattle.io/v1" "github.com/k3s-io/k3s/pkg/cli/cmds" "github.com/k3s-io/k3s/pkg/clientaccess" "github.com/k3s-io/k3s/pkg/cluster/managed" diff --git a/pkg/codegen/cleanup/main.go b/pkg/codegen/cleanup/main.go deleted file mode 100644 index 79d9cfa6cc..0000000000 --- a/pkg/codegen/cleanup/main.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import ( - "github.com/rancher/wrangler/v3/pkg/cleanup" - "github.com/sirupsen/logrus" -) - -func main() { - if err := cleanup.Cleanup("./pkg/apis"); err != nil { - logrus.Fatal(err) - } -} diff --git a/pkg/codegen/main.go b/pkg/codegen/main.go index 616ff1a14b..c6f8151cbe 100644 --- a/pkg/codegen/main.go +++ b/pkg/codegen/main.go @@ -4,16 +4,9 @@ import ( "os" bindata "github.com/go-bindata/go-bindata" - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - controllergen "github.com/rancher/wrangler/v3/pkg/controller-gen" - "github.com/rancher/wrangler/v3/pkg/controller-gen/args" "github.com/sirupsen/logrus" ) -var ( - basePackage = "github.com/k3s-io/k3s/types" -) - func main() { os.Unsetenv("GOPATH") bc := &bindata.Config{ @@ -66,19 +59,4 @@ func main() { if err := bindata.Translate(bc); err != nil { logrus.Fatal(err) } - - controllergen.Run(args.Options{ - OutputPackage: "github.com/k3s-io/k3s/pkg/generated", - Boilerplate: "scripts/boilerplate.go.txt", - Groups: map[string]args.Group{ - "k3s.cattle.io": { - Types: []interface{}{ - v1.Addon{}, - v1.ETCDSnapshotFile{}, - }, - GenerateTypes: true, - GenerateClients: true, - }, - }, - }) } diff --git a/pkg/crd/crds.go b/pkg/crd/crds.go index a5ab26b53c..0515419d2d 100644 --- a/pkg/crd/crds.go +++ b/pkg/crd/crds.go @@ -1,7 +1,7 @@ package crd import ( - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" + v1 "github.com/k3s-io/api/k3s.cattle.io/v1" "github.com/rancher/wrangler/v3/pkg/crd" ) diff --git a/pkg/daemons/config/types.go b/pkg/daemons/config/types.go index 920b409961..7601ac36a7 100644 --- a/pkg/daemons/config/types.go +++ b/pkg/daemons/config/types.go @@ -9,7 +9,7 @@ import ( "strings" "sync" - "github.com/k3s-io/k3s/pkg/generated/controllers/k3s.cattle.io" + "github.com/k3s-io/api/pkg/generated/controllers/k3s.cattle.io" "github.com/k3s-io/kine/pkg/endpoint" "github.com/rancher/wharfie/pkg/registries" "github.com/rancher/wrangler/v3/pkg/generated/controllers/core" diff --git a/pkg/deploy/controller.go b/pkg/deploy/controller.go index af96e8fafa..c80ac7dff1 100644 --- a/pkg/deploy/controller.go +++ b/pkg/deploy/controller.go @@ -16,8 +16,8 @@ import ( "time" "github.com/k3s-io/k3s/pkg/agent/util" - apisv1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - controllersv1 "github.com/k3s-io/k3s/pkg/generated/controllers/k3s.cattle.io/v1" + apisv1 "github.com/k3s-io/api/k3s.cattle.io/v1" + controllersv1 "github.com/k3s-io/api/pkg/generated/controllers/k3s.cattle.io/v1" pkgutil "github.com/k3s-io/k3s/pkg/util" errors2 "github.com/pkg/errors" "github.com/rancher/wrangler/v3/pkg/apply" diff --git a/pkg/etcd/snapshot.go b/pkg/etcd/snapshot.go index b55daccec8..76b4c44543 100644 --- a/pkg/etcd/snapshot.go +++ b/pkg/etcd/snapshot.go @@ -17,7 +17,7 @@ import ( "strings" "time" - k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" + k3s "github.com/k3s-io/api/k3s.cattle.io/v1" "github.com/k3s-io/k3s/pkg/cluster/managed" "github.com/k3s-io/k3s/pkg/daemons/config" "github.com/k3s-io/k3s/pkg/etcd/s3" diff --git a/pkg/etcd/snapshot/types.go b/pkg/etcd/snapshot/types.go index 970fe336ef..17efc44657 100644 --- a/pkg/etcd/snapshot/types.go +++ b/pkg/etcd/snapshot/types.go @@ -11,7 +11,7 @@ import ( "regexp" "strings" - k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" + k3s "github.com/k3s-io/api/k3s.cattle.io/v1" "github.com/k3s-io/k3s/pkg/daemons/config" "github.com/k3s-io/k3s/pkg/version" "github.com/minio/minio-go/v7" diff --git a/pkg/etcd/snapshot_controller.go b/pkg/etcd/snapshot_controller.go index fc3c33502d..d855b95b85 100644 --- a/pkg/etcd/snapshot_controller.go +++ b/pkg/etcd/snapshot_controller.go @@ -8,10 +8,10 @@ import ( "strings" "time" - apisv1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" + apisv1 "github.com/k3s-io/api/k3s.cattle.io/v1" + k3s "github.com/k3s-io/api/k3s.cattle.io/v1" "github.com/k3s-io/k3s/pkg/etcd/snapshot" - controllersv1 "github.com/k3s-io/k3s/pkg/generated/controllers/k3s.cattle.io/v1" + controllersv1 "github.com/k3s-io/api/pkg/generated/controllers/k3s.cattle.io/v1" "github.com/k3s-io/k3s/pkg/util" "github.com/k3s-io/k3s/pkg/version" "github.com/pkg/errors" diff --git a/pkg/etcd/snapshot_handler.go b/pkg/etcd/snapshot_handler.go index 23eefbc4c4..929376fecc 100644 --- a/pkg/etcd/snapshot_handler.go +++ b/pkg/etcd/snapshot_handler.go @@ -7,7 +7,7 @@ import ( "io" "net/http" - k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" + k3s "github.com/k3s-io/api/k3s.cattle.io/v1" "github.com/k3s-io/k3s/pkg/cluster/managed" "github.com/k3s-io/k3s/pkg/daemons/config" "github.com/k3s-io/k3s/pkg/util" diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go deleted file mode 100644 index 00c5f4fd7e..0000000000 --- a/pkg/generated/clientset/versioned/clientset.go +++ /dev/null @@ -1,120 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package versioned - -import ( - "fmt" - "net/http" - - k3sv1 "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1" - discovery "k8s.io/client-go/discovery" - rest "k8s.io/client-go/rest" - flowcontrol "k8s.io/client-go/util/flowcontrol" -) - -type Interface interface { - Discovery() discovery.DiscoveryInterface - K3sV1() k3sv1.K3sV1Interface -} - -// Clientset contains the clients for groups. -type Clientset struct { - *discovery.DiscoveryClient - k3sV1 *k3sv1.K3sV1Client -} - -// K3sV1 retrieves the K3sV1Client -func (c *Clientset) K3sV1() k3sv1.K3sV1Interface { - return c.k3sV1 -} - -// Discovery retrieves the DiscoveryClient -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - if c == nil { - return nil - } - return c.DiscoveryClient -} - -// NewForConfig creates a new Clientset for the given config. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfig will generate a rate-limiter in configShallowCopy. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*Clientset, error) { - configShallowCopy := *c - - if configShallowCopy.UserAgent == "" { - configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() - } - - // share the transport between all clients - httpClient, err := rest.HTTPClientFor(&configShallowCopy) - if err != nil { - return nil, err - } - - return NewForConfigAndClient(&configShallowCopy, httpClient) -} - -// NewForConfigAndClient creates a new Clientset for the given config and http client. -// Note the http client provided takes precedence over the configured transport values. -// If config's RateLimiter is not set and QPS and Burst are acceptable, -// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. -func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { - configShallowCopy := *c - if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { - if configShallowCopy.Burst <= 0 { - return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") - } - configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) - } - - var cs Clientset - var err error - cs.k3sV1, err = k3sv1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - - cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - return &cs, nil -} - -// NewForConfigOrDie creates a new Clientset for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *Clientset { - cs, err := NewForConfig(c) - if err != nil { - panic(err) - } - return cs -} - -// New creates a new Clientset for the given RESTClient. -func New(c rest.Interface) *Clientset { - var cs Clientset - cs.k3sV1 = k3sv1.New(c) - - cs.DiscoveryClient = discovery.NewDiscoveryClient(c) - return &cs -} diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index f910d553e8..0000000000 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package fake - -import ( - clientset "github.com/k3s-io/k3s/pkg/generated/clientset/versioned" - k3sv1 "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1" - fakek3sv1 "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/discovery" - fakediscovery "k8s.io/client-go/discovery/fake" - "k8s.io/client-go/testing" -) - -// NewSimpleClientset returns a clientset that will respond with the provided objects. -// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, -// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement -// for a real clientset and is mostly useful in simple unit tests. -// -// DEPRECATED: NewClientset replaces this with support for field management, which significantly improves -// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. -// via --with-applyconfig). -func NewSimpleClientset(objects ...runtime.Object) *Clientset { - o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) - for _, obj := range objects { - if err := o.Add(obj); err != nil { - panic(err) - } - } - - cs := &Clientset{tracker: o} - cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} - cs.AddReactor("*", "*", testing.ObjectReaction(o)) - cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { - gvr := action.GetResource() - ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) - if err != nil { - return false, nil, err - } - return true, watch, nil - }) - - return cs -} - -// Clientset implements clientset.Interface. Meant to be embedded into a -// struct to get a default implementation. This makes faking out just the method -// you want to test easier. -type Clientset struct { - testing.Fake - discovery *fakediscovery.FakeDiscovery - tracker testing.ObjectTracker -} - -func (c *Clientset) Discovery() discovery.DiscoveryInterface { - return c.discovery -} - -func (c *Clientset) Tracker() testing.ObjectTracker { - return c.tracker -} - -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) - -// K3sV1 retrieves the K3sV1Client -func (c *Clientset) K3sV1() k3sv1.K3sV1Interface { - return &fakek3sv1.FakeK3sV1{Fake: &c.Fake} -} diff --git a/pkg/generated/clientset/versioned/fake/doc.go b/pkg/generated/clientset/versioned/fake/doc.go deleted file mode 100644 index 8aaca0c7c5..0000000000 --- a/pkg/generated/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go deleted file mode 100644 index 0f8c18e7cb..0000000000 --- a/pkg/generated/clientset/versioned/fake/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package fake - -import ( - k3sv1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var scheme = runtime.NewScheme() -var codecs = serializer.NewCodecFactory(scheme) - -var localSchemeBuilder = runtime.SchemeBuilder{ - k3sv1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(scheme)) -} diff --git a/pkg/generated/clientset/versioned/scheme/doc.go b/pkg/generated/clientset/versioned/scheme/doc.go deleted file mode 100644 index 6bd144ec29..0000000000 --- a/pkg/generated/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go deleted file mode 100644 index fb9c8a0130..0000000000 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package scheme - -import ( - k3sv1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - schema "k8s.io/apimachinery/pkg/runtime/schema" - serializer "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" -) - -var Scheme = runtime.NewScheme() -var Codecs = serializer.NewCodecFactory(Scheme) -var ParameterCodec = runtime.NewParameterCodec(Scheme) -var localSchemeBuilder = runtime.SchemeBuilder{ - k3sv1.AddToScheme, -} - -// AddToScheme adds all types of this clientset into the given scheme. This allows composition -// of clientsets, like in: -// -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) -// -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) -// -// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types -// correctly. -var AddToScheme = localSchemeBuilder.AddToScheme - -func init() { - v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) - utilruntime.Must(AddToScheme(Scheme)) -} diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/addon.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/addon.go deleted file mode 100644 index 7eaa80a9f6..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/addon.go +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -import ( - "context" - - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - scheme "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - gentype "k8s.io/client-go/gentype" -) - -// AddonsGetter has a method to return a AddonInterface. -// A group's client should implement this interface. -type AddonsGetter interface { - Addons(namespace string) AddonInterface -} - -// AddonInterface has methods to work with Addon resources. -type AddonInterface interface { - Create(ctx context.Context, addon *v1.Addon, opts metav1.CreateOptions) (*v1.Addon, error) - Update(ctx context.Context, addon *v1.Addon, opts metav1.UpdateOptions) (*v1.Addon, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.Addon, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.AddonList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Addon, err error) - AddonExpansion -} - -// addons implements AddonInterface -type addons struct { - *gentype.ClientWithList[*v1.Addon, *v1.AddonList] -} - -// newAddons returns a Addons -func newAddons(c *K3sV1Client, namespace string) *addons { - return &addons{ - gentype.NewClientWithList[*v1.Addon, *v1.AddonList]( - "addons", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *v1.Addon { return &v1.Addon{} }, - func() *v1.AddonList { return &v1.AddonList{} }), - } -} diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/doc.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/doc.go deleted file mode 100644 index 761c8c49d4..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/etcdsnapshotfile.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/etcdsnapshotfile.go deleted file mode 100644 index 4e515e9d2c..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/etcdsnapshotfile.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -import ( - "context" - - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - scheme "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/scheme" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - gentype "k8s.io/client-go/gentype" -) - -// ETCDSnapshotFilesGetter has a method to return a ETCDSnapshotFileInterface. -// A group's client should implement this interface. -type ETCDSnapshotFilesGetter interface { - ETCDSnapshotFiles() ETCDSnapshotFileInterface -} - -// ETCDSnapshotFileInterface has methods to work with ETCDSnapshotFile resources. -type ETCDSnapshotFileInterface interface { - Create(ctx context.Context, eTCDSnapshotFile *v1.ETCDSnapshotFile, opts metav1.CreateOptions) (*v1.ETCDSnapshotFile, error) - Update(ctx context.Context, eTCDSnapshotFile *v1.ETCDSnapshotFile, opts metav1.UpdateOptions) (*v1.ETCDSnapshotFile, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, eTCDSnapshotFile *v1.ETCDSnapshotFile, opts metav1.UpdateOptions) (*v1.ETCDSnapshotFile, error) - Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error - Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ETCDSnapshotFile, error) - List(ctx context.Context, opts metav1.ListOptions) (*v1.ETCDSnapshotFileList, error) - Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ETCDSnapshotFile, err error) - ETCDSnapshotFileExpansion -} - -// eTCDSnapshotFiles implements ETCDSnapshotFileInterface -type eTCDSnapshotFiles struct { - *gentype.ClientWithList[*v1.ETCDSnapshotFile, *v1.ETCDSnapshotFileList] -} - -// newETCDSnapshotFiles returns a ETCDSnapshotFiles -func newETCDSnapshotFiles(c *K3sV1Client) *eTCDSnapshotFiles { - return &eTCDSnapshotFiles{ - gentype.NewClientWithList[*v1.ETCDSnapshotFile, *v1.ETCDSnapshotFileList]( - "etcdsnapshotfiles", - c.RESTClient(), - scheme.ParameterCodec, - "", - func() *v1.ETCDSnapshotFile { return &v1.ETCDSnapshotFile{} }, - func() *v1.ETCDSnapshotFileList { return &v1.ETCDSnapshotFileList{} }), - } -} diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/doc.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/doc.go deleted file mode 100644 index ccad4cbc1c..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_addon.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_addon.go deleted file mode 100644 index f89aa1ef91..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_addon.go +++ /dev/null @@ -1,134 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - metav1 "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" -) - -// FakeAddons implements AddonInterface -type FakeAddons struct { - Fake *FakeK3sV1 - ns string -} - -var addonsResource = v1.SchemeGroupVersion.WithResource("addons") - -var addonsKind = v1.SchemeGroupVersion.WithKind("Addon") - -// Get takes name of the addon, and returns the corresponding addon object, and an error if there is any. -func (c *FakeAddons) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Addon, err error) { - emptyResult := &v1.Addon{} - obj, err := c.Fake. - Invokes(testing.NewGetActionWithOptions(addonsResource, c.ns, name, options), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1.Addon), err -} - -// List takes label and field selectors, and returns the list of Addons that match those selectors. -func (c *FakeAddons) List(ctx context.Context, opts metav1.ListOptions) (result *v1.AddonList, err error) { - emptyResult := &v1.AddonList{} - obj, err := c.Fake. - Invokes(testing.NewListActionWithOptions(addonsResource, addonsKind, c.ns, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.AddonList{ListMeta: obj.(*v1.AddonList).ListMeta} - for _, item := range obj.(*v1.AddonList).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 addons. -func (c *FakeAddons) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchActionWithOptions(addonsResource, c.ns, opts)) - -} - -// Create takes the representation of a addon and creates it. Returns the server's representation of the addon, and an error, if there is any. -func (c *FakeAddons) Create(ctx context.Context, addon *v1.Addon, opts metav1.CreateOptions) (result *v1.Addon, err error) { - emptyResult := &v1.Addon{} - obj, err := c.Fake. - Invokes(testing.NewCreateActionWithOptions(addonsResource, c.ns, addon, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1.Addon), err -} - -// Update takes the representation of a addon and updates it. Returns the server's representation of the addon, and an error, if there is any. -func (c *FakeAddons) Update(ctx context.Context, addon *v1.Addon, opts metav1.UpdateOptions) (result *v1.Addon, err error) { - emptyResult := &v1.Addon{} - obj, err := c.Fake. - Invokes(testing.NewUpdateActionWithOptions(addonsResource, c.ns, addon, opts), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1.Addon), err -} - -// Delete takes name of the addon and deletes it. Returns an error if one occurs. -func (c *FakeAddons) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(addonsResource, c.ns, name, opts), &v1.Addon{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeAddons) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewDeleteCollectionActionWithOptions(addonsResource, c.ns, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1.AddonList{}) - return err -} - -// Patch applies the patch and returns the patched addon. -func (c *FakeAddons) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Addon, err error) { - emptyResult := &v1.Addon{} - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceActionWithOptions(addonsResource, c.ns, name, pt, data, opts, subresources...), emptyResult) - - if obj == nil { - return emptyResult, err - } - return obj.(*v1.Addon), err -} diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_etcdsnapshotfile.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_etcdsnapshotfile.go deleted file mode 100644 index b008003cc4..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_etcdsnapshotfile.go +++ /dev/null @@ -1,138 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package fake - -import ( - "context" - - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - metav1 "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" -) - -// FakeETCDSnapshotFiles implements ETCDSnapshotFileInterface -type FakeETCDSnapshotFiles struct { - Fake *FakeK3sV1 -} - -var etcdsnapshotfilesResource = v1.SchemeGroupVersion.WithResource("etcdsnapshotfiles") - -var etcdsnapshotfilesKind = v1.SchemeGroupVersion.WithKind("ETCDSnapshotFile") - -// Get takes name of the eTCDSnapshotFile, and returns the corresponding eTCDSnapshotFile object, and an error if there is any. -func (c *FakeETCDSnapshotFiles) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ETCDSnapshotFile, err error) { - emptyResult := &v1.ETCDSnapshotFile{} - obj, err := c.Fake. - Invokes(testing.NewRootGetActionWithOptions(etcdsnapshotfilesResource, name, options), emptyResult) - if obj == nil { - return emptyResult, err - } - return obj.(*v1.ETCDSnapshotFile), err -} - -// List takes label and field selectors, and returns the list of ETCDSnapshotFiles that match those selectors. -func (c *FakeETCDSnapshotFiles) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ETCDSnapshotFileList, err error) { - emptyResult := &v1.ETCDSnapshotFileList{} - obj, err := c.Fake. - Invokes(testing.NewRootListActionWithOptions(etcdsnapshotfilesResource, etcdsnapshotfilesKind, opts), emptyResult) - if obj == nil { - return emptyResult, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1.ETCDSnapshotFileList{ListMeta: obj.(*v1.ETCDSnapshotFileList).ListMeta} - for _, item := range obj.(*v1.ETCDSnapshotFileList).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 eTCDSnapshotFiles. -func (c *FakeETCDSnapshotFiles) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewRootWatchActionWithOptions(etcdsnapshotfilesResource, opts)) -} - -// Create takes the representation of a eTCDSnapshotFile and creates it. Returns the server's representation of the eTCDSnapshotFile, and an error, if there is any. -func (c *FakeETCDSnapshotFiles) Create(ctx context.Context, eTCDSnapshotFile *v1.ETCDSnapshotFile, opts metav1.CreateOptions) (result *v1.ETCDSnapshotFile, err error) { - emptyResult := &v1.ETCDSnapshotFile{} - obj, err := c.Fake. - Invokes(testing.NewRootCreateActionWithOptions(etcdsnapshotfilesResource, eTCDSnapshotFile, opts), emptyResult) - if obj == nil { - return emptyResult, err - } - return obj.(*v1.ETCDSnapshotFile), err -} - -// Update takes the representation of a eTCDSnapshotFile and updates it. Returns the server's representation of the eTCDSnapshotFile, and an error, if there is any. -func (c *FakeETCDSnapshotFiles) Update(ctx context.Context, eTCDSnapshotFile *v1.ETCDSnapshotFile, opts metav1.UpdateOptions) (result *v1.ETCDSnapshotFile, err error) { - emptyResult := &v1.ETCDSnapshotFile{} - obj, err := c.Fake. - Invokes(testing.NewRootUpdateActionWithOptions(etcdsnapshotfilesResource, eTCDSnapshotFile, opts), emptyResult) - if obj == nil { - return emptyResult, err - } - return obj.(*v1.ETCDSnapshotFile), 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 *FakeETCDSnapshotFiles) UpdateStatus(ctx context.Context, eTCDSnapshotFile *v1.ETCDSnapshotFile, opts metav1.UpdateOptions) (result *v1.ETCDSnapshotFile, err error) { - emptyResult := &v1.ETCDSnapshotFile{} - obj, err := c.Fake. - Invokes(testing.NewRootUpdateSubresourceActionWithOptions(etcdsnapshotfilesResource, "status", eTCDSnapshotFile, opts), emptyResult) - if obj == nil { - return emptyResult, err - } - return obj.(*v1.ETCDSnapshotFile), err -} - -// Delete takes name of the eTCDSnapshotFile and deletes it. Returns an error if one occurs. -func (c *FakeETCDSnapshotFiles) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewRootDeleteActionWithOptions(etcdsnapshotfilesResource, name, opts), &v1.ETCDSnapshotFile{}) - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeETCDSnapshotFiles) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { - action := testing.NewRootDeleteCollectionActionWithOptions(etcdsnapshotfilesResource, opts, listOpts) - - _, err := c.Fake.Invokes(action, &v1.ETCDSnapshotFileList{}) - return err -} - -// Patch applies the patch and returns the patched eTCDSnapshotFile. -func (c *FakeETCDSnapshotFiles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ETCDSnapshotFile, err error) { - emptyResult := &v1.ETCDSnapshotFile{} - obj, err := c.Fake. - Invokes(testing.NewRootPatchSubresourceActionWithOptions(etcdsnapshotfilesResource, name, pt, data, opts, subresources...), emptyResult) - if obj == nil { - return emptyResult, err - } - return obj.(*v1.ETCDSnapshotFile), err -} diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_k3s.cattle.io_client.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_k3s.cattle.io_client.go deleted file mode 100644 index 7167f94bf9..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_k3s.cattle.io_client.go +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package fake - -import ( - v1 "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeK3sV1 struct { - *testing.Fake -} - -func (c *FakeK3sV1) Addons(namespace string) v1.AddonInterface { - return &FakeAddons{c, namespace} -} - -func (c *FakeK3sV1) ETCDSnapshotFiles() v1.ETCDSnapshotFileInterface { - return &FakeETCDSnapshotFiles{c} -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeK3sV1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/generated_expansion.go deleted file mode 100644 index d152245a29..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/generated_expansion.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -type AddonExpansion interface{} - -type ETCDSnapshotFileExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/k3s.cattle.io_client.go b/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/k3s.cattle.io_client.go deleted file mode 100644 index 77bd599332..0000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/k3s.cattle.io_client.go +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -import ( - "net/http" - - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/scheme" - rest "k8s.io/client-go/rest" -) - -type K3sV1Interface interface { - RESTClient() rest.Interface - AddonsGetter - ETCDSnapshotFilesGetter -} - -// K3sV1Client is used to interact with features provided by the k3s.cattle.io group. -type K3sV1Client struct { - restClient rest.Interface -} - -func (c *K3sV1Client) Addons(namespace string) AddonInterface { - return newAddons(c, namespace) -} - -func (c *K3sV1Client) ETCDSnapshotFiles() ETCDSnapshotFileInterface { - return newETCDSnapshotFiles(c) -} - -// NewForConfig creates a new K3sV1Client for the given config. -// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), -// where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*K3sV1Client, 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 K3sV1Client 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) (*K3sV1Client, 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 &K3sV1Client{client}, nil -} - -// NewForConfigOrDie creates a new K3sV1Client for the given config and -// panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *K3sV1Client { - client, err := NewForConfig(c) - if err != nil { - panic(err) - } - return client -} - -// New creates a new K3sV1Client for the given RESTClient. -func New(c rest.Interface) *K3sV1Client { - return &K3sV1Client{c} -} - -func setConfigDefaults(config *rest.Config) error { - gv := v1.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 *K3sV1Client) RESTClient() rest.Interface { - if c == nil { - return nil - } - return c.restClient -} diff --git a/pkg/generated/controllers/k3s.cattle.io/factory.go b/pkg/generated/controllers/k3s.cattle.io/factory.go deleted file mode 100644 index 507a9e116c..0000000000 --- a/pkg/generated/controllers/k3s.cattle.io/factory.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package k3s - -import ( - "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v3/pkg/generic" - "k8s.io/client-go/rest" -) - -type Factory struct { - *generic.Factory -} - -func NewFactoryFromConfigOrDie(config *rest.Config) *Factory { - f, err := NewFactoryFromConfig(config) - if err != nil { - panic(err) - } - return f -} - -func NewFactoryFromConfig(config *rest.Config) (*Factory, error) { - return NewFactoryFromConfigWithOptions(config, nil) -} - -func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace string) (*Factory, error) { - return NewFactoryFromConfigWithOptions(config, &FactoryOptions{ - Namespace: namespace, - }) -} - -type FactoryOptions = generic.FactoryOptions - -func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryOptions) (*Factory, error) { - f, err := generic.NewFactoryFromConfigWithOptions(config, opts) - return &Factory{ - Factory: f, - }, err -} - -func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOptions) *Factory { - f, err := NewFactoryFromConfigWithOptions(config, opts) - if err != nil { - panic(err) - } - return f -} - -func (c *Factory) K3s() Interface { - return New(c.ControllerFactory()) -} - -func (c *Factory) WithAgent(userAgent string) Interface { - return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory())) -} diff --git a/pkg/generated/controllers/k3s.cattle.io/interface.go b/pkg/generated/controllers/k3s.cattle.io/interface.go deleted file mode 100644 index 9e54be64f8..0000000000 --- a/pkg/generated/controllers/k3s.cattle.io/interface.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package k3s - -import ( - v1 "github.com/k3s-io/k3s/pkg/generated/controllers/k3s.cattle.io/v1" - "github.com/rancher/lasso/pkg/controller" -) - -type Interface interface { - V1() v1.Interface -} - -type group struct { - controllerFactory controller.SharedControllerFactory -} - -// New returns a new Interface. -func New(controllerFactory controller.SharedControllerFactory) Interface { - return &group{ - controllerFactory: controllerFactory, - } -} - -func (g *group) V1() v1.Interface { - return v1.New(g.controllerFactory) -} diff --git a/pkg/generated/controllers/k3s.cattle.io/v1/addon.go b/pkg/generated/controllers/k3s.cattle.io/v1/addon.go deleted file mode 100644 index 7c6797b855..0000000000 --- a/pkg/generated/controllers/k3s.cattle.io/v1/addon.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - "github.com/rancher/wrangler/v3/pkg/generic" -) - -// AddonController interface for managing Addon resources. -type AddonController interface { - generic.ControllerInterface[*v1.Addon, *v1.AddonList] -} - -// AddonClient interface for managing Addon resources in Kubernetes. -type AddonClient interface { - generic.ClientInterface[*v1.Addon, *v1.AddonList] -} - -// AddonCache interface for retrieving Addon resources in memory. -type AddonCache interface { - generic.CacheInterface[*v1.Addon] -} diff --git a/pkg/generated/controllers/k3s.cattle.io/v1/etcdsnapshotfile.go b/pkg/generated/controllers/k3s.cattle.io/v1/etcdsnapshotfile.go deleted file mode 100644 index 4508f6e61d..0000000000 --- a/pkg/generated/controllers/k3s.cattle.io/v1/etcdsnapshotfile.go +++ /dev/null @@ -1,208 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -import ( - "context" - "sync" - "time" - - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - "github.com/rancher/wrangler/v3/pkg/apply" - "github.com/rancher/wrangler/v3/pkg/condition" - "github.com/rancher/wrangler/v3/pkg/generic" - "github.com/rancher/wrangler/v3/pkg/kv" - "k8s.io/apimachinery/pkg/api/equality" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -// ETCDSnapshotFileController interface for managing ETCDSnapshotFile resources. -type ETCDSnapshotFileController interface { - generic.NonNamespacedControllerInterface[*v1.ETCDSnapshotFile, *v1.ETCDSnapshotFileList] -} - -// ETCDSnapshotFileClient interface for managing ETCDSnapshotFile resources in Kubernetes. -type ETCDSnapshotFileClient interface { - generic.NonNamespacedClientInterface[*v1.ETCDSnapshotFile, *v1.ETCDSnapshotFileList] -} - -// ETCDSnapshotFileCache interface for retrieving ETCDSnapshotFile resources in memory. -type ETCDSnapshotFileCache interface { - generic.NonNamespacedCacheInterface[*v1.ETCDSnapshotFile] -} - -// ETCDSnapshotFileStatusHandler is executed for every added or modified ETCDSnapshotFile. Should return the new status to be updated -type ETCDSnapshotFileStatusHandler func(obj *v1.ETCDSnapshotFile, status v1.ETCDSnapshotStatus) (v1.ETCDSnapshotStatus, error) - -// ETCDSnapshotFileGeneratingHandler is the top-level handler that is executed for every ETCDSnapshotFile event. It extends ETCDSnapshotFileStatusHandler by a returning a slice of child objects to be passed to apply.Apply -type ETCDSnapshotFileGeneratingHandler func(obj *v1.ETCDSnapshotFile, status v1.ETCDSnapshotStatus) ([]runtime.Object, v1.ETCDSnapshotStatus, error) - -// RegisterETCDSnapshotFileStatusHandler configures a ETCDSnapshotFileController to execute a ETCDSnapshotFileStatusHandler for every events observed. -// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution -func RegisterETCDSnapshotFileStatusHandler(ctx context.Context, controller ETCDSnapshotFileController, condition condition.Cond, name string, handler ETCDSnapshotFileStatusHandler) { - statusHandler := &eTCDSnapshotFileStatusHandler{ - client: controller, - condition: condition, - handler: handler, - } - controller.AddGenericHandler(ctx, name, generic.FromObjectHandlerToHandler(statusHandler.sync)) -} - -// RegisterETCDSnapshotFileGeneratingHandler configures a ETCDSnapshotFileController to execute a ETCDSnapshotFileGeneratingHandler for every events observed, passing the returned objects to the provided apply.Apply. -// If a non-empty condition is provided, it will be updated in the status conditions for every handler execution -func RegisterETCDSnapshotFileGeneratingHandler(ctx context.Context, controller ETCDSnapshotFileController, apply apply.Apply, - condition condition.Cond, name string, handler ETCDSnapshotFileGeneratingHandler, opts *generic.GeneratingHandlerOptions) { - statusHandler := &eTCDSnapshotFileGeneratingHandler{ - ETCDSnapshotFileGeneratingHandler: handler, - apply: apply, - name: name, - gvk: controller.GroupVersionKind(), - } - if opts != nil { - statusHandler.opts = *opts - } - controller.OnChange(ctx, name, statusHandler.Remove) - RegisterETCDSnapshotFileStatusHandler(ctx, controller, condition, name, statusHandler.Handle) -} - -type eTCDSnapshotFileStatusHandler struct { - client ETCDSnapshotFileClient - condition condition.Cond - handler ETCDSnapshotFileStatusHandler -} - -// sync is executed on every resource addition or modification. Executes the configured handlers and sends the updated status to the Kubernetes API -func (a *eTCDSnapshotFileStatusHandler) sync(key string, obj *v1.ETCDSnapshotFile) (*v1.ETCDSnapshotFile, error) { - if obj == nil { - return obj, nil - } - - origStatus := obj.Status.DeepCopy() - obj = obj.DeepCopy() - newStatus, err := a.handler(obj, obj.Status) - if err != nil { - // Revert to old status on error - newStatus = *origStatus.DeepCopy() - } - - if a.condition != "" { - if errors.IsConflict(err) { - a.condition.SetError(&newStatus, "", nil) - } else { - a.condition.SetError(&newStatus, "", err) - } - } - if !equality.Semantic.DeepEqual(origStatus, &newStatus) { - if a.condition != "" { - // Since status has changed, update the lastUpdatedTime - a.condition.LastUpdated(&newStatus, time.Now().UTC().Format(time.RFC3339)) - } - - var newErr error - obj.Status = newStatus - newObj, newErr := a.client.UpdateStatus(obj) - if err == nil { - err = newErr - } - if newErr == nil { - obj = newObj - } - } - return obj, err -} - -type eTCDSnapshotFileGeneratingHandler struct { - ETCDSnapshotFileGeneratingHandler - apply apply.Apply - opts generic.GeneratingHandlerOptions - gvk schema.GroupVersionKind - name string - seen sync.Map -} - -// Remove handles the observed deletion of a resource, cascade deleting every associated resource previously applied -func (a *eTCDSnapshotFileGeneratingHandler) Remove(key string, obj *v1.ETCDSnapshotFile) (*v1.ETCDSnapshotFile, error) { - if obj != nil { - return obj, nil - } - - obj = &v1.ETCDSnapshotFile{} - obj.Namespace, obj.Name = kv.RSplit(key, "/") - obj.SetGroupVersionKind(a.gvk) - - if a.opts.UniqueApplyForResourceVersion { - a.seen.Delete(key) - } - - return nil, generic.ConfigureApplyForObject(a.apply, obj, &a.opts). - WithOwner(obj). - WithSetID(a.name). - ApplyObjects() -} - -// Handle executes the configured ETCDSnapshotFileGeneratingHandler and pass the resulting objects to apply.Apply, finally returning the new status of the resource -func (a *eTCDSnapshotFileGeneratingHandler) Handle(obj *v1.ETCDSnapshotFile, status v1.ETCDSnapshotStatus) (v1.ETCDSnapshotStatus, error) { - if !obj.DeletionTimestamp.IsZero() { - return status, nil - } - - objs, newStatus, err := a.ETCDSnapshotFileGeneratingHandler(obj, status) - if err != nil { - return newStatus, err - } - if !a.isNewResourceVersion(obj) { - return newStatus, nil - } - - err = generic.ConfigureApplyForObject(a.apply, obj, &a.opts). - WithOwner(obj). - WithSetID(a.name). - ApplyObjects(objs...) - if err != nil { - return newStatus, err - } - a.storeResourceVersion(obj) - return newStatus, nil -} - -// isNewResourceVersion detects if a specific resource version was already successfully processed. -// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions -func (a *eTCDSnapshotFileGeneratingHandler) isNewResourceVersion(obj *v1.ETCDSnapshotFile) bool { - if !a.opts.UniqueApplyForResourceVersion { - return true - } - - // Apply once per resource version - key := obj.Namespace + "/" + obj.Name - previous, ok := a.seen.Load(key) - return !ok || previous != obj.ResourceVersion -} - -// storeResourceVersion keeps track of the latest resource version of an object for which Apply was executed -// Only used if UniqueApplyForResourceVersion is set in generic.GeneratingHandlerOptions -func (a *eTCDSnapshotFileGeneratingHandler) storeResourceVersion(obj *v1.ETCDSnapshotFile) { - if !a.opts.UniqueApplyForResourceVersion { - return - } - - key := obj.Namespace + "/" + obj.Name - a.seen.Store(key, obj.ResourceVersion) -} diff --git a/pkg/generated/controllers/k3s.cattle.io/v1/interface.go b/pkg/generated/controllers/k3s.cattle.io/v1/interface.go deleted file mode 100644 index 0575cbe5d9..0000000000 --- a/pkg/generated/controllers/k3s.cattle.io/v1/interface.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -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 main. DO NOT EDIT. - -package v1 - -import ( - v1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v3/pkg/generic" - "github.com/rancher/wrangler/v3/pkg/schemes" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -func init() { - schemes.Register(v1.AddToScheme) -} - -type Interface interface { - Addon() AddonController - ETCDSnapshotFile() ETCDSnapshotFileController -} - -func New(controllerFactory controller.SharedControllerFactory) Interface { - return &version{ - controllerFactory: controllerFactory, - } -} - -type version struct { - controllerFactory controller.SharedControllerFactory -} - -func (v *version) Addon() AddonController { - return generic.NewController[*v1.Addon, *v1.AddonList](schema.GroupVersionKind{Group: "k3s.cattle.io", Version: "v1", Kind: "Addon"}, "addons", true, v.controllerFactory) -} - -func (v *version) ETCDSnapshotFile() ETCDSnapshotFileController { - return generic.NewNonNamespacedController[*v1.ETCDSnapshotFile, *v1.ETCDSnapshotFileList](schema.GroupVersionKind{Group: "k3s.cattle.io", Version: "v1", Kind: "ETCDSnapshotFile"}, "etcdsnapshotfiles", v.controllerFactory) -} diff --git a/pkg/secretsencrypt/config.go b/pkg/secretsencrypt/config.go index 7d2f2e4a72..f5c95e8f77 100644 --- a/pkg/secretsencrypt/config.go +++ b/pkg/secretsencrypt/config.go @@ -16,7 +16,7 @@ import ( "github.com/prometheus/common/expfmt" corev1 "k8s.io/api/core/v1" - "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/scheme" + "github.com/k3s-io/api/pkg/generated/clientset/versioned/scheme" "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" diff --git a/pkg/server/context.go b/pkg/server/context.go index fb4928e8f1..3ff005d835 100644 --- a/pkg/server/context.go +++ b/pkg/server/context.go @@ -6,7 +6,7 @@ import ( helmcrd "github.com/k3s-io/helm-controller/pkg/crd" "github.com/k3s-io/helm-controller/pkg/generated/controllers/helm.cattle.io" addoncrd "github.com/k3s-io/k3s/pkg/crd" - "github.com/k3s-io/k3s/pkg/generated/controllers/k3s.cattle.io" + "github.com/k3s-io/api/pkg/generated/controllers/k3s.cattle.io" "github.com/k3s-io/k3s/pkg/util" "github.com/k3s-io/k3s/pkg/version" "github.com/pkg/errors" diff --git a/pkg/util/apierrors.go b/pkg/util/apierrors.go index 8650dbe01d..ad64ada2d1 100644 --- a/pkg/util/apierrors.go +++ b/pkg/util/apierrors.go @@ -6,7 +6,7 @@ import ( "math/big" "net/http" - "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/scheme" + "github.com/k3s-io/api/pkg/generated/clientset/versioned/scheme" "github.com/pkg/errors" "github.com/sirupsen/logrus" apierrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/scripts/test-mods b/scripts/test-mods index af7d074302..f4d53950ea 100755 --- a/scripts/test-mods +++ b/scripts/test-mods @@ -1,7 +1,7 @@ #!/bin/bash set -e -x -res=$(go mod edit --json | jq -r '.Replace[] | select(.Old.Path | contains("k8s.io/")) | .New.Path' | grep -vE '^(k8s.io/|github.com/k3s-io/)' | wc -l) +res=$(go mod edit --json | jq -r '.Replace[] | select(.Old.Path | startswith("k8s.io/")) | .New.Path' | grep -vE '^(k8s.io/|github.com/k3s-io/)' | wc -l) if [ $res -gt 0 ];then echo "Incorrect kubernetes replacement fork in go.mod" exit 1