diff --git a/go.mod b/go.mod index a341980671d..b303bd8cdfc 100644 --- a/go.mod +++ b/go.mod @@ -112,6 +112,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 github.com/k3s-io/helm-controller v0.16.6 github.com/k3s-io/kine v0.13.9 github.com/klauspost/compress v1.17.11 @@ -487,14 +488,11 @@ require ( gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.32.2 // indirect - k8s.io/code-generator v0.32.2 // 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/externaljwt v1.32.0 // indirect - k8s.io/gengo v0.0.0-20240911193312-2b36238f13e9 // indirect - k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 // indirect k8s.io/kms v0.0.0 // indirect k8s.io/kube-aggregator v0.32.2 // indirect k8s.io/kube-controller-manager v0.0.0 // indirect diff --git a/go.sum b/go.sum index 97efc3c672d..daeb8ad38da 100644 --- a/go.sum +++ b/go.sum @@ -509,7 +509,6 @@ github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpx github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.3-0.20220714215716-96bad1d688c5 h1:aj5xnNwNY2GCk38Vga4FMm4GSX1bDzu8Z5JcQQdmOqg= @@ -602,7 +601,6 @@ github.com/google/go-containerregistry v0.20.2/go.mod h1:z38EKdKh4h7IP2gSfUUqEva github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= 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= @@ -774,6 +772,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 h1:YxLb/SXPqcZ/rffxrXwK3x4TfuSDxaapADZJDx3BQ50= +github.com/k3s-io/api v0.1.0/go.mod h1:9aQAaTKBFWO+BpGrMFJk9uZaUhZRrL9aahobcOQQm64= github.com/k3s-io/cadvisor v0.51.0-k3s1 h1:g44OgQMVywt+UlcLOu7OW0H32h8XVkc0pm12EPn4bvo= github.com/k3s-io/cadvisor v0.51.0-k3s1/go.mod h1:WmF2AKcyCdI0ERO3oSvLnHmiMOjRvfd2iwvoPc6urHE= github.com/k3s-io/containerd/v2 v2.0.2-k3s2 h1:gikcTRjqQLUELa68fyoVj9KaTWvZiG6hs/ilG+cwHy0= @@ -824,8 +824,6 @@ github.com/k3s-io/kubernetes/staging/src/k8s.io/cloud-provider v1.32.2-k3s1 h1:t github.com/k3s-io/kubernetes/staging/src/k8s.io/cloud-provider v1.32.2-k3s1/go.mod h1:i00dTyZ/eHO4M5eRCmAewmLJt3ong9wQSgq0aI8Xct0= github.com/k3s-io/kubernetes/staging/src/k8s.io/cluster-bootstrap v1.32.2-k3s1 h1:lEN/lz9K1yw6NqqFmJeosTqZJdrBt0FNQgyOAgcFTUc= github.com/k3s-io/kubernetes/staging/src/k8s.io/cluster-bootstrap v1.32.2-k3s1/go.mod h1:suQZratbRPwI8BzyTERpJ65OJ5iBV3sJtVmMZjvz1Vs= -github.com/k3s-io/kubernetes/staging/src/k8s.io/code-generator v1.32.2-k3s1 h1:tmU+P6stiY5sYEWV6Zg3YhL8YseZbDb4TtRYnTrWKUM= -github.com/k3s-io/kubernetes/staging/src/k8s.io/code-generator v1.32.2-k3s1/go.mod h1:BDNsDljkhH/Vbf4d72ZwcjnbV2JgCKjmeP2uas0N7KQ= github.com/k3s-io/kubernetes/staging/src/k8s.io/component-base v1.32.2-k3s1 h1:QYGSL6kmK664A213+aFzVSV/HrSu+/DMmZsPbusLyXI= github.com/k3s-io/kubernetes/staging/src/k8s.io/component-base v1.32.2-k3s1/go.mod h1:CChOHQrvYZHMljmATes9GcQEp4gpzeP+xWlwpf21QC8= github.com/k3s-io/kubernetes/staging/src/k8s.io/component-helpers v1.32.2-k3s1 h1:r2d+m8njXtjVc4EBFO4iDWErcSEEcTNrSsXqUk9gyNs= @@ -1646,7 +1644,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= @@ -1844,10 +1841,6 @@ 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.32.2 h1:vjowJUyu14IbmifqCKJHE9rK/BPSfkXvltqN42W1Zuo= k8s.io/cri-client v0.32.2/go.mod h1:fRZhmmZW16Qviln8hfy+e8dd2wP/n9B6TiGxLE3zBe0= -k8s.io/gengo v0.0.0-20240911193312-2b36238f13e9 h1:B0l8GxRsVc/tP/uCLBQdAjf2nBARx6u/r2OGuL/CyXQ= -k8s.io/gengo v0.0.0-20240911193312-2b36238f13e9/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= -k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9 h1:si3PfKm8dDYxgfbeA6orqrtLkvvIeH8UqffFJDl0bz4= -k8s.io/gengo/v2 v2.0.0-20240911193312-2b36238f13e9/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU= 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= @@ -1906,7 +1899,6 @@ sigs.k8s.io/kustomize/kyaml v0.18.1 h1:WvBo56Wzw3fjS+7vBjN6TeivvpbW9GmRaWZ9CIVmt sigs.k8s.io/kustomize/kyaml v0.18.1/go.mod h1:C3L2BFVU1jgcddNBE1TxuVLgS46TjObMwW5FT9FcjYo= sigs.k8s.io/structured-merge-diff/v4 v4.4.3 h1:sCP7Vv3xx/CWIuTPVN38lUPx0uw0lcLfzaiDa8Ja01A= sigs.k8s.io/structured-merge-diff/v4 v4.4.3/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= -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 74094ccf539..e875940b282 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 7859d13a4df..78ac760b997 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 282cebed4aa..33e001be97f 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 1be22ca5364..00000000000 --- 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 c52e8eee518..00000000000 --- 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 1679c1e7fff..00000000000 --- 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 c00d6ac70ae..00000000000 --- 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 90761711f75..00000000000 --- 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 ffbf9ef6b4a..00000000000 --- 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 876b0ea7dec..a77eeaa6bf2 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 79d9cfa6cce..00000000000 --- 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 616ff1a14b5..c6f8151cbe6 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 a5ab26b53cf..0515419d2d5 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 9a74e95b5db..fe2c5a73e30 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 af96e8fafa4..c80ac7dff13 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 b55daccec8d..76b4c445435 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 970fe336efd..17efc446572 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 fc3c33502de..d855b95b858 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 23eefbc4c45..929376fecc1 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 e912f11371d..00000000000 --- 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 "fmt" - http "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 f910d553e8c..00000000000 --- 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 8aaca0c7c59..00000000000 --- 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 0f8c18e7cbb..00000000000 --- 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 6bd144ec297..00000000000 --- 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 fb9c8a01301..00000000000 --- 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 3afc29ece3d..00000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/addon.go +++ /dev/null @@ -1,68 +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 "context" - - k3scattleiov1 "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 *k3scattleiov1.Addon, opts metav1.CreateOptions) (*k3scattleiov1.Addon, error) - Update(ctx context.Context, addon *k3scattleiov1.Addon, opts metav1.UpdateOptions) (*k3scattleiov1.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) (*k3scattleiov1.Addon, error) - List(ctx context.Context, opts metav1.ListOptions) (*k3scattleiov1.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 *k3scattleiov1.Addon, err error) - AddonExpansion -} - -// addons implements AddonInterface -type addons struct { - *gentype.ClientWithList[*k3scattleiov1.Addon, *k3scattleiov1.AddonList] -} - -// newAddons returns a Addons -func newAddons(c *K3sV1Client, namespace string) *addons { - return &addons{ - gentype.NewClientWithList[*k3scattleiov1.Addon, *k3scattleiov1.AddonList]( - "addons", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *k3scattleiov1.Addon { return &k3scattleiov1.Addon{} }, - func() *k3scattleiov1.AddonList { return &k3scattleiov1.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 761c8c49d49..00000000000 --- 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 42515a27609..00000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/etcdsnapshotfile.go +++ /dev/null @@ -1,70 +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 "context" - - k3scattleiov1 "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 *k3scattleiov1.ETCDSnapshotFile, opts metav1.CreateOptions) (*k3scattleiov1.ETCDSnapshotFile, error) - Update(ctx context.Context, eTCDSnapshotFile *k3scattleiov1.ETCDSnapshotFile, opts metav1.UpdateOptions) (*k3scattleiov1.ETCDSnapshotFile, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, eTCDSnapshotFile *k3scattleiov1.ETCDSnapshotFile, opts metav1.UpdateOptions) (*k3scattleiov1.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) (*k3scattleiov1.ETCDSnapshotFile, error) - List(ctx context.Context, opts metav1.ListOptions) (*k3scattleiov1.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 *k3scattleiov1.ETCDSnapshotFile, err error) - ETCDSnapshotFileExpansion -} - -// eTCDSnapshotFiles implements ETCDSnapshotFileInterface -type eTCDSnapshotFiles struct { - *gentype.ClientWithList[*k3scattleiov1.ETCDSnapshotFile, *k3scattleiov1.ETCDSnapshotFileList] -} - -// newETCDSnapshotFiles returns a ETCDSnapshotFiles -func newETCDSnapshotFiles(c *K3sV1Client) *eTCDSnapshotFiles { - return &eTCDSnapshotFiles{ - gentype.NewClientWithList[*k3scattleiov1.ETCDSnapshotFile, *k3scattleiov1.ETCDSnapshotFileList]( - "etcdsnapshotfiles", - c.RESTClient(), - scheme.ParameterCodec, - "", - func() *k3scattleiov1.ETCDSnapshotFile { return &k3scattleiov1.ETCDSnapshotFile{} }, - func() *k3scattleiov1.ETCDSnapshotFileList { return &k3scattleiov1.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 ccad4cbc1cb..00000000000 --- 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 a5d851ff86e..00000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_addon.go +++ /dev/null @@ -1,48 +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/apis/k3s.cattle.io/v1" - k3scattleiov1 "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1" - gentype "k8s.io/client-go/gentype" -) - -// fakeAddons implements AddonInterface -type fakeAddons struct { - *gentype.FakeClientWithList[*v1.Addon, *v1.AddonList] - Fake *FakeK3sV1 -} - -func newFakeAddons(fake *FakeK3sV1, namespace string) k3scattleiov1.AddonInterface { - return &fakeAddons{ - gentype.NewFakeClientWithList[*v1.Addon, *v1.AddonList]( - fake.Fake, - namespace, - v1.SchemeGroupVersion.WithResource("addons"), - v1.SchemeGroupVersion.WithKind("Addon"), - func() *v1.Addon { return &v1.Addon{} }, - func() *v1.AddonList { return &v1.AddonList{} }, - func(dst, src *v1.AddonList) { dst.ListMeta = src.ListMeta }, - func(list *v1.AddonList) []*v1.Addon { return gentype.ToPointerSlice(list.Items) }, - func(list *v1.AddonList, items []*v1.Addon) { list.Items = gentype.FromPointerSlice(items) }, - ), - fake, - } -} 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 f80396aaafc..00000000000 --- a/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1/fake/fake_etcdsnapshotfile.go +++ /dev/null @@ -1,50 +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/apis/k3s.cattle.io/v1" - k3scattleiov1 "github.com/k3s-io/k3s/pkg/generated/clientset/versioned/typed/k3s.cattle.io/v1" - gentype "k8s.io/client-go/gentype" -) - -// fakeETCDSnapshotFiles implements ETCDSnapshotFileInterface -type fakeETCDSnapshotFiles struct { - *gentype.FakeClientWithList[*v1.ETCDSnapshotFile, *v1.ETCDSnapshotFileList] - Fake *FakeK3sV1 -} - -func newFakeETCDSnapshotFiles(fake *FakeK3sV1) k3scattleiov1.ETCDSnapshotFileInterface { - return &fakeETCDSnapshotFiles{ - gentype.NewFakeClientWithList[*v1.ETCDSnapshotFile, *v1.ETCDSnapshotFileList]( - fake.Fake, - "", - v1.SchemeGroupVersion.WithResource("etcdsnapshotfiles"), - v1.SchemeGroupVersion.WithKind("ETCDSnapshotFile"), - func() *v1.ETCDSnapshotFile { return &v1.ETCDSnapshotFile{} }, - func() *v1.ETCDSnapshotFileList { return &v1.ETCDSnapshotFileList{} }, - func(dst, src *v1.ETCDSnapshotFileList) { dst.ListMeta = src.ListMeta }, - func(list *v1.ETCDSnapshotFileList) []*v1.ETCDSnapshotFile { return gentype.ToPointerSlice(list.Items) }, - func(list *v1.ETCDSnapshotFileList, items []*v1.ETCDSnapshotFile) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} 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 dd7a26e877c..00000000000 --- 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 newFakeAddons(c, namespace) -} - -func (c *FakeK3sV1) ETCDSnapshotFiles() v1.ETCDSnapshotFileInterface { - return newFakeETCDSnapshotFiles(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 d152245a291..00000000000 --- 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 afd51a3af87..00000000000 --- 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 ( - http "net/http" - - k3scattleiov1 "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1" - scheme "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 := k3scattleiov1.SchemeGroupVersion - config.GroupVersion = &gv - config.APIPath = "/apis" - config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, 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 507a9e116c8..00000000000 --- 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 9e54be64f81..00000000000 --- 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 7c6797b8553..00000000000 --- 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 4508f6e61dd..00000000000 --- 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 0575cbe5d9a..00000000000 --- 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 7d2f2e4a725..f5c95e8f778 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 fb4928e8f1a..3ff005d8356 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 8650dbe01d1..ad64ada2d1d 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"