diff --git a/images/sds-local-volume-controller/Dockerfile b/images/sds-local-volume-controller/Dockerfile index b306a05b..698b3434 100644 --- a/images/sds-local-volume-controller/Dockerfile +++ b/images/sds-local-volume-controller/Dockerfile @@ -1,5 +1,5 @@ ARG BASE_ALPINE=registry.deckhouse.io/base_images/alpine:3.16.3@sha256:5548e9172c24a1b0ca9afdd2bf534e265c94b12b36b3e0c0302f5853eaf00abb -ARG BASE_GOLANG_22_ALPINE_BUILDER=registry.deckhouse.io/base_images/golang:1.22.1-alpine@sha256:0de6cf7cceab6ecbf0718bdfb675b08b78113c3709c5e4b99456cdb2ae8c2495 +ARG BASE_GOLANG_22_ALPINE_BUILDER=registry.deckhouse.io/base_images/golang:1.22.3-alpine@sha256:dbf216b880b802c22e3f4f2ef0a78396b4a9a6983cb9b767c5efc351ebf946b0 FROM $BASE_GOLANG_22_ALPINE_BUILDER as builder diff --git a/images/sds-local-volume-controller/api/v1alpha1/local_storage_class.go b/images/sds-local-volume-controller/api/v1alpha1/local_storage_class.go deleted file mode 100644 index e8c8e0ea..00000000 --- a/images/sds-local-volume-controller/api/v1alpha1/local_storage_class.go +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - -type LocalStorageClass struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec LocalStorageClassSpec `json:"spec"` - Status *LocalStorageClassStatus `json:"status,omitempty"` -} - -// LocalStorageClassList contains a list of empty block device -type LocalStorageClassList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - Items []LocalStorageClass `json:"items"` -} - -type LocalStorageClassSpec struct { - ReclaimPolicy string `json:"reclaimPolicy"` - VolumeBindingMode string `json:"volumeBindingMode"` - LVM *LocalStorageClassLVMSpec `json:"lvm,omitempty"` -} - -type LocalStorageClassLVMSpec struct { - Type string `json:"type"` - Thick *LocalStorageClassLVMThickSpec `json:"thick,omitempty"` - LVMVolumeGroups []LocalStorageClassLVG `json:"lvmVolumeGroups"` -} - -type LocalStorageClassStatus struct { - Phase string `json:"phase,omitempty"` - Reason string `json:"reason,omitempty"` -} - -type LocalStorageClassLVG struct { - Name string `json:"name"` - Thin *LocalStorageClassLVMThinPoolSpec `json:"thin,omitempty"` -} - -type LocalStorageClassLVMThinPoolSpec struct { - PoolName string `json:"poolName"` -} - -type LocalStorageClassLVMThickSpec struct { - Contiguous bool `json:"contiguous"` -} diff --git a/images/sds-local-volume-controller/api/v1alpha1/lvm_volume_group.go b/images/sds-local-volume-controller/api/v1alpha1/lvm_volume_group.go deleted file mode 100644 index 70900f72..00000000 --- a/images/sds-local-volume-controller/api/v1alpha1/lvm_volume_group.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type LvmVolumeGroupList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []LvmVolumeGroup `json:"items"` -} - -type LvmVolumeGroup struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LvmVolumeGroupSpec `json:"spec"` - Status LvmVolumeGroupStatus `json:"status,omitempty"` -} - -type LvmVolumeGroupSpec struct { - ActualVGNameOnTheNode string `json:"actualVGNameOnTheNode"` - BlockDeviceNames []string `json:"blockDeviceNames"` - ThinPools []LvmVolumeGroupThinPoolSpec `json:"thinPools"` - Type string `json:"type"` -} - -type LvmVolumeGroupStatus struct { - AllocatedSize resource.Quantity `json:"allocatedSize"` - Nodes []LvmVolumeGroupNode `json:"nodes"` - ThinPools []LvmVolumeGroupThinPoolStatus `json:"thinPools"` - VGSize resource.Quantity `json:"vgSize"` - VGUuid string `json:"vgUUID"` - Phase string `json:"phase"` - Conditions []metav1.Condition `json:"conditions"` - ThinPoolReady string `json:"thinPoolReady"` - ConfigurationApplied string `json:"configurationApplied"` - VGFree resource.Quantity `json:"vgFree"` -} - -type LvmVolumeGroupDevice struct { - BlockDevice string `json:"blockDevice"` - DevSize resource.Quantity `json:"devSize"` - PVSize resource.Quantity `json:"pvSize"` - PVUuid string `json:"pvUUID"` - Path string `json:"path"` -} - -type LvmVolumeGroupNode struct { - Devices []LvmVolumeGroupDevice `json:"devices"` - Name string `json:"name"` -} - -type LvmVolumeGroupThinPoolStatus struct { - Name string `json:"name"` - ActualSize resource.Quantity `json:"actualSize"` - UsedSize resource.Quantity `json:"usedSize"` - AllocatedSize resource.Quantity `json:"allocatedSize"` - AvailableSpace resource.Quantity `json:"availableSpace"` - AllocationLimit string `json:"allocationLimit"` - Ready bool `json:"ready"` - Message string `json:"message"` -} - -type LvmVolumeGroupThinPoolSpec struct { - Name string `json:"name"` - Size resource.Quantity `json:"size"` - AllocationLimit string `json:"allocationLimit"` -} diff --git a/images/sds-local-volume-controller/api/v1alpha1/register.go b/images/sds-local-volume-controller/api/v1alpha1/register.go deleted file mode 100644 index e7a5d0dc..00000000 --- a/images/sds-local-volume-controller/api/v1alpha1/register.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - LocalStorageClassKind = "LocalStorageClass" - APIGroup = "storage.deckhouse.io" - APIVersion = "v1alpha1" -) - -// SchemeGroupVersion is group version used to register these objects -var ( - SchemeGroupVersion = schema.GroupVersion{ - Group: APIGroup, - Version: APIVersion, - } - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &LocalStorageClass{}, - &LocalStorageClassList{}, - &LvmVolumeGroup{}, - &LvmVolumeGroupList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/images/sds-local-volume-controller/api/v1alpha1/sds_local_volume_config.go b/images/sds-local-volume-controller/api/v1alpha1/sds_local_volume_config.go deleted file mode 100644 index ad93d485..00000000 --- a/images/sds-local-volume-controller/api/v1alpha1/sds_local_volume_config.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -type SdsLocalVolumeConfig struct { - NodeSelector map[string]string `yaml:"nodeSelector"` -} diff --git a/images/sds-local-volume-controller/api/v1alpha1/zz_generated.deepcopy.go b/images/sds-local-volume-controller/api/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index abf5c426..00000000 --- a/images/sds-local-volume-controller/api/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,135 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import "k8s.io/apimachinery/pkg/runtime" - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LocalStorageClass) DeepCopyInto(out *LocalStorageClass) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice. -func (in *LocalStorageClass) DeepCopy() *LocalStorageClass { - if in == nil { - return nil - } - out := new(LocalStorageClass) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LocalStorageClass) 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 *LocalStorageClassList) DeepCopyInto(out *LocalStorageClassList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LocalStorageClass, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList. -func (in *LocalStorageClassList) DeepCopy() *LocalStorageClassList { - if in == nil { - return nil - } - out := new(LocalStorageClassList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LocalStorageClassList) 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 *LvmVolumeGroup) DeepCopyInto(out *LvmVolumeGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice. -func (in *LvmVolumeGroup) DeepCopy() *LvmVolumeGroup { - if in == nil { - return nil - } - out := new(LvmVolumeGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroup) 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 *LvmVolumeGroupList) DeepCopyInto(out *LvmVolumeGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LvmVolumeGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList. -func (in *LvmVolumeGroupList) DeepCopy() *LvmVolumeGroupList { - if in == nil { - return nil - } - out := new(LvmVolumeGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} diff --git a/images/sds-local-volume-controller/cmd/main.go b/images/sds-local-volume-controller/cmd/main.go index daf48148..6840ff30 100644 --- a/images/sds-local-volume-controller/cmd/main.go +++ b/images/sds-local-volume-controller/cmd/main.go @@ -19,9 +19,10 @@ package main import ( "context" "fmt" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "os" goruntime "runtime" - "sds-local-volume-controller/api/v1alpha1" "sds-local-volume-controller/pkg/config" "sds-local-volume-controller/pkg/controller" "sds-local-volume-controller/pkg/kubutils" @@ -41,7 +42,8 @@ import ( var ( resourcesSchemeFuncs = []func(*apiruntime.Scheme) error{ - v1alpha1.AddToScheme, + snc.AddToScheme, + slv.AddToScheme, clientgoscheme.AddToScheme, extv1.AddToScheme, v1.AddToScheme, diff --git a/images/sds-local-volume-controller/go.mod b/images/sds-local-volume-controller/go.mod index 36390bfc..f62501d1 100644 --- a/images/sds-local-volume-controller/go.mod +++ b/images/sds-local-volume-controller/go.mod @@ -1,15 +1,17 @@ module sds-local-volume-controller -go 1.22 +go 1.22.2 require ( + github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c + github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36 github.com/go-logr/logr v1.4.2 github.com/onsi/ginkgo/v2 v2.19.0 github.com/onsi/gomega v1.33.1 github.com/stretchr/testify v1.9.0 k8s.io/api v0.29.5 k8s.io/apiextensions-apiserver v0.29.5 - k8s.io/apimachinery v0.29.5 + k8s.io/apimachinery v0.30.2 k8s.io/client-go v0.29.5 k8s.io/klog/v2 v2.120.1 k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 diff --git a/images/sds-local-volume-controller/go.sum b/images/sds-local-volume-controller/go.sum index 03584c3c..53d5df16 100644 --- a/images/sds-local-volume-controller/go.sum +++ b/images/sds-local-volume-controller/go.sum @@ -6,6 +6,10 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c h1:1hZBDe3aKqok/jOnbKfa5CMQ6viL/dsnsHujEaq+oxU= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c/go.mod h1:cYxHYJmIl6g9lXb1etqmLeQL/vsPMgscmact/FObd+U= +github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36 h1:ToJpGIAHud57Fxm5P1oULRibHpcCuysHqg5dgT0aeys= +github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36/go.mod h1:H71+9G0Jr46Qs0BA3z3/xt0h9lbnJnCEYcaCJCWFBf0= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= @@ -172,8 +176,8 @@ k8s.io/api v0.29.5 h1:levS+umUigHCfI3riD36pMY1vQEbrzh4r1ivVWAhHaI= k8s.io/api v0.29.5/go.mod h1:7b18TtPcJzdjk7w5zWyIHgoAtpGeRvGGASxlS7UZXdQ= k8s.io/apiextensions-apiserver v0.29.5 h1:njDywexhE6n+1NEl3A4axT0TMQHREnndrk3/ztdWcNE= k8s.io/apiextensions-apiserver v0.29.5/go.mod h1:pfIvij+MH9a8NQKtW7MD4EFnzvUjJ1ZQsDL8wuP8fnc= -k8s.io/apimachinery v0.29.5 h1:Hofa2BmPfpoT+IyDTlcPdCHSnHtEQMoJYGVoQpRTfv4= -k8s.io/apimachinery v0.29.5/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= k8s.io/client-go v0.29.5 h1:nlASXmPQy190qTteaVP31g3c/wi2kycznkTP7Sv1zPc= k8s.io/client-go v0.29.5/go.mod h1:aY5CnqUUvXYccJhm47XHoPcRyX6vouHdIBHaKZGTbK4= k8s.io/component-base v0.29.5 h1:Ptj8AzG+p8c2a839XriHwxakDpZH9uvIgYz+o1agjg8= diff --git a/images/sds-local-volume-controller/pkg/config/config.go b/images/sds-local-volume-controller/pkg/config/config.go index 040bc3d0..0628ea69 100644 --- a/images/sds-local-volume-controller/pkg/config/config.go +++ b/images/sds-local-volume-controller/pkg/config/config.go @@ -67,3 +67,7 @@ func NewConfig() *Options { return &opts } + +type SdsLocalVolumeConfig struct { + NodeSelector map[string]string `yaml:"nodeSelector"` +} diff --git a/images/sds-local-volume-controller/pkg/controller/controller_suite_test.go b/images/sds-local-volume-controller/pkg/controller/controller_suite_test.go index 816c5825..f2e95627 100644 --- a/images/sds-local-volume-controller/pkg/controller/controller_suite_test.go +++ b/images/sds-local-volume-controller/pkg/controller/controller_suite_test.go @@ -18,8 +18,9 @@ package controller_test import ( "fmt" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "os" - v1alpha1 "sds-local-volume-controller/api/v1alpha1" "testing" v1 "k8s.io/api/apps/v1" @@ -43,7 +44,8 @@ func TestController(t *testing.T) { func NewFakeClient() client.Client { resourcesSchemeFuncs := []func(*apiruntime.Scheme) error{ - v1alpha1.AddToScheme, + slv.AddToScheme, + snc.AddToScheme, clientgoscheme.AddToScheme, extv1.AddToScheme, v1.AddToScheme, @@ -58,8 +60,6 @@ func NewFakeClient() client.Client { } } - // See https://github.com/kubernetes-sigs/controller-runtime/issues/2362#issuecomment-1837270195 - // builder := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(&v1alpha1.NFSStorageClass{}) builder := fake.NewClientBuilder().WithScheme(scheme) cl := builder.Build() return cl diff --git a/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher.go b/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher.go index 2a8d3c64..875744aa 100644 --- a/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher.go +++ b/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher.go @@ -19,14 +19,12 @@ package controller import ( "context" "fmt" - "sds-local-volume-controller/api/v1alpha1" - "sds-local-volume-controller/pkg/config" - "sds-local-volume-controller/pkg/logger" - "strings" - "time" - + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" + "sds-local-volume-controller/pkg/config" + "sds-local-volume-controller/pkg/logger" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" @@ -34,6 +32,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" "sigs.k8s.io/controller-runtime/pkg/source" "sigs.k8s.io/yaml" + "strings" + "time" ) const ( @@ -233,7 +233,7 @@ func reconcileLocalCSILabels(ctx context.Context, cl client.Client, log logger.L } } -func addLabelOnTheLSCIfNotExist(ctx context.Context, cl client.Client, lsc v1alpha1.LocalStorageClass, label string) (bool, error) { +func addLabelOnTheLSCIfNotExist(ctx context.Context, cl client.Client, lsc slv.LocalStorageClass, label string) (bool, error) { if _, exist := lsc.Labels[label]; exist { return false, nil } @@ -251,7 +251,7 @@ func addLabelOnTheLSCIfNotExist(ctx context.Context, cl client.Client, lsc v1alp return true, nil } -func addLabelOnTheLVGIfNotExist(ctx context.Context, cl client.Client, lvg v1alpha1.LvmVolumeGroup, label string) (bool, error) { +func addLabelOnTheLVGIfNotExist(ctx context.Context, cl client.Client, lvg snc.LvmVolumeGroup, label string) (bool, error) { if _, exist := lvg.Labels[label]; exist { return false, nil } @@ -301,12 +301,12 @@ func clearManualEvictionLabelsIfNeeded(ctx context.Context, cl client.Client, lo return err } - lvgs := make(map[string]v1alpha1.LvmVolumeGroup, len(lvgList.Items)) + lvgs := make(map[string]snc.LvmVolumeGroup, len(lvgList.Items)) for _, lvg := range lvgList.Items { lvgs[lvg.Name] = lvg } - usedLvgs := make(map[string]v1alpha1.LvmVolumeGroup, len(lvgList.Items)) + usedLvgs := make(map[string]snc.LvmVolumeGroup, len(lvgList.Items)) for _, lvg := range lvgList.Items { for _, n := range lvg.Status.Nodes { if n.Name == node.Name { @@ -373,13 +373,13 @@ func clearManualEvictionLabelsIfNeeded(ctx context.Context, cl client.Client, lo return nil } -func getManuallyEvictedLVGsAndLSCs(ctx context.Context, cl client.Client, node v1.Node) (map[string]v1alpha1.LvmVolumeGroup, map[string]v1alpha1.LocalStorageClass, error) { +func getManuallyEvictedLVGsAndLSCs(ctx context.Context, cl client.Client, node v1.Node) (map[string]snc.LvmVolumeGroup, map[string]slv.LocalStorageClass, error) { lvgList, err := getLVMVolumeGroups(ctx, cl) if err != nil { return nil, nil, err } - usedLvgs := make(map[string]v1alpha1.LvmVolumeGroup, len(lvgList.Items)) + usedLvgs := make(map[string]snc.LvmVolumeGroup, len(lvgList.Items)) for _, lvg := range lvgList.Items { for _, n := range lvg.Status.Nodes { if n.Name == node.Name { @@ -393,8 +393,8 @@ func getManuallyEvictedLVGsAndLSCs(ctx context.Context, cl client.Client, node v return nil, nil, err } - unhealthyLscs := make(map[string]v1alpha1.LocalStorageClass, len(lscList.Items)) - unhealthyLvgs := make(map[string]v1alpha1.LvmVolumeGroup, len(usedLvgs)) + unhealthyLscs := make(map[string]slv.LocalStorageClass, len(lscList.Items)) + unhealthyLvgs := make(map[string]snc.LvmVolumeGroup, len(usedLvgs)) // This case is a base case, when the controller did not label any resource. for _, lsc := range lscList.Items { @@ -416,15 +416,15 @@ func getManuallyEvictedLVGsAndLSCs(ctx context.Context, cl client.Client, node v return unhealthyLvgs, unhealthyLscs, nil } -func getLVMVolumeGroups(ctx context.Context, cl client.Client) (*v1alpha1.LvmVolumeGroupList, error) { - lvgList := &v1alpha1.LvmVolumeGroupList{} +func getLVMVolumeGroups(ctx context.Context, cl client.Client) (*snc.LvmVolumeGroupList, error) { + lvgList := &snc.LvmVolumeGroupList{} err := cl.List(ctx, lvgList) return lvgList, err } -func getLocalStorageClasses(ctx context.Context, cl client.Client) (*v1alpha1.LocalStorageClassList, error) { - lscList := &v1alpha1.LocalStorageClassList{} +func getLocalStorageClasses(ctx context.Context, cl client.Client) (*slv.LocalStorageClassList, error) { + lscList := &slv.LocalStorageClassList{} err := cl.List(ctx, lscList) return lscList, err } @@ -436,7 +436,7 @@ func getKubeNodes(ctx context.Context, cl client.Client) (*v1.NodeList, error) { } func getNodeSelectorFromConfig(secret *v1.Secret) (map[string]string, error) { - var sdsConfig v1alpha1.SdsLocalVolumeConfig + var sdsConfig config.SdsLocalVolumeConfig err := yaml.Unmarshal(secret.Data["config"], &sdsConfig) if err != nil { return nil, err diff --git a/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher_test.go b/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher_test.go index 20d84a62..96be5c03 100644 --- a/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher_test.go +++ b/images/sds-local-volume-controller/pkg/controller/local_csi_node_watcher_test.go @@ -2,7 +2,8 @@ package controller import ( "context" - "sds-local-volume-controller/api/v1alpha1" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "sds-local-volume-controller/pkg/logger" "testing" @@ -61,12 +62,12 @@ func TestRunLocalCSINodeWatcherController(t *testing.T) { t.Error(err) } - lvgOnNode4 := &v1alpha1.LvmVolumeGroup{ + lvgOnNode4 := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "lvgOnNode4", }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: "test-node4", }, @@ -78,13 +79,13 @@ func TestRunLocalCSINodeWatcherController(t *testing.T) { t.Error(err) } - lsc := &v1alpha1.LocalStorageClass{ + lsc := &slv.LocalStorageClass{ ObjectMeta: metav1.ObjectMeta{ Name: "test-lsc", }, - Spec: v1alpha1.LocalStorageClassSpec{ - LVM: &v1alpha1.LocalStorageClassLVMSpec{ - LVMVolumeGroups: []v1alpha1.LocalStorageClassLVG{ + Spec: slv.LocalStorageClassSpec{ + LVM: &slv.LocalStorageClassLVMSpec{ + LVMVolumeGroups: []slv.LocalStorageClassLVG{ { Name: "lvgOnNode4", }, @@ -188,7 +189,7 @@ func TestRunLocalCSINodeWatcherController(t *testing.T) { _, exist = node4.Labels[localCsiNodeSelectorLabel] assert.True(t, exist) - updateLvg := &v1alpha1.LvmVolumeGroup{} + updateLvg := &snc.LvmVolumeGroup{} err = cl.Get(ctx, client.ObjectKey{ Name: "lvgOnNode4", @@ -199,7 +200,7 @@ func TestRunLocalCSINodeWatcherController(t *testing.T) { _, exist = updateLvg.Labels[candidateManualEvictionLabel] assert.True(t, exist) - updatedLsc := &v1alpha1.LocalStorageClass{} + updatedLsc := &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{ Name: "test-lsc", @@ -225,7 +226,8 @@ func TestRunLocalCSINodeWatcherController(t *testing.T) { func NewFakeClient() client.WithWatch { s := scheme.Scheme _ = metav1.AddMetaToScheme(s) - _ = v1alpha1.AddToScheme(s) + _ = slv.AddToScheme(s) + _ = snc.AddToScheme(s) builder := fake.NewClientBuilder().WithScheme(s) diff --git a/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher.go b/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher.go index 2907773b..c2894204 100644 --- a/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher.go +++ b/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher.go @@ -20,8 +20,8 @@ import ( "context" "errors" "fmt" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" "reflect" - v1alpha1 "sds-local-volume-controller/api/v1alpha1" "sds-local-volume-controller/pkg/config" "sds-local-volume-controller/pkg/logger" "time" @@ -88,7 +88,7 @@ func RunLocalStorageClassWatcherController( c, err := controller.New(LocalStorageClassCtrlName, mgr, controller.Options{ Reconciler: reconcile.Func(func(ctx context.Context, request reconcile.Request) (reconcile.Result, error) { log.Info("[LocalStorageClassReconciler] starts Reconcile for the LocalStorageClass %q", request.Name) - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, request.NamespacedName, lsc) if err != nil && !errors2.IsNotFound(err) { log.Error(err, fmt.Sprintf("[LocalStorageClassReconciler] unable to get LocalStorageClass, name: %s", request.Name)) @@ -128,7 +128,7 @@ func RunLocalStorageClassWatcherController( return nil, err } - err = c.Watch(source.Kind(mgr.GetCache(), &v1alpha1.LocalStorageClass{}), handler.Funcs{ + err = c.Watch(source.Kind(mgr.GetCache(), &slv.LocalStorageClass{}), handler.Funcs{ CreateFunc: func(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface) { log.Info(fmt.Sprintf("[CreateFunc] get event for LocalStorageClass %q. Add to the queue", e.Object.GetName())) request := reconcile.Request{NamespacedName: types.NamespacedName{Namespace: e.Object.GetNamespace(), Name: e.Object.GetName()}} @@ -137,13 +137,13 @@ func RunLocalStorageClassWatcherController( UpdateFunc: func(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) { log.Info(fmt.Sprintf("[UpdateFunc] get event for LocalStorageClass %q. Check if it should be reconciled", e.ObjectNew.GetName())) - oldLsc, ok := e.ObjectOld.(*v1alpha1.LocalStorageClass) + oldLsc, ok := e.ObjectOld.(*slv.LocalStorageClass) if !ok { err = errors.New("unable to cast event object to a given type") log.Error(err, "[UpdateFunc] an error occurred while handling create event") return } - newLsc, ok := e.ObjectNew.(*v1alpha1.LocalStorageClass) + newLsc, ok := e.ObjectNew.(*slv.LocalStorageClass) if !ok { err = errors.New("unable to cast event object to a given type") log.Error(err, "[UpdateFunc] an error occurred while handling create event") @@ -168,7 +168,7 @@ func RunLocalStorageClassWatcherController( return c, nil } -func RunEventReconcile(ctx context.Context, cl client.Client, log logger.Logger, scList *v1.StorageClassList, lsc *v1alpha1.LocalStorageClass) (bool, error) { +func RunEventReconcile(ctx context.Context, cl client.Client, log logger.Logger, scList *v1.StorageClassList, lsc *slv.LocalStorageClass) (bool, error) { recType, err := identifyReconcileFunc(scList, lsc) if err != nil { upError := updateLocalStorageClassPhase(ctx, cl, lsc, FailedStatusPhase, err.Error()) diff --git a/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_func.go b/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_func.go index a6a8eaa4..9394882e 100644 --- a/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_func.go +++ b/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_func.go @@ -19,7 +19,8 @@ package controller import ( "context" "fmt" - v1alpha1 "sds-local-volume-controller/api/v1alpha1" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "sds-local-volume-controller/pkg/logger" "strings" @@ -36,7 +37,7 @@ func reconcileLSCDeleteFunc( cl client.Client, log logger.Logger, scList *v1.StorageClassList, - lsc *v1alpha1.LocalStorageClass, + lsc *slv.LocalStorageClass, ) (bool, error) { log.Debug(fmt.Sprintf("[reconcileLSCDeleteFunc] tries to find a storage class for the LocalStorageClass %s", lsc.Name)) var sc *v1.StorageClass @@ -93,7 +94,7 @@ func reconcileLSCUpdateFunc( cl client.Client, log logger.Logger, scList *v1.StorageClassList, - lsc *v1alpha1.LocalStorageClass, + lsc *slv.LocalStorageClass, ) (bool, error) { log.Debug(fmt.Sprintf("[reconcileLSCUpdateFunc] starts the LocalStorageClass %s validation", lsc.Name)) valid, msg := validateLocalStorageClass(ctx, cl, scList, lsc) @@ -176,7 +177,7 @@ func reconcileLSCUpdateFunc( return false, nil } -func identifyReconcileFunc(scList *v1.StorageClassList, lsc *v1alpha1.LocalStorageClass) (reconcileType, error) { +func identifyReconcileFunc(scList *v1.StorageClassList, lsc *slv.LocalStorageClass) (reconcileType, error) { if shouldReconcileByDeleteFunc(lsc) { return DeleteReconcile, nil } @@ -196,7 +197,7 @@ func identifyReconcileFunc(scList *v1.StorageClassList, lsc *v1alpha1.LocalStora return "none", nil } -func shouldReconcileByDeleteFunc(lsc *v1alpha1.LocalStorageClass) bool { +func shouldReconcileByDeleteFunc(lsc *slv.LocalStorageClass) bool { if lsc.DeletionTimestamp != nil { return true } @@ -204,7 +205,7 @@ func shouldReconcileByDeleteFunc(lsc *v1alpha1.LocalStorageClass) bool { return false } -func shouldReconcileByUpdateFunc(scList *v1.StorageClassList, lsc *v1alpha1.LocalStorageClass) (bool, error) { +func shouldReconcileByUpdateFunc(scList *v1.StorageClassList, lsc *slv.LocalStorageClass) (bool, error) { if lsc.DeletionTimestamp != nil { return false, nil } @@ -239,7 +240,7 @@ func shouldReconcileByUpdateFunc(scList *v1.StorageClassList, lsc *v1alpha1.Loca } -func hasLVGDiff(sc *v1.StorageClass, lsc *v1alpha1.LocalStorageClass) (bool, error) { +func hasLVGDiff(sc *v1.StorageClass, lsc *slv.LocalStorageClass) (bool, error) { currentLVGs, err := getLVGFromSCParams(sc) if err != nil { return false, err @@ -270,9 +271,9 @@ func hasLVGDiff(sc *v1.StorageClass, lsc *v1alpha1.LocalStorageClass) (bool, err return false, nil } -func getLVGFromSCParams(sc *v1.StorageClass) ([]v1alpha1.LocalStorageClassLVG, error) { +func getLVGFromSCParams(sc *v1.StorageClass) ([]slv.LocalStorageClassLVG, error) { lvgsFromParams := sc.Parameters[LVMVolumeGroupsParamKey] - var currentLVGs []v1alpha1.LocalStorageClassLVG + var currentLVGs []slv.LocalStorageClassLVG err := yaml.Unmarshal([]byte(lvgsFromParams), ¤tLVGs) if err != nil { @@ -282,7 +283,7 @@ func getLVGFromSCParams(sc *v1.StorageClass) ([]v1alpha1.LocalStorageClassLVG, e return currentLVGs, nil } -func shouldReconcileByCreateFunc(scList *v1.StorageClassList, lsc *v1alpha1.LocalStorageClass) bool { +func shouldReconcileByCreateFunc(scList *v1.StorageClassList, lsc *slv.LocalStorageClass) bool { if lsc.DeletionTimestamp != nil { return false } @@ -301,7 +302,7 @@ func reconcileLSCCreateFunc( cl client.Client, log logger.Logger, scList *v1.StorageClassList, - lsc *v1alpha1.LocalStorageClass, + lsc *slv.LocalStorageClass, ) (bool, error) { log.Debug(fmt.Sprintf("[reconcileLSCCreateFunc] starts the LocalStorageClass %s validation", lsc.Name)) added, err := addFinalizerIfNotExistsForLSC(ctx, cl, lsc) @@ -392,7 +393,7 @@ func createStorageClassIfNotExists( return true, err } -func addFinalizerIfNotExistsForLSC(ctx context.Context, cl client.Client, lsc *v1alpha1.LocalStorageClass) (bool, error) { +func addFinalizerIfNotExistsForLSC(ctx context.Context, cl client.Client, lsc *slv.LocalStorageClass) (bool, error) { if !slices.Contains(lsc.Finalizers, LocalStorageClassFinalizerName) { lsc.Finalizers = append(lsc.Finalizers, LocalStorageClassFinalizerName) } @@ -418,7 +419,7 @@ func addFinalizerIfNotExistsForSC(ctx context.Context, cl client.Client, sc *v1. return true, nil } -func configureStorageClass(lsc *v1alpha1.LocalStorageClass) (*v1.StorageClass, error) { +func configureStorageClass(lsc *slv.LocalStorageClass) (*v1.StorageClass, error) { reclaimPolicy := corev1.PersistentVolumeReclaimPolicy(lsc.Spec.ReclaimPolicy) volumeBindingMode := v1.VolumeBindingMode(lsc.Spec.VolumeBindingMode) AllowVolumeExpansion := AllowVolumeExpansionDefaultValue @@ -469,12 +470,12 @@ func configureStorageClass(lsc *v1alpha1.LocalStorageClass) (*v1.StorageClass, e func updateLocalStorageClassPhase( ctx context.Context, cl client.Client, - lsc *v1alpha1.LocalStorageClass, + lsc *slv.LocalStorageClass, phase, reason string, ) error { if lsc.Status == nil { - lsc.Status = new(v1alpha1.LocalStorageClassStatus) + lsc.Status = new(slv.LocalStorageClassStatus) } lsc.Status.Phase = phase lsc.Status.Reason = reason @@ -496,7 +497,7 @@ func validateLocalStorageClass( ctx context.Context, cl client.Client, scList *v1.StorageClassList, - lsc *v1alpha1.LocalStorageClass, + lsc *slv.LocalStorageClass, ) (bool, string) { var ( failedMsgBuilder strings.Builder @@ -509,7 +510,7 @@ func validateLocalStorageClass( failedMsgBuilder.WriteString(fmt.Sprintf("There already is a storage class with the same name: %s but it is not managed by the LocalStorageClass controller\n", unmanagedScName)) } - lvgList := &v1alpha1.LvmVolumeGroupList{} + lvgList := &snc.LvmVolumeGroupList{} err := cl.List(ctx, lvgList) if err != nil { valid = false @@ -552,7 +553,7 @@ func validateLocalStorageClass( return valid, failedMsgBuilder.String() } -func findUnmanagedDuplicatedSC(scList *v1.StorageClassList, lsc *v1alpha1.LocalStorageClass) string { +func findUnmanagedDuplicatedSC(scList *v1.StorageClassList, lsc *slv.LocalStorageClass) string { for _, sc := range scList.Items { if sc.Name == lsc.Name && sc.Provisioner != LocalStorageClassProvisioner { return sc.Name @@ -562,7 +563,7 @@ func findUnmanagedDuplicatedSC(scList *v1.StorageClassList, lsc *v1alpha1.LocalS return "" } -func findAnyThinPool(lsc *v1alpha1.LocalStorageClass) []string { +func findAnyThinPool(lsc *slv.LocalStorageClass) []string { badLvgs := make([]string, 0, len(lsc.Spec.LVM.LVMVolumeGroups)) for _, lvs := range lsc.Spec.LVM.LVMVolumeGroups { if lvs.Thin != nil { @@ -573,8 +574,8 @@ func findAnyThinPool(lsc *v1alpha1.LocalStorageClass) []string { return badLvgs } -func findNonexistentThinPools(lvgList *v1alpha1.LvmVolumeGroupList, lsc *v1alpha1.LocalStorageClass) []string { - lvgs := make(map[string]v1alpha1.LvmVolumeGroup, len(lvgList.Items)) +func findNonexistentThinPools(lvgList *snc.LvmVolumeGroupList, lsc *slv.LocalStorageClass) []string { + lvgs := make(map[string]snc.LvmVolumeGroup, len(lvgList.Items)) for _, lvg := range lvgList.Items { lvgs[lvg.Name] = lvg } @@ -604,7 +605,7 @@ func findNonexistentThinPools(lvgList *v1alpha1.LvmVolumeGroupList, lsc *v1alpha return badLvgs } -func findNonexistentLVGs(lvgList *v1alpha1.LvmVolumeGroupList, lsc *v1alpha1.LocalStorageClass) []string { +func findNonexistentLVGs(lvgList *snc.LvmVolumeGroupList, lsc *slv.LocalStorageClass) []string { lvgs := make(map[string]struct{}, len(lvgList.Items)) for _, lvg := range lvgList.Items { lvgs[lvg.Name] = struct{}{} @@ -620,7 +621,7 @@ func findNonexistentLVGs(lvgList *v1alpha1.LvmVolumeGroupList, lsc *v1alpha1.Loc return nonexistent } -func findLVMVolumeGroupsOnTheSameNode(lvgList *v1alpha1.LvmVolumeGroupList, lsc *v1alpha1.LocalStorageClass) []string { +func findLVMVolumeGroupsOnTheSameNode(lvgList *snc.LvmVolumeGroupList, lsc *slv.LocalStorageClass) []string { nodesWithLVGs := make(map[string][]string, len(lsc.Spec.LVM.LVMVolumeGroups)) usedLVGs := make(map[string]struct{}, len(lsc.Spec.LVM.LVMVolumeGroups)) for _, lvg := range lsc.Spec.LVM.LVMVolumeGroups { @@ -710,7 +711,7 @@ func removeFinalizerIfExists(ctx context.Context, cl client.Client, obj metav1.O return removed, nil } -func updateStorageClass(lsc *v1alpha1.LocalStorageClass, oldSC *v1.StorageClass) (*v1.StorageClass, error) { +func updateStorageClass(lsc *slv.LocalStorageClass, oldSC *v1.StorageClass) (*v1.StorageClass, error) { newSC, err := configureStorageClass(lsc) if err != nil { return nil, err diff --git a/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_test.go b/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_test.go index eecbc37b..8914a0e6 100644 --- a/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_test.go +++ b/images/sds-local-volume-controller/pkg/controller/local_storage_class_watcher_test.go @@ -18,7 +18,8 @@ package controller_test import ( "context" - v1alpha1 "sds-local-volume-controller/api/v1alpha1" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "sds-local-volume-controller/pkg/controller" "sds-local-volume-controller/pkg/logger" "slices" @@ -72,7 +73,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { ) It("Create_local_sc_with_existing_lvgs", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, } @@ -88,7 +89,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { err = cl.Create(ctx, lscTemplate) Expect(err).NotTo(HaveOccurred()) - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) @@ -133,7 +134,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_sc_add_existing_lvg", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, {Name: newThickLVGName}, @@ -142,11 +143,11 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { err := cl.Create(ctx, newThickLVGTemplate) Expect(err).NotTo(HaveOccurred()) - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) - lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, v1alpha1.LocalStorageClassLVG{Name: newThickLVGName}) + lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, slv.LocalStorageClassLVG{Name: newThickLVGName}) err = cl.Update(ctx, lsc) Expect(err).NotTo(HaveOccurred()) @@ -182,12 +183,12 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_sc_remove_existing_lvg", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) @@ -218,22 +219,22 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_sc_add_non_existing_lvg", func() { - lvgSpecOld := []v1alpha1.LocalStorageClassLVG{ + lvgSpecOld := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, } - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, {Name: nonExistentLVG1Name}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) - lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, v1alpha1.LocalStorageClassLVG{Name: nonExistentLVG1Name}) + lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, slv.LocalStorageClassLVG{Name: nonExistentLVG1Name}) err = cl.Update(ctx, lsc) Expect(err).NotTo(HaveOccurred()) @@ -260,13 +261,13 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Remove_local_sc_with_non_existing_lvg", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, {Name: nonExistentLVG1Name}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) Expect(lsc.Spec.LVM.LVMVolumeGroups).To(Equal(lvgSpec)) @@ -274,7 +275,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { err = cl.Delete(ctx, lsc) Expect(err).NotTo(HaveOccurred()) - lsc = &v1alpha1.LocalStorageClass{} + lsc = &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) Expect(lsc.Finalizers).To(HaveLen(1)) @@ -297,7 +298,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Create_local_sc_with_non_existing_lvgs", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: nonExistentLVG1Name}, {Name: nonExistentLVG2Name}, } @@ -307,7 +308,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { err := cl.Create(ctx, lscTemplate) Expect(err).NotTo(HaveOccurred()) - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) @@ -333,12 +334,12 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_sc_with_all_existing_lvgs", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) @@ -370,19 +371,19 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Remove_local_sc_with_existing_lvgs", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) err = cl.Delete(ctx, lsc) Expect(err).NotTo(HaveOccurred()) - lsc = &v1alpha1.LocalStorageClass{} + lsc = &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) Expect(lsc.Finalizers).To(HaveLen(1)) @@ -417,7 +418,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { err := cl.Create(ctx, sc) Expect(err).NotTo(HaveOccurred()) - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, } @@ -427,7 +428,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { err = cl.Create(ctx, lscTemplate) Expect(err).NotTo(HaveOccurred()) - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) @@ -454,17 +455,17 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_sc_add_existing_vg_when_sc_with_another_provisioner_exists", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, {Name: newThickLVGName}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) - lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, v1alpha1.LocalStorageClassLVG{Name: newThickLVGName}) + lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, slv.LocalStorageClassLVG{Name: newThickLVGName}) err = cl.Update(ctx, lsc) Expect(err).NotTo(HaveOccurred()) @@ -493,20 +494,20 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Remove_local_sc_with_existing_vgs_when_sc_with_another_provisioner_exists", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ + lvgSpec := []slv.LocalStorageClassLVG{ {Name: existingThickLVG1Name}, {Name: existingThickLVG2Name}, {Name: newThickLVGName}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) err = cl.Delete(ctx, lsc) Expect(err).NotTo(HaveOccurred()) - lsc = &v1alpha1.LocalStorageClass{} + lsc = &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) Expect(lsc.Finalizers).To(HaveLen(1)) @@ -540,9 +541,9 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Create_local_thin_sc_with_existing_thin_lvgs", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ - {Name: existingThinLVG1Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, - {Name: existingThinLVG2Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, + lvgSpec := []slv.LocalStorageClassLVG{ + {Name: existingThinLVG1Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, + {Name: existingThinLVG2Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, } err := cl.Create(ctx, existingThinLVG1Template) @@ -556,7 +557,7 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { err = cl.Create(ctx, lscTemplate) Expect(err).NotTo(HaveOccurred()) - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) @@ -584,20 +585,20 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_thin_sc_add_existing_thin_lvg", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ - {Name: existingThinLVG1Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, - {Name: existingThinLVG2Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, - {Name: newThinLVGName, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, + lvgSpec := []slv.LocalStorageClassLVG{ + {Name: existingThinLVG1Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, + {Name: existingThinLVG2Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, + {Name: newThinLVGName, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, } err := cl.Create(ctx, newThinLVGTemplate) Expect(err).NotTo(HaveOccurred()) - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) - lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, v1alpha1.LocalStorageClassLVG{Name: newThinLVGName, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}) + lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, slv.LocalStorageClassLVG{Name: newThinLVGName, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}) err = cl.Update(ctx, lsc) Expect(err).NotTo(HaveOccurred()) @@ -624,12 +625,12 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_thin_sc_remove_existing_thin_lvg", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ - {Name: existingThinLVG1Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, - {Name: existingThinLVG2Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, + lvgSpec := []slv.LocalStorageClassLVG{ + {Name: existingThinLVG1Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, + {Name: existingThinLVG2Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) @@ -660,22 +661,22 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Update_local_thin_sc_add_existing_thick_lvg", func() { - lvgSpecOld := []v1alpha1.LocalStorageClassLVG{ - {Name: existingThinLVG1Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, - {Name: existingThinLVG2Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, + lvgSpecOld := []slv.LocalStorageClassLVG{ + {Name: existingThinLVG1Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, + {Name: existingThinLVG2Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, } - lvgSpec := []v1alpha1.LocalStorageClassLVG{ - {Name: existingThinLVG1Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, - {Name: existingThinLVG2Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, + lvgSpec := []slv.LocalStorageClassLVG{ + {Name: existingThinLVG1Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, + {Name: existingThinLVG2Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, {Name: existingThickLVG1Name}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) - lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, v1alpha1.LocalStorageClassLVG{Name: existingThickLVG1Name}) + lsc.Spec.LVM.LVMVolumeGroups = append(lsc.Spec.LVM.LVMVolumeGroups, slv.LocalStorageClassLVG{Name: existingThickLVG1Name}) err = cl.Update(ctx, lsc) Expect(err).NotTo(HaveOccurred()) @@ -702,20 +703,20 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) It("Remove_local_thin_sc_with_existing_thick_lvg", func() { - lvgSpec := []v1alpha1.LocalStorageClassLVG{ - {Name: existingThinLVG1Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, - {Name: existingThinLVG2Name, Thin: &v1alpha1.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, + lvgSpec := []slv.LocalStorageClassLVG{ + {Name: existingThinLVG1Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-1"}}, + {Name: existingThinLVG2Name, Thin: &slv.LocalStorageClassLVMThinPoolSpec{PoolName: "thin-pool-2"}}, {Name: existingThickLVG1Name}, } - lsc := &v1alpha1.LocalStorageClass{} + lsc := &slv.LocalStorageClass{} err := cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) err = cl.Delete(ctx, lsc) Expect(err).NotTo(HaveOccurred()) - lsc = &v1alpha1.LocalStorageClass{} + lsc = &slv.LocalStorageClass{} err = cl.Get(ctx, client.ObjectKey{Name: nameForLocalStorageClass}, lsc) Expect(err).NotTo(HaveOccurred()) Expect(lsc.Finalizers).To(HaveLen(1)) @@ -741,53 +742,53 @@ var _ = Describe(controller.LocalStorageClassCtrlName, func() { }) -func generateLVMVolumeGroup(name string, devices, thinPoolNames []string) *v1alpha1.LvmVolumeGroup { +func generateLVMVolumeGroup(name string, devices, thinPoolNames []string) *snc.LvmVolumeGroup { lvmType := controller.LVMThickType if len(thinPoolNames) > 0 { lvmType = controller.LVMThinType } - thinPoolsSpec := make([]v1alpha1.SpecThinPool, 0) - thinPoolsStatus := make([]v1alpha1.StatusThinPool, 0) + thinPoolsSpec := make([]snc.LvmVolumeGroupThinPoolSpec, 0) + thinPoolsStatus := make([]snc.LvmVolumeGroupThinPoolStatus, 0) for i := 0; i < len(thinPoolNames); i++ { - thinPoolsSpec = append(thinPoolsSpec, v1alpha1.SpecThinPool{ + thinPoolsSpec = append(thinPoolsSpec, snc.LvmVolumeGroupThinPoolSpec{ Name: thinPoolNames[i], Size: resource.MustParse("10Gi"), }) - thinPoolsStatus = append(thinPoolsStatus, v1alpha1.StatusThinPool{ + thinPoolsStatus = append(thinPoolsStatus, snc.LvmVolumeGroupThinPoolStatus{ Name: thinPoolNames[i], ActualSize: resource.MustParse("10Gi"), UsedSize: resource.MustParse("0Gi"), }) } - return &v1alpha1.LvmVolumeGroup{ + return &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Spec: v1alpha1.LvmVolumeGroupSpec{ + Spec: snc.LvmVolumeGroupSpec{ ActualVGNameOnTheNode: "vg1", BlockDeviceNames: devices, ThinPools: thinPoolsSpec, Type: lvmType, }, - Status: v1alpha1.LvmVolumeGroupStatus{ + Status: snc.LvmVolumeGroupStatus{ ThinPools: thinPoolsStatus, }, } } -func generateLocalStorageClass(lscName, reclaimPolicy, volumeBindingMode, lvmType string, lvgs []v1alpha1.LocalStorageClassLVG) *v1alpha1.LocalStorageClass { +func generateLocalStorageClass(lscName, reclaimPolicy, volumeBindingMode, lvmType string, lvgs []slv.LocalStorageClassLVG) *slv.LocalStorageClass { - return &v1alpha1.LocalStorageClass{ + return &slv.LocalStorageClass{ ObjectMeta: metav1.ObjectMeta{ Name: lscName, }, - Spec: v1alpha1.LocalStorageClassSpec{ + Spec: slv.LocalStorageClassSpec{ ReclaimPolicy: reclaimPolicy, VolumeBindingMode: volumeBindingMode, - LVM: &v1alpha1.LocalStorageClassLVMSpec{ + LVM: &slv.LocalStorageClassLVMSpec{ Type: lvmType, LVMVolumeGroups: lvgs, }, @@ -796,7 +797,7 @@ func generateLocalStorageClass(lscName, reclaimPolicy, volumeBindingMode, lvmTyp } -func performStandartChecksForSC(sc *v1.StorageClass, lvgSpec []v1alpha1.LocalStorageClassLVG, nameForLocalStorageClass, LSCType, LVMType, reclaimPolicy, volumeBindingMode string) { +func performStandartChecksForSC(sc *v1.StorageClass, lvgSpec []slv.LocalStorageClassLVG, nameForLocalStorageClass, LSCType, LVMType, reclaimPolicy, volumeBindingMode string) { expectString := "" for i, lvg := range lvgSpec { if i != 0 { @@ -829,7 +830,7 @@ func performStandartChecksForSC(sc *v1.StorageClass, lvgSpec []v1alpha1.LocalSto } -func delFromSlice(slice []v1alpha1.LocalStorageClassLVG, name string) []v1alpha1.LocalStorageClassLVG { +func delFromSlice(slice []slv.LocalStorageClassLVG, name string) []slv.LocalStorageClassLVG { for i, lvg := range slice { if lvg.Name == name { // return append(slice[:i], slice[i+1:]...) diff --git a/images/sds-local-volume-csi/Dockerfile b/images/sds-local-volume-csi/Dockerfile index 04b605c2..63638d45 100644 --- a/images/sds-local-volume-csi/Dockerfile +++ b/images/sds-local-volume-csi/Dockerfile @@ -1,5 +1,5 @@ ARG BASE_ALPINE=registry.deckhouse.io/base_images/alpine:3.16.3@sha256:5548e9172c24a1b0ca9afdd2bf534e265c94b12b36b3e0c0302f5853eaf00abb -ARG BASE_GOLANG_ALPINE_BUILDER=registry.deckhouse.io/base_images/golang:1.21.4-alpine3.18@sha256:cf84f3d6882c49ea04b6478ac514a2582c8922d7e5848b43d2918fff8329f6e6 +ARG BASE_GOLANG_ALPINE_BUILDER=registry.deckhouse.io/base_images/golang:1.22.3-alpine@sha256:dbf216b880b802c22e3f4f2ef0a78396b4a9a6983cb9b767c5efc351ebf946b0 FROM $BASE_GOLANG_ALPINE_BUILDER as builder diff --git a/images/sds-local-volume-csi/api/v1alpha1/lvm_logical_volume.go b/images/sds-local-volume-csi/api/v1alpha1/lvm_logical_volume.go deleted file mode 100644 index 6195aedc..00000000 --- a/images/sds-local-volume-csi/api/v1alpha1/lvm_logical_volume.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type LVMLogicalVolumeList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []LVMLogicalVolume `json:"items"` -} - -type LVMLogicalVolume struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LVMLogicalVolumeSpec `json:"spec"` - Status *LVMLogicalVolumeStatus `json:"status,omitempty"` -} - -type LVMLogicalVolumeSpec struct { - ActualLVNameOnTheNode string `json:"actualLVNameOnTheNode"` - Type string `json:"type"` - Size resource.Quantity `json:"size"` - LvmVolumeGroupName string `json:"lvmVolumeGroupName"` - Thin *LVMLogicalVolumeThinSpec `json:"thin"` - Thick *LVMLogicalVolumeThickSpec `json:"thick"` -} - -type LVMLogicalVolumeThinSpec struct { - PoolName string `json:"poolName"` -} - -type LVMLogicalVolumeThickSpec struct { - Contiguous *bool `json:"contiguous"` -} - -type LVMLogicalVolumeStatus struct { - Phase string `json:"phase"` - Reason string `json:"reason"` - ActualSize resource.Quantity `json:"actualSize"` - Contiguous *bool `json:"contiguous"` -} diff --git a/images/sds-local-volume-csi/api/v1alpha1/lvm_volume_group.go b/images/sds-local-volume-csi/api/v1alpha1/lvm_volume_group.go deleted file mode 100644 index 70900f72..00000000 --- a/images/sds-local-volume-csi/api/v1alpha1/lvm_volume_group.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type LvmVolumeGroupList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []LvmVolumeGroup `json:"items"` -} - -type LvmVolumeGroup struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LvmVolumeGroupSpec `json:"spec"` - Status LvmVolumeGroupStatus `json:"status,omitempty"` -} - -type LvmVolumeGroupSpec struct { - ActualVGNameOnTheNode string `json:"actualVGNameOnTheNode"` - BlockDeviceNames []string `json:"blockDeviceNames"` - ThinPools []LvmVolumeGroupThinPoolSpec `json:"thinPools"` - Type string `json:"type"` -} - -type LvmVolumeGroupStatus struct { - AllocatedSize resource.Quantity `json:"allocatedSize"` - Nodes []LvmVolumeGroupNode `json:"nodes"` - ThinPools []LvmVolumeGroupThinPoolStatus `json:"thinPools"` - VGSize resource.Quantity `json:"vgSize"` - VGUuid string `json:"vgUUID"` - Phase string `json:"phase"` - Conditions []metav1.Condition `json:"conditions"` - ThinPoolReady string `json:"thinPoolReady"` - ConfigurationApplied string `json:"configurationApplied"` - VGFree resource.Quantity `json:"vgFree"` -} - -type LvmVolumeGroupDevice struct { - BlockDevice string `json:"blockDevice"` - DevSize resource.Quantity `json:"devSize"` - PVSize resource.Quantity `json:"pvSize"` - PVUuid string `json:"pvUUID"` - Path string `json:"path"` -} - -type LvmVolumeGroupNode struct { - Devices []LvmVolumeGroupDevice `json:"devices"` - Name string `json:"name"` -} - -type LvmVolumeGroupThinPoolStatus struct { - Name string `json:"name"` - ActualSize resource.Quantity `json:"actualSize"` - UsedSize resource.Quantity `json:"usedSize"` - AllocatedSize resource.Quantity `json:"allocatedSize"` - AvailableSpace resource.Quantity `json:"availableSpace"` - AllocationLimit string `json:"allocationLimit"` - Ready bool `json:"ready"` - Message string `json:"message"` -} - -type LvmVolumeGroupThinPoolSpec struct { - Name string `json:"name"` - Size resource.Quantity `json:"size"` - AllocationLimit string `json:"allocationLimit"` -} diff --git a/images/sds-local-volume-csi/api/v1alpha1/register.go b/images/sds-local-volume-csi/api/v1alpha1/register.go deleted file mode 100644 index 7a466122..00000000 --- a/images/sds-local-volume-csi/api/v1alpha1/register.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - LVMVolumeGroupKind = "LvmVolumeGroup" - LVMLogicalVolumeKind = "LVMLogicalVolume" - APIGroup = "storage.deckhouse.io" - APIVersion = "v1alpha1" - TypeMediaAPIVersion = APIGroup + "/" + APIVersion -) - -// SchemeGroupVersion is group version used to register these objects -var ( - SchemeGroupVersion = schema.GroupVersion{ - Group: APIGroup, - Version: APIVersion, - } - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &LvmVolumeGroup{}, - &LvmVolumeGroupList{}, - &LVMLogicalVolume{}, - &LVMLogicalVolumeList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/images/sds-local-volume-csi/api/v1alpha1/zz_generated.deepcopy.go b/images/sds-local-volume-csi/api/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 3ae15d13..00000000 --- a/images/sds-local-volume-csi/api/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import "k8s.io/apimachinery/pkg/runtime" - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LvmVolumeGroup) DeepCopyInto(out *LvmVolumeGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice. -func (in *LvmVolumeGroup) DeepCopy() *LvmVolumeGroup { - if in == nil { - return nil - } - out := new(LvmVolumeGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroup) 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 *LvmVolumeGroupList) DeepCopyInto(out *LvmVolumeGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LvmVolumeGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList. -func (in *LvmVolumeGroupList) DeepCopy() *LvmVolumeGroupList { - if in == nil { - return nil - } - out := new(LvmVolumeGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// -------------- LVMLogicalVolume ---------- - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LVMLogicalVolume) DeepCopyInto(out *LVMLogicalVolume) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice. -func (in *LVMLogicalVolume) DeepCopy() *LVMLogicalVolume { - if in == nil { - return nil - } - out := new(LVMLogicalVolume) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LVMLogicalVolume) 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 *LVMLogicalVolumeList) DeepCopyInto(out *LVMLogicalVolumeList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LVMLogicalVolume, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList. -func (in *LVMLogicalVolumeList) DeepCopy() *LVMLogicalVolumeList { - if in == nil { - return nil - } - out := new(LVMLogicalVolumeList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LVMLogicalVolumeList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} diff --git a/images/sds-local-volume-csi/cmd/main.go b/images/sds-local-volume-csi/cmd/main.go index 06b6edaa..0aa68c11 100644 --- a/images/sds-local-volume-csi/cmd/main.go +++ b/images/sds-local-volume-csi/cmd/main.go @@ -20,9 +20,10 @@ import ( "context" "flag" "fmt" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "os" "os/signal" - "sds-local-volume-csi/api/v1alpha1" "sds-local-volume-csi/config" "sds-local-volume-csi/driver" "sds-local-volume-csi/pkg/kubutils" @@ -42,7 +43,8 @@ import ( var ( resourcesSchemeFuncs = []func(*apiruntime.Scheme) error{ - v1alpha1.AddToScheme, + snc.AddToScheme, + slv.AddToScheme, clientgoscheme.AddToScheme, extv1.AddToScheme, v1.AddToScheme, diff --git a/images/sds-local-volume-csi/go.mod b/images/sds-local-volume-csi/go.mod index 60c48d2c..74ea5ae5 100644 --- a/images/sds-local-volume-csi/go.mod +++ b/images/sds-local-volume-csi/go.mod @@ -1,9 +1,11 @@ module sds-local-volume-csi -go 1.21 +go 1.22.2 require ( github.com/container-storage-interface/spec v1.9.0 + github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c + github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36 github.com/go-logr/logr v1.4.1 github.com/golang/protobuf v1.5.4 golang.org/x/sync v0.6.0 @@ -11,7 +13,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.29.3 k8s.io/apiextensions-apiserver v0.29.3 - k8s.io/apimachinery v0.29.3 + k8s.io/apimachinery v0.30.2 k8s.io/client-go v0.29.3 k8s.io/klog/v2 v2.120.1 k8s.io/mount-utils v0.29.3 @@ -40,7 +42,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/net v0.22.0 // indirect + golang.org/x/net v0.23.0 // indirect golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sys v0.18.0 // indirect golang.org/x/term v0.18.0 // indirect diff --git a/images/sds-local-volume-csi/go.sum b/images/sds-local-volume-csi/go.sum index aee18791..7173cf2a 100644 --- a/images/sds-local-volume-csi/go.sum +++ b/images/sds-local-volume-csi/go.sum @@ -1,32 +1,26 @@ github.com/container-storage-interface/spec v1.9.0 h1:zKtX4STsq31Knz3gciCYCi1SXtO2HJDecIjDVboYavY= github.com/container-storage-interface/spec v1.9.0/go.mod h1:ZfDu+3ZRyeVqxZM0Ds19MVLkN2d1XJ5MAfi1L3VjlT0= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= -github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c h1:1hZBDe3aKqok/jOnbKfa5CMQ6viL/dsnsHujEaq+oxU= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c/go.mod h1:cYxHYJmIl6g9lXb1etqmLeQL/vsPMgscmact/FObd+U= +github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36 h1:ToJpGIAHud57Fxm5P1oULRibHpcCuysHqg5dgT0aeys= +github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36/go.mod h1:H71+9G0Jr46Qs0BA3z3/xt0h9lbnJnCEYcaCJCWFBf0= github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapwQtU84iWk= github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro= -github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= -github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= @@ -35,8 +29,6 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= @@ -50,8 +42,6 @@ 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/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= @@ -62,17 +52,12 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= -github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g= github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -82,27 +67,22 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= -github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= +github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -125,12 +105,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY= -golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -146,14 +122,10 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -162,8 +134,6 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -171,26 +141,20 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 h1:gphdwh0npgs8elJ4T6J+DQJHPVF7RsuJHCfwztUb4J4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -201,43 +165,24 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= -k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= k8s.io/api v0.29.3 h1:2ORfZ7+bGC3YJqGpV0KSDDEVf8hdGQ6A03/50vj8pmw= k8s.io/api v0.29.3/go.mod h1:y2yg2NTyHUUkIoTC+phinTnEa3KFM6RZ3szxt014a80= -k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= -k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= k8s.io/apiextensions-apiserver v0.29.3 h1:9HF+EtZaVpFjStakF4yVufnXGPRppWFEQ87qnO91YeI= k8s.io/apiextensions-apiserver v0.29.3/go.mod h1:po0XiY5scnpJfFizNGo6puNU6Fq6D70UJY2Cb2KwAVc= -k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= -k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= -k8s.io/apimachinery v0.29.3 h1:2tbx+5L7RNvqJjn7RIuIKu9XTsIZ9Z5wX2G22XAa5EU= -k8s.io/apimachinery v0.29.3/go.mod h1:hx/S4V2PNW4OMg3WizRrHutyB5la0iCUbZym+W0EQIU= -k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= -k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= k8s.io/client-go v0.29.3 h1:R/zaZbEAxqComZ9FHeQwOh3Y1ZUs7FaHKZdQtIc2WZg= k8s.io/client-go v0.29.3/go.mod h1:tkDisCvgPfiRpxGnOORfkljmS+UrW+WtXAy2fTvXJB0= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= k8s.io/kube-openapi v0.0.0-20240322212309-b815d8309940 h1:qVoMaQV5t62UUvHe16Q3eb2c5HPzLHYzsi0Tu/xLndo= k8s.io/kube-openapi v0.0.0-20240322212309-b815d8309940/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= -k8s.io/mount-utils v0.29.1 h1:veXlIm52Y4tm3H0pG03cOdkw0KOJxYDa0fQqhJCoqvQ= -k8s.io/mount-utils v0.29.1/go.mod h1:9IWJTMe8tG0MYMLEp60xK9GYVeCdA3g4LowmnVi+t9Y= k8s.io/mount-utils v0.29.3 h1:iEcqPP7Vv8UClH8nnMfovtmy/04fIloRW9JuSXykoZ0= k8s.io/mount-utils v0.29.3/go.mod h1:9IWJTMe8tG0MYMLEp60xK9GYVeCdA3g4LowmnVi+t9Y= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= -k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY= k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/controller-runtime v0.17.0 h1:fjJQf8Ukya+VjogLO6/bNX9HE6Y2xpsO5+fyS26ur/s= -sigs.k8s.io/controller-runtime v0.17.0/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/images/sds-local-volume-csi/pkg/utils/func.go b/images/sds-local-volume-csi/pkg/utils/func.go index 145b4af5..ad882cc7 100644 --- a/images/sds-local-volume-csi/pkg/utils/func.go +++ b/images/sds-local-volume-csi/pkg/utils/func.go @@ -20,8 +20,8 @@ import ( "context" "errors" "fmt" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "math" - "sds-local-volume-csi/api/v1alpha1" "sds-local-volume-csi/internal" "sds-local-volume-csi/pkg/logger" "slices" @@ -45,12 +45,12 @@ const ( SDSLocalVolumeCSIFinalizer = "storage.deckhouse.io/sds-local-volume-csi" ) -func CreateLVMLogicalVolume(ctx context.Context, kc client.Client, name string, LVMLogicalVolumeSpec v1alpha1.LVMLogicalVolumeSpec) (*v1alpha1.LVMLogicalVolume, error) { +func CreateLVMLogicalVolume(ctx context.Context, kc client.Client, name string, LVMLogicalVolumeSpec snc.LVMLogicalVolumeSpec) (*snc.LVMLogicalVolume, error) { var err error - llv := &v1alpha1.LVMLogicalVolume{ + llv := &snc.LVMLogicalVolume{ TypeMeta: metav1.TypeMeta{ - Kind: v1alpha1.LVMLogicalVolumeKind, - APIVersion: v1alpha1.TypeMediaAPIVersion, + Kind: snc.LVMLogicalVolumeKind, + APIVersion: snc.TypeMediaAPIVersion, }, ObjectMeta: metav1.ObjectMeta{ Name: name, @@ -146,8 +146,8 @@ func WaitForStatusUpdate(ctx context.Context, kc client.Client, log *logger.Logg } } -func GetLVMLogicalVolume(ctx context.Context, kc client.Client, LVMLogicalVolumeName, namespace string) (*v1alpha1.LVMLogicalVolume, error) { - var llv v1alpha1.LVMLogicalVolume +func GetLVMLogicalVolume(ctx context.Context, kc client.Client, LVMLogicalVolumeName, namespace string) (*snc.LVMLogicalVolume, error) { + var llv snc.LVMLogicalVolume var err error for attempt := 0; attempt < KubernetesApiRequestLimit; attempt++ { @@ -171,7 +171,7 @@ func AreSizesEqualWithinDelta(leftSize, rightSize, allowedDelta resource.Quantit return math.Abs(leftSizeFloat-rightSizeFloat) < float64(allowedDelta.Value()) } -func GetNodeWithMaxFreeSpace(lvgs []v1alpha1.LvmVolumeGroup, storageClassLVGParametersMap map[string]string, lvmType string) (nodeName string, freeSpace resource.Quantity, err error) { +func GetNodeWithMaxFreeSpace(lvgs []snc.LvmVolumeGroup, storageClassLVGParametersMap map[string]string, lvmType string) (nodeName string, freeSpace resource.Quantity, err error) { var maxFreeSpace int64 for _, lvg := range lvgs { @@ -200,13 +200,13 @@ func GetNodeWithMaxFreeSpace(lvgs []v1alpha1.LvmVolumeGroup, storageClassLVGPara // TODO: delete the method below? func GetLVMVolumeGroupParams(ctx context.Context, kc client.Client, log logger.Logger, lvmVG map[string]string, nodeName, LvmType string) (lvgName, vgName string, err error) { - listLvgs := &v1alpha1.LvmVolumeGroupList{ + listLvgs := &snc.LvmVolumeGroupList{ TypeMeta: metav1.TypeMeta{ - Kind: v1alpha1.LVMVolumeGroupKind, - APIVersion: v1alpha1.TypeMediaAPIVersion, + Kind: snc.LVMVolumeGroupKind, + APIVersion: snc.TypeMediaAPIVersion, }, ListMeta: metav1.ListMeta{}, - Items: []v1alpha1.LvmVolumeGroup{}, + Items: []snc.LvmVolumeGroup{}, } for attempt := 0; attempt < KubernetesApiRequestLimit; attempt++ { @@ -248,8 +248,8 @@ func GetLVMVolumeGroupParams(ctx context.Context, kc client.Client, log logger.L return "", "", errors.New("there are no matches") } -func GetLVMVolumeGroup(ctx context.Context, kc client.Client, lvgName, namespace string) (*v1alpha1.LvmVolumeGroup, error) { - var lvg v1alpha1.LvmVolumeGroup +func GetLVMVolumeGroup(ctx context.Context, kc client.Client, lvgName, namespace string) (*snc.LvmVolumeGroup, error) { + var lvg snc.LvmVolumeGroup var err error for attempt := 0; attempt < KubernetesApiRequestLimit; attempt++ { @@ -266,14 +266,14 @@ func GetLVMVolumeGroup(ctx context.Context, kc client.Client, lvgName, namespace return nil, fmt.Errorf("after %d attempts of getting LvmVolumeGroup %s in namespace %s, last error: %w", KubernetesApiRequestLimit, lvgName, namespace, err) } -func GetLVMVolumeGroupFreeSpace(lvg v1alpha1.LvmVolumeGroup) (vgFreeSpace resource.Quantity) { +func GetLVMVolumeGroupFreeSpace(lvg snc.LvmVolumeGroup) (vgFreeSpace resource.Quantity) { vgFreeSpace = lvg.Status.VGSize vgFreeSpace.Sub(lvg.Status.AllocatedSize) return vgFreeSpace } -func GetLVMThinPoolFreeSpace(lvg v1alpha1.LvmVolumeGroup, thinPoolName string) (thinPoolFreeSpace resource.Quantity, err error) { - var storagePoolThinPool *v1alpha1.LvmVolumeGroupThinPoolStatus +func GetLVMThinPoolFreeSpace(lvg snc.LvmVolumeGroup, thinPoolName string) (thinPoolFreeSpace resource.Quantity, err error) { + var storagePoolThinPool *snc.LvmVolumeGroupThinPoolStatus for _, thinPool := range lvg.Status.ThinPools { if thinPool.Name == thinPoolName { storagePoolThinPool = &thinPool @@ -288,7 +288,7 @@ func GetLVMThinPoolFreeSpace(lvg v1alpha1.LvmVolumeGroup, thinPoolName string) ( return storagePoolThinPool.AvailableSpace, nil } -func UpdateLVMLogicalVolume(ctx context.Context, kc client.Client, llv *v1alpha1.LVMLogicalVolume) error { +func UpdateLVMLogicalVolume(ctx context.Context, kc client.Client, llv *snc.LVMLogicalVolume) error { var err error for attempt := 0; attempt < KubernetesApiRequestLimit; attempt++ { err = kc.Update(ctx, llv) @@ -304,7 +304,7 @@ func UpdateLVMLogicalVolume(ctx context.Context, kc client.Client, llv *v1alpha1 return nil } -func GetStorageClassLVGsAndParameters(ctx context.Context, kc client.Client, log *logger.Logger, storageClassLVGParametersString string) (storageClassLVGs []v1alpha1.LvmVolumeGroup, storageClassLVGParametersMap map[string]string, err error) { +func GetStorageClassLVGsAndParameters(ctx context.Context, kc client.Client, log *logger.Logger, storageClassLVGParametersString string) (storageClassLVGs []snc.LvmVolumeGroup, storageClassLVGParametersMap map[string]string, err error) { var storageClassLVGParametersList LVMVolumeGroups err = yaml.Unmarshal([]byte(storageClassLVGParametersString), &storageClassLVGParametersList) if err != nil { @@ -339,15 +339,15 @@ func GetStorageClassLVGsAndParameters(ctx context.Context, kc client.Client, log return storageClassLVGs, storageClassLVGParametersMap, nil } -func GetLVGList(ctx context.Context, kc client.Client) (*v1alpha1.LvmVolumeGroupList, error) { +func GetLVGList(ctx context.Context, kc client.Client) (*snc.LvmVolumeGroupList, error) { var err error - listLvgs := &v1alpha1.LvmVolumeGroupList{ + listLvgs := &snc.LvmVolumeGroupList{ TypeMeta: metav1.TypeMeta{ - Kind: v1alpha1.LVMVolumeGroupKind, - APIVersion: v1alpha1.TypeMediaAPIVersion, + Kind: snc.LVMVolumeGroupKind, + APIVersion: snc.TypeMediaAPIVersion, }, ListMeta: metav1.ListMeta{}, - Items: []v1alpha1.LvmVolumeGroup{}, + Items: []snc.LvmVolumeGroup{}, } for attempt := 0; attempt < KubernetesApiRequestLimit; attempt++ { @@ -361,8 +361,8 @@ func GetLVGList(ctx context.Context, kc client.Client) (*v1alpha1.LvmVolumeGroup return nil, fmt.Errorf("after %d attempts of getting LvmVolumeGroupList, last error: %w", KubernetesApiRequestLimit, err) } -func GetLLVSpec(log *logger.Logger, lvName string, selectedLVG v1alpha1.LvmVolumeGroup, storageClassLVGParametersMap map[string]string, lvmType string, llvSize resource.Quantity, contiguous bool) v1alpha1.LVMLogicalVolumeSpec { - lvmLogicalVolumeSpec := v1alpha1.LVMLogicalVolumeSpec{ +func GetLLVSpec(log *logger.Logger, lvName string, selectedLVG snc.LvmVolumeGroup, storageClassLVGParametersMap map[string]string, lvmType string, llvSize resource.Quantity, contiguous bool) snc.LVMLogicalVolumeSpec { + lvmLogicalVolumeSpec := snc.LVMLogicalVolumeSpec{ ActualLVNameOnTheNode: lvName, Type: lvmType, Size: llvSize, @@ -371,13 +371,13 @@ func GetLLVSpec(log *logger.Logger, lvName string, selectedLVG v1alpha1.LvmVolum switch lvmType { case internal.LVMTypeThin: - lvmLogicalVolumeSpec.Thin = &v1alpha1.LVMLogicalVolumeThinSpec{ + lvmLogicalVolumeSpec.Thin = &snc.LVMLogicalVolumeThinSpec{ PoolName: storageClassLVGParametersMap[selectedLVG.Name], } log.Info(fmt.Sprintf("[GetLLVSpec] Thin pool name: %s", lvmLogicalVolumeSpec.Thin.PoolName)) case internal.LVMTypeThick: if contiguous { - lvmLogicalVolumeSpec.Thick = &v1alpha1.LVMLogicalVolumeThickSpec{ + lvmLogicalVolumeSpec.Thick = &snc.LVMLogicalVolumeThickSpec{ Contiguous: &contiguous, } } @@ -388,16 +388,16 @@ func GetLLVSpec(log *logger.Logger, lvName string, selectedLVG v1alpha1.LvmVolum return lvmLogicalVolumeSpec } -func SelectLVG(storageClassLVGs []v1alpha1.LvmVolumeGroup, nodeName string) (v1alpha1.LvmVolumeGroup, error) { +func SelectLVG(storageClassLVGs []snc.LvmVolumeGroup, nodeName string) (snc.LvmVolumeGroup, error) { for _, lvg := range storageClassLVGs { if lvg.Status.Nodes[0].Name == nodeName { return lvg, nil } } - return v1alpha1.LvmVolumeGroup{}, fmt.Errorf("[SelectLVG] no LVMVolumeGroup found for node %s", nodeName) + return snc.LvmVolumeGroup{}, fmt.Errorf("[SelectLVG] no LVMVolumeGroup found for node %s", nodeName) } -func removeLLVFinalizerIfExist(ctx context.Context, kc client.Client, llv *v1alpha1.LVMLogicalVolume, finalizer string) (bool, error) { +func removeLLVFinalizerIfExist(ctx context.Context, kc client.Client, llv *snc.LVMLogicalVolume, finalizer string) (bool, error) { removed := false for i, val := range llv.Finalizers { diff --git a/images/sds-local-volume-scheduler-extender/Dockerfile b/images/sds-local-volume-scheduler-extender/Dockerfile index 12ae60a2..29e3b045 100644 --- a/images/sds-local-volume-scheduler-extender/Dockerfile +++ b/images/sds-local-volume-scheduler-extender/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_GOLANG_22_ALPINE=registry.deckhouse.io/base_images/golang:1.22.1-alpine@sha256:0de6cf7cceab6ecbf0718bdfb675b08b78113c3709c5e4b99456cdb2ae8c2495 +ARG BASE_GOLANG_22_ALPINE=registry.deckhouse.io/base_images/golang:1.22.3-alpine@sha256:dbf216b880b802c22e3f4f2ef0a78396b4a9a6983cb9b767c5efc351ebf946b0 ARG BASE_GOLANG_22_ALPINE_BUILDER=$BASE_GOLANG_22_ALPINE FROM $BASE_GOLANG_22_ALPINE_BUILDER as builder diff --git a/images/sds-local-volume-scheduler-extender/api/v1alpha1/lvm_volume_group.go b/images/sds-local-volume-scheduler-extender/api/v1alpha1/lvm_volume_group.go deleted file mode 100644 index 70900f72..00000000 --- a/images/sds-local-volume-scheduler-extender/api/v1alpha1/lvm_volume_group.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type LvmVolumeGroupList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []LvmVolumeGroup `json:"items"` -} - -type LvmVolumeGroup struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LvmVolumeGroupSpec `json:"spec"` - Status LvmVolumeGroupStatus `json:"status,omitempty"` -} - -type LvmVolumeGroupSpec struct { - ActualVGNameOnTheNode string `json:"actualVGNameOnTheNode"` - BlockDeviceNames []string `json:"blockDeviceNames"` - ThinPools []LvmVolumeGroupThinPoolSpec `json:"thinPools"` - Type string `json:"type"` -} - -type LvmVolumeGroupStatus struct { - AllocatedSize resource.Quantity `json:"allocatedSize"` - Nodes []LvmVolumeGroupNode `json:"nodes"` - ThinPools []LvmVolumeGroupThinPoolStatus `json:"thinPools"` - VGSize resource.Quantity `json:"vgSize"` - VGUuid string `json:"vgUUID"` - Phase string `json:"phase"` - Conditions []metav1.Condition `json:"conditions"` - ThinPoolReady string `json:"thinPoolReady"` - ConfigurationApplied string `json:"configurationApplied"` - VGFree resource.Quantity `json:"vgFree"` -} - -type LvmVolumeGroupDevice struct { - BlockDevice string `json:"blockDevice"` - DevSize resource.Quantity `json:"devSize"` - PVSize resource.Quantity `json:"pvSize"` - PVUuid string `json:"pvUUID"` - Path string `json:"path"` -} - -type LvmVolumeGroupNode struct { - Devices []LvmVolumeGroupDevice `json:"devices"` - Name string `json:"name"` -} - -type LvmVolumeGroupThinPoolStatus struct { - Name string `json:"name"` - ActualSize resource.Quantity `json:"actualSize"` - UsedSize resource.Quantity `json:"usedSize"` - AllocatedSize resource.Quantity `json:"allocatedSize"` - AvailableSpace resource.Quantity `json:"availableSpace"` - AllocationLimit string `json:"allocationLimit"` - Ready bool `json:"ready"` - Message string `json:"message"` -} - -type LvmVolumeGroupThinPoolSpec struct { - Name string `json:"name"` - Size resource.Quantity `json:"size"` - AllocationLimit string `json:"allocationLimit"` -} diff --git a/images/sds-local-volume-scheduler-extender/api/v1alpha1/register.go b/images/sds-local-volume-scheduler-extender/api/v1alpha1/register.go deleted file mode 100644 index 41ffb5f8..00000000 --- a/images/sds-local-volume-scheduler-extender/api/v1alpha1/register.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright 2024 Flant JSC -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - LVMVolumeGroupKind = "LvmVolumeGroup" - APIGroup = "storage.deckhouse.io" - APIVersion = "v1alpha1" - TypeMediaAPIVersion = APIGroup + "/" + APIVersion -) - -// SchemeGroupVersion is group version used to register these objects -var ( - SchemeGroupVersion = schema.GroupVersion{ - Group: APIGroup, - Version: APIVersion, - } - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &LvmVolumeGroup{}, - &LvmVolumeGroupList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/images/sds-local-volume-scheduler-extender/api/v1alpha1/zz_generated.deepcopy.go b/images/sds-local-volume-scheduler-extender/api/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index 4d687bc1..00000000 --- a/images/sds-local-volume-scheduler-extender/api/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright 2024 Flant JSC -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import "k8s.io/apimachinery/pkg/runtime" - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LvmVolumeGroup) DeepCopyInto(out *LvmVolumeGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice. -func (in *LvmVolumeGroup) DeepCopy() *LvmVolumeGroup { - if in == nil { - return nil - } - out := new(LvmVolumeGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroup) 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 *LvmVolumeGroupList) DeepCopyInto(out *LvmVolumeGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LvmVolumeGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList. -func (in *LvmVolumeGroupList) DeepCopy() *LvmVolumeGroupList { - if in == nil { - return nil - } - out := new(LvmVolumeGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} diff --git a/images/sds-local-volume-scheduler-extender/cmd/cmd/root.go b/images/sds-local-volume-scheduler-extender/cmd/cmd/root.go index cb872491..09860692 100644 --- a/images/sds-local-volume-scheduler-extender/cmd/cmd/root.go +++ b/images/sds-local-volume-scheduler-extender/cmd/cmd/root.go @@ -20,10 +20,11 @@ import ( "context" "errors" "fmt" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "net/http" "os" "os/signal" - "sds-local-volume-scheduler-extender/api/v1alpha1" "sds-local-volume-scheduler-extender/pkg/cache" "sds-local-volume-scheduler-extender/pkg/controller" "sds-local-volume-scheduler-extender/pkg/kubutils" @@ -47,7 +48,8 @@ import ( var cfgFilePath string var resourcesSchemeFuncs = []func(*apiruntime.Scheme) error{ - v1alpha1.AddToScheme, + slv.AddToScheme, + snc.AddToScheme, v1.AddToScheme, sv1.AddToScheme, } diff --git a/images/sds-local-volume-scheduler-extender/go.mod b/images/sds-local-volume-scheduler-extender/go.mod index 29a8c643..5323a678 100644 --- a/images/sds-local-volume-scheduler-extender/go.mod +++ b/images/sds-local-volume-scheduler-extender/go.mod @@ -1,18 +1,19 @@ module sds-local-volume-scheduler-extender -go 1.21 +go 1.22.2 require ( + github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c + github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36 github.com/go-logr/logr v1.4.1 github.com/go-logr/zapr v1.3.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.26.0 - gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.29.1 - k8s.io/apimachinery v0.29.1 + k8s.io/apimachinery v0.30.2 k8s.io/client-go v0.29.0 - k8s.io/klog/v2 v2.110.1 + k8s.io/klog/v2 v2.120.1 k8s.io/utils v0.0.0-20240310230437-4693a0247e57 sigs.k8s.io/controller-runtime v0.17.2 sigs.k8s.io/yaml v1.4.0 @@ -30,7 +31,7 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -53,20 +54,21 @@ require ( github.com/spf13/pflag v1.0.5 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.23.0 // indirect golang.org/x/oauth2 v0.12.0 // indirect - golang.org/x/sys v0.16.0 // indirect - golang.org/x/term v0.15.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/term v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiextensions-apiserver v0.29.0 // indirect k8s.io/component-base v0.29.0 // indirect - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect + k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect ) diff --git a/images/sds-local-volume-scheduler-extender/go.sum b/images/sds-local-volume-scheduler-extender/go.sum index a22441c0..8b799fde 100644 --- a/images/sds-local-volume-scheduler-extender/go.sum +++ b/images/sds-local-volume-scheduler-extender/go.sum @@ -7,6 +7,10 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c h1:1hZBDe3aKqok/jOnbKfa5CMQ6viL/dsnsHujEaq+oxU= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c/go.mod h1:cYxHYJmIl6g9lXb1etqmLeQL/vsPMgscmact/FObd+U= +github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36 h1:ToJpGIAHud57Fxm5P1oULRibHpcCuysHqg5dgT0aeys= +github.com/deckhouse/sds-node-configurator/api v0.0.0-20240705070320-a7a740787b36/go.mod h1:H71+9G0Jr46Qs0BA3z3/xt0h9lbnJnCEYcaCJCWFBf0= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= @@ -15,7 +19,6 @@ github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1 github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -33,12 +36,10 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -77,10 +78,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY= -github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw= -github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= -github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= +github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY= +github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= +github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE= +github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -129,8 +130,8 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -139,10 +140,10 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -154,8 +155,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -164,10 +165,8 @@ gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -184,16 +183,16 @@ k8s.io/api v0.29.1 h1:DAjwWX/9YT7NQD4INu49ROJuZAAAP/Ijki48GUPzxqw= k8s.io/api v0.29.1/go.mod h1:7Kl10vBRUXhnQQI8YR/R327zXC8eJ7887/+Ybta+RoQ= k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= -k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc= -k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= k8s.io/component-base v0.29.0 h1:T7rjd5wvLnPBV1vC4zWd/iWRbV8Mdxs+nGaoaFzGw3s= k8s.io/component-base v0.29.0/go.mod h1:sADonFTQ9Zc9yFLghpDpmNXEdHyQmFIGbiuZbqAXQ1M= -k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= -k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= -k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= k8s.io/utils v0.0.0-20240310230437-4693a0247e57 h1:gbqbevonBh57eILzModw6mrkbwM0gQBEuevE/AaBsHY= k8s.io/utils v0.0.0-20240310230437-4693a0247e57/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= diff --git a/images/sds-local-volume-scheduler-extender/pkg/cache/cache.go b/images/sds-local-volume-scheduler-extender/pkg/cache/cache.go index e10a7c45..22860d99 100644 --- a/images/sds-local-volume-scheduler-extender/pkg/cache/cache.go +++ b/images/sds-local-volume-scheduler-extender/pkg/cache/cache.go @@ -3,9 +3,9 @@ package cache import ( "errors" "fmt" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" v1 "k8s.io/api/core/v1" slices2 "k8s.io/utils/strings/slices" - "sds-local-volume-scheduler-extender/api/v1alpha1" "sds-local-volume-scheduler-extender/pkg/consts" "sds-local-volume-scheduler-extender/pkg/logger" "sync" @@ -26,7 +26,7 @@ type Cache struct { } type lvgCache struct { - lvg *v1alpha1.LvmVolumeGroup + lvg *snc.LvmVolumeGroup thickPVCs sync.Map //map[string]*pvcCache thinPools sync.Map //map[string]*thinPoolCache } @@ -48,7 +48,7 @@ func NewCache(logger logger.Logger) *Cache { } // AddLVG adds selected LVMVolumeGroup resource to the cache. If it is already stored, does nothing. -func (c *Cache) AddLVG(lvg *v1alpha1.LvmVolumeGroup) { +func (c *Cache) AddLVG(lvg *snc.LvmVolumeGroup) { _, loaded := c.lvgs.LoadOrStore(lvg.Name, &lvgCache{ lvg: lvg, thickPVCs: sync.Map{}, @@ -73,7 +73,7 @@ func (c *Cache) AddLVG(lvg *v1alpha1.LvmVolumeGroup) { } // UpdateLVG updated selected LVMVolumeGroup resource in the cache. If such LVMVolumeGroup is not stored, returns an error. -func (c *Cache) UpdateLVG(lvg *v1alpha1.LvmVolumeGroup) error { +func (c *Cache) UpdateLVG(lvg *snc.LvmVolumeGroup) error { if lvgCh, found := c.lvgs.Load(lvg.Name); found { lvgCh.(*lvgCache).lvg = lvg @@ -100,7 +100,7 @@ func (c *Cache) UpdateLVG(lvg *v1alpha1.LvmVolumeGroup) error { } // TryGetLVG returns selected LVMVolumeGroup resource if it is stored in the cache, otherwise returns nil. -func (c *Cache) TryGetLVG(name string) *v1alpha1.LvmVolumeGroup { +func (c *Cache) TryGetLVG(name string) *snc.LvmVolumeGroup { lvgCh, found := c.lvgs.Load(name) if !found { c.log.Debug(fmt.Sprintf("[TryGetLVG] the LVMVolumeGroup %s was not found in the cache. Return nil", name)) @@ -122,8 +122,8 @@ func (c *Cache) GetLVGNamesByNodeName(nodeName string) []string { } // GetAllLVG returns all the LVMVolumeGroups resources stored in the cache. -func (c *Cache) GetAllLVG() map[string]*v1alpha1.LvmVolumeGroup { - lvgs := make(map[string]*v1alpha1.LvmVolumeGroup) +func (c *Cache) GetAllLVG() map[string]*snc.LvmVolumeGroup { + lvgs := make(map[string]*snc.LvmVolumeGroup) c.lvgs.Range(func(lvgName, lvgCh any) bool { if lvgCh.(*lvgCache).lvg == nil { c.log.Error(fmt.Errorf("LVMVolumeGroup %s is not initialized", lvgName), fmt.Sprintf("[GetAllLVG] an error occurs while iterating the LVMVolumeGroups")) diff --git a/images/sds-local-volume-scheduler-extender/pkg/cache/cache_test.go b/images/sds-local-volume-scheduler-extender/pkg/cache/cache_test.go index 9d4d742f..3af75605 100644 --- a/images/sds-local-volume-scheduler-extender/pkg/cache/cache_test.go +++ b/images/sds-local-volume-scheduler-extender/pkg/cache/cache_test.go @@ -2,18 +2,18 @@ package cache import ( "fmt" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "sds-local-volume-scheduler-extender/api/v1alpha1" "sds-local-volume-scheduler-extender/pkg/logger" "testing" ) func BenchmarkCache_DeleteLVG(b *testing.B) { cache := NewCache(logger.Logger{}) - lvg := &v1alpha1.LvmVolumeGroup{ + lvg := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "first", }, @@ -32,7 +32,7 @@ func BenchmarkCache_DeleteLVG(b *testing.B) { func BenchmarkCache_GetLVGReservedSpace(b *testing.B) { cache := NewCache(logger.Logger{}) - lvg := &v1alpha1.LvmVolumeGroup{ + lvg := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "first", }, @@ -99,32 +99,32 @@ func BenchmarkCache_GetLVGReservedSpace(b *testing.B) { func BenchmarkCache_AddPVC(b *testing.B) { cache := NewCache(logger.Logger{}) - lvg1 := &v1alpha1.LvmVolumeGroup{ + lvg1 := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "first", }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ {Name: "test-node1"}, }, }, } - lvg2 := &v1alpha1.LvmVolumeGroup{ + lvg2 := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "second", }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ {Name: "test-node2"}, }, }, } - lvg3 := &v1alpha1.LvmVolumeGroup{ + lvg3 := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "third", }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ {Name: "test-node3"}, }, }, @@ -168,14 +168,14 @@ func BenchmarkCache_GetAllLVG(b *testing.B) { cache := NewCache(logger.Logger{}) lvgs := map[string]*lvgCache{ "first": { - lvg: &v1alpha1.LvmVolumeGroup{ + lvg: &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "first", }, }, }, "second": { - lvg: &v1alpha1.LvmVolumeGroup{ + lvg: &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "second", }, @@ -223,7 +223,7 @@ func BenchmarkCache_TryGetLVG(b *testing.B) { cache := NewCache(logger.Logger{}) name := "test-name" - lvg := &v1alpha1.LvmVolumeGroup{ + lvg := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: name, }, @@ -247,12 +247,12 @@ func BenchmarkCache_AddLVG(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i++ - lvg1 := &v1alpha1.LvmVolumeGroup{ + lvg1 := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i), }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: "test-1", }, @@ -260,12 +260,12 @@ func BenchmarkCache_AddLVG(b *testing.B) { }, } - lvg2 := &v1alpha1.LvmVolumeGroup{ + lvg2 := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i+1), }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: "test-1", }, @@ -273,12 +273,12 @@ func BenchmarkCache_AddLVG(b *testing.B) { }, } - lvg3 := &v1alpha1.LvmVolumeGroup{ + lvg3 := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i+2), }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: "test-1", }, @@ -299,21 +299,21 @@ func BenchmarkCache_AddLVG(b *testing.B) { func TestCache_UpdateLVG(t *testing.T) { cache := NewCache(logger.Logger{}) name := "test-lvg" - lvg := &v1alpha1.LvmVolumeGroup{ + lvg := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Status: v1alpha1.LvmVolumeGroupStatus{ + Status: snc.LvmVolumeGroupStatus{ AllocatedSize: resource.MustParse("1Gi"), }, } cache.AddLVG(lvg) - newLVG := &v1alpha1.LvmVolumeGroup{ + newLVG := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Status: v1alpha1.LvmVolumeGroupStatus{ + Status: snc.LvmVolumeGroupStatus{ AllocatedSize: resource.MustParse("2Gi"), }, } @@ -332,7 +332,7 @@ func BenchmarkCache_UpdateLVG(b *testing.B) { name := "test-name" i := 0 - lvg := &v1alpha1.LvmVolumeGroup{ + lvg := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: name, }, @@ -347,11 +347,11 @@ func BenchmarkCache_UpdateLVG(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i++ - updated := &v1alpha1.LvmVolumeGroup{ + updated := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: name, }, - Status: v1alpha1.LvmVolumeGroupStatus{ + Status: snc.LvmVolumeGroupStatus{ AllocatedSize: resource.MustParse(fmt.Sprintf("2%dGi", i)), }, } @@ -367,12 +367,12 @@ func BenchmarkCache_UpdateLVG(b *testing.B) { func BenchmarkCache_UpdatePVC(b *testing.B) { cache := NewCache(logger.Logger{}) i := 0 - lvg := &v1alpha1.LvmVolumeGroup{ + lvg := &snc.LvmVolumeGroup{ ObjectMeta: metav1.ObjectMeta{ Name: "test-lvg", }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: "test-node", }, @@ -424,13 +424,13 @@ func BenchmarkCache_FullLoad(b *testing.B) { for pb.Next() { i++ - lvgs := []*v1alpha1.LvmVolumeGroup{ + lvgs := []*snc.LvmVolumeGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i), }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: nodeName, }, @@ -442,8 +442,8 @@ func BenchmarkCache_FullLoad(b *testing.B) { ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i+1), }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: nodeName, }, @@ -455,8 +455,8 @@ func BenchmarkCache_FullLoad(b *testing.B) { ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i+2), }, - Status: v1alpha1.LvmVolumeGroupStatus{ - Nodes: []v1alpha1.LvmVolumeGroupNode{ + Status: snc.LvmVolumeGroupStatus{ + Nodes: []snc.LvmVolumeGroupNode{ { Name: nodeName, }, @@ -499,12 +499,12 @@ func BenchmarkCache_FullLoad(b *testing.B) { } } - updatedLvgs := []*v1alpha1.LvmVolumeGroup{ + updatedLvgs := []*snc.LvmVolumeGroup{ { ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i), }, - Status: v1alpha1.LvmVolumeGroupStatus{ + Status: snc.LvmVolumeGroupStatus{ AllocatedSize: resource.MustParse(fmt.Sprintf("1%dGi", i+1)), }, }, @@ -512,7 +512,7 @@ func BenchmarkCache_FullLoad(b *testing.B) { ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i+1), }, - Status: v1alpha1.LvmVolumeGroupStatus{ + Status: snc.LvmVolumeGroupStatus{ AllocatedSize: resource.MustParse(fmt.Sprintf("1%dGi", i+1)), }, }, @@ -520,7 +520,7 @@ func BenchmarkCache_FullLoad(b *testing.B) { ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("test-lvg-%d", i+2), }, - Status: v1alpha1.LvmVolumeGroupStatus{ + Status: snc.LvmVolumeGroupStatus{ AllocatedSize: resource.MustParse(fmt.Sprintf("1%dGi", i+1)), }, }, diff --git a/images/sds-local-volume-scheduler-extender/pkg/controller/lvg_watcher_cache.go b/images/sds-local-volume-scheduler-extender/pkg/controller/lvg_watcher_cache.go index ffc8d69c..1ff74047 100644 --- a/images/sds-local-volume-scheduler-extender/pkg/controller/lvg_watcher_cache.go +++ b/images/sds-local-volume-scheduler-extender/pkg/controller/lvg_watcher_cache.go @@ -4,10 +4,10 @@ import ( "context" "errors" "fmt" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" v1 "k8s.io/api/core/v1" "k8s.io/client-go/util/workqueue" "reflect" - "sds-local-volume-scheduler-extender/api/v1alpha1" "sds-local-volume-scheduler-extender/pkg/cache" "sds-local-volume-scheduler-extender/pkg/logger" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -39,11 +39,11 @@ func RunLVGWatcherCacheController( return nil, err } - err = c.Watch(source.Kind(mgr.GetCache(), &v1alpha1.LvmVolumeGroup{}), handler.Funcs{ + err = c.Watch(source.Kind(mgr.GetCache(), &snc.LvmVolumeGroup{}), handler.Funcs{ CreateFunc: func(ctx context.Context, e event.CreateEvent, q workqueue.RateLimitingInterface) { log.Info(fmt.Sprintf("[RunLVGWatcherCacheController] CreateFunc starts the cache reconciliation for the LVMVolumeGroup %s", e.Object.GetName())) - lvg, ok := e.Object.(*v1alpha1.LvmVolumeGroup) + lvg, ok := e.Object.(*snc.LvmVolumeGroup) if !ok { err = errors.New("unable to cast event object to a given type") log.Error(err, "[RunLVGWatcherCacheController] an error occurred while handling create event") @@ -92,14 +92,14 @@ func RunLVGWatcherCacheController( }, UpdateFunc: func(ctx context.Context, e event.UpdateEvent, q workqueue.RateLimitingInterface) { log.Info(fmt.Sprintf("[RunCacheWatcherController] UpdateFunc starts the cache reconciliation for the LVMVolumeGroup %s", e.ObjectNew.GetName())) - oldLvg, ok := e.ObjectOld.(*v1alpha1.LvmVolumeGroup) + oldLvg, ok := e.ObjectOld.(*snc.LvmVolumeGroup) if !ok { err = errors.New("unable to cast event object to a given type") log.Error(err, "[RunLVGWatcherCacheController] an error occurred while handling create event") return } - newLvg, ok := e.ObjectNew.(*v1alpha1.LvmVolumeGroup) + newLvg, ok := e.ObjectNew.(*snc.LvmVolumeGroup) if !ok { err = errors.New("unable to cast event object to a given type") log.Error(err, "[RunLVGWatcherCacheController] an error occurred while handling create event") @@ -142,7 +142,7 @@ func RunLVGWatcherCacheController( }, DeleteFunc: func(ctx context.Context, e event.DeleteEvent, q workqueue.RateLimitingInterface) { log.Info(fmt.Sprintf("[RunCacheWatcherController] DeleteFunc starts the cache reconciliation for the LVMVolumeGroup %s", e.Object.GetName())) - lvg, ok := e.Object.(*v1alpha1.LvmVolumeGroup) + lvg, ok := e.Object.(*snc.LvmVolumeGroup) if !ok { err = errors.New("unable to cast event object to a given type") log.Error(err, "[RunLVGWatcherCacheController] an error occurred while handling create event") @@ -160,7 +160,7 @@ func RunLVGWatcherCacheController( return c, nil } -func shouldReconcileLVG(oldLVG, newLVG *v1alpha1.LvmVolumeGroup) bool { +func shouldReconcileLVG(oldLVG, newLVG *snc.LvmVolumeGroup) bool { if newLVG.DeletionTimestamp != nil { return false } diff --git a/images/sds-local-volume-scheduler-extender/pkg/scheduler/filter.go b/images/sds-local-volume-scheduler-extender/pkg/scheduler/filter.go index 8e1e916b..73139325 100644 --- a/images/sds-local-volume-scheduler-extender/pkg/scheduler/filter.go +++ b/images/sds-local-volume-scheduler-extender/pkg/scheduler/filter.go @@ -21,12 +21,12 @@ import ( "encoding/json" "errors" "fmt" + snc "github.com/deckhouse/sds-node-configurator/api/v1alpha1" corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/storage/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/utils/strings/slices" "net/http" - "sds-local-volume-scheduler-extender/api/v1alpha1" "sds-local-volume-scheduler-extender/pkg/cache" "sds-local-volume-scheduler-extender/pkg/consts" "sds-local-volume-scheduler-extender/pkg/logger" @@ -477,7 +477,7 @@ func filterNodes( return result, nil } -func getLVGThinFreeSpaces(lvgs map[string]*v1alpha1.LvmVolumeGroup) map[string]map[string]int64 { +func getLVGThinFreeSpaces(lvgs map[string]*snc.LvmVolumeGroup) map[string]map[string]int64 { result := make(map[string]map[string]int64, len(lvgs)) for _, lvg := range lvgs { @@ -493,7 +493,7 @@ func getLVGThinFreeSpaces(lvgs map[string]*v1alpha1.LvmVolumeGroup) map[string]m return result } -func getLVGThickFreeSpaces(lvgs map[string]*v1alpha1.LvmVolumeGroup) map[string]int64 { +func getLVGThickFreeSpaces(lvgs map[string]*snc.LvmVolumeGroup) map[string]int64 { result := make(map[string]int64, len(lvgs)) for _, lvg := range lvgs { @@ -503,7 +503,7 @@ func getLVGThickFreeSpaces(lvgs map[string]*v1alpha1.LvmVolumeGroup) map[string] return result } -func findMatchedThinPool(thinPools []v1alpha1.LvmVolumeGroupThinPoolStatus, name string) *v1alpha1.LvmVolumeGroupThinPoolStatus { +func findMatchedThinPool(thinPools []snc.LvmVolumeGroupThinPoolStatus, name string) *snc.LvmVolumeGroupThinPoolStatus { for _, tp := range thinPools { if tp.Name == name { return &tp @@ -513,7 +513,7 @@ func findMatchedThinPool(thinPools []v1alpha1.LvmVolumeGroupThinPoolStatus, name return nil } -func findMatchedLVG(nodeLVGs []*v1alpha1.LvmVolumeGroup, scLVGs LVMVolumeGroups) *LVMVolumeGroup { +func findMatchedLVG(nodeLVGs []*snc.LvmVolumeGroup, scLVGs LVMVolumeGroups) *LVMVolumeGroup { nodeLVGNames := make(map[string]struct{}, len(nodeLVGs)) for _, lvg := range nodeLVGs { nodeLVGNames[lvg.Name] = struct{}{} @@ -528,8 +528,8 @@ func findMatchedLVG(nodeLVGs []*v1alpha1.LvmVolumeGroup, scLVGs LVMVolumeGroups) return nil } -func getCommonNodesByStorageClasses(scs map[string]*v1.StorageClass, nodesWithLVGs map[string][]*v1alpha1.LvmVolumeGroup) (map[string][]*v1alpha1.LvmVolumeGroup, error) { - result := make(map[string][]*v1alpha1.LvmVolumeGroup, len(nodesWithLVGs)) +func getCommonNodesByStorageClasses(scs map[string]*v1.StorageClass, nodesWithLVGs map[string][]*snc.LvmVolumeGroup) (map[string][]*snc.LvmVolumeGroup, error) { + result := make(map[string][]*snc.LvmVolumeGroup, len(nodesWithLVGs)) for nodeName, lvgs := range nodesWithLVGs { lvgNames := make(map[string]struct{}, len(lvgs)) @@ -566,8 +566,8 @@ func getCommonNodesByStorageClasses(scs map[string]*v1.StorageClass, nodesWithLV return result, nil } -func RemoveUnusedLVGs(lvgs map[string]*v1alpha1.LvmVolumeGroup, scsLVGs map[string]LVMVolumeGroups) map[string]*v1alpha1.LvmVolumeGroup { - result := make(map[string]*v1alpha1.LvmVolumeGroup, len(lvgs)) +func RemoveUnusedLVGs(lvgs map[string]*snc.LvmVolumeGroup, scsLVGs map[string]LVMVolumeGroups) map[string]*snc.LvmVolumeGroup { + result := make(map[string]*snc.LvmVolumeGroup, len(lvgs)) usedLvgs := make(map[string]struct{}, len(lvgs)) for _, scLvgs := range scsLVGs { @@ -619,8 +619,8 @@ func ExtractLVGsFromSC(sc *v1.StorageClass) (LVMVolumeGroups, error) { return lvmVolumeGroups, nil } -func SortLVGsByNodeName(lvgs map[string]*v1alpha1.LvmVolumeGroup) map[string][]*v1alpha1.LvmVolumeGroup { - sorted := make(map[string][]*v1alpha1.LvmVolumeGroup, len(lvgs)) +func SortLVGsByNodeName(lvgs map[string]*snc.LvmVolumeGroup) map[string][]*snc.LvmVolumeGroup { + sorted := make(map[string][]*snc.LvmVolumeGroup, len(lvgs)) for _, lvg := range lvgs { for _, node := range lvg.Status.Nodes { sorted[node.Name] = append(sorted[node.Name], lvg) diff --git a/images/webhooks/src/go.mod b/images/webhooks/src/go.mod index 18ecabc0..c821aefb 100644 --- a/images/webhooks/src/go.mod +++ b/images/webhooks/src/go.mod @@ -1,14 +1,13 @@ module webhooks -go 1.22.1 - -toolchain go1.22.2 +go 1.22.2 require ( + github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c github.com/sirupsen/logrus v1.9.3 github.com/slok/kubewebhook/v2 v2.6.0 k8s.io/api v0.30.0 - k8s.io/apimachinery v0.30.0 + k8s.io/apimachinery v0.30.2 k8s.io/client-go v0.30.0 k8s.io/klog/v2 v2.120.1 ) diff --git a/images/webhooks/src/go.sum b/images/webhooks/src/go.sum index a36d47ce..096ba14a 100644 --- a/images/webhooks/src/go.sum +++ b/images/webhooks/src/go.sum @@ -1,6 +1,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c h1:1hZBDe3aKqok/jOnbKfa5CMQ6viL/dsnsHujEaq+oxU= +github.com/deckhouse/sds-local-volume/api v0.0.0-20240704080736-a027a963cc2c/go.mod h1:cYxHYJmIl6g9lXb1etqmLeQL/vsPMgscmact/FObd+U= github.com/emicklei/go-restful/v3 v3.12.0 h1:y2DdzBAURM29NFF94q6RaY4vjIH1rtwDapwQtU84iWk= github.com/emicklei/go-restful/v3 v3.12.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= @@ -132,8 +134,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.30.0 h1:siWhRq7cNjy2iHssOB9SCGNCl2spiF1dO3dABqZ8niA= k8s.io/api v0.30.0/go.mod h1:OPlaYhoHs8EQ1ql0R/TsUgaRPhpKNxIMrKQfWUp8QSE= -k8s.io/apimachinery v0.30.0 h1:qxVPsyDM5XS96NIh9Oj6LavoVFYff/Pon9cZeDIkHHA= -k8s.io/apimachinery v0.30.0/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg= +k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= k8s.io/client-go v0.30.0 h1:sB1AGGlhY/o7KCyCEQ0bPWzYDL0pwOZO4vAtTSh/gJQ= k8s.io/client-go v0.30.0/go.mod h1:g7li5O5256qe6TYdAMyX/otJqMhIiGgTapdLchhmOaY= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= diff --git a/images/webhooks/src/handlers/lscValidator.go b/images/webhooks/src/handlers/lscValidator.go index 145486dd..132a7bd2 100644 --- a/images/webhooks/src/handlers/lscValidator.go +++ b/images/webhooks/src/handlers/lscValidator.go @@ -18,7 +18,7 @@ package handlers import ( "context" - "webhooks/v1alpha1" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" "github.com/slok/kubewebhook/v2/pkg/model" kwhvalidating "github.com/slok/kubewebhook/v2/pkg/webhook/validating" @@ -26,7 +26,7 @@ import ( ) func LSCValidate(ctx context.Context, _ *model.AdmissionReview, obj metav1.Object) (*kwhvalidating.ValidatorResult, error) { - lsc, ok := obj.(*v1alpha1.LocalStorageClass) + lsc, ok := obj.(*slv.LocalStorageClass) if !ok { // If not a storage class just continue the validation chain(if there is one) and do nothing. return &kwhvalidating.ValidatorResult{}, nil diff --git a/images/webhooks/src/main.go b/images/webhooks/src/main.go index 88d69272..652cee8c 100644 --- a/images/webhooks/src/main.go +++ b/images/webhooks/src/main.go @@ -19,10 +19,10 @@ package main import ( "flag" "fmt" + slv "github.com/deckhouse/sds-local-volume/api/v1alpha1" "net/http" "os" "webhooks/handlers" - "webhooks/v1alpha1" "github.com/sirupsen/logrus" kwhlogrus "github.com/slok/kubewebhook/v2/pkg/log/logrus" @@ -71,7 +71,7 @@ func main() { os.Exit(1) } - lscValidatingWebhookHandler, err := handlers.GetValidatingWebhookHandler(handlers.LSCValidate, LSCValidatorId, &v1alpha1.LocalStorageClass{}, logger) + lscValidatingWebhookHandler, err := handlers.GetValidatingWebhookHandler(handlers.LSCValidate, LSCValidatorId, &slv.LocalStorageClass{}, logger) if err != nil { fmt.Fprintf(os.Stderr, "error creating lscValidatingWebhookHandler: %s", err) os.Exit(1) diff --git a/images/webhooks/src/v1alpha1/local_storage_class.go b/images/webhooks/src/v1alpha1/local_storage_class.go deleted file mode 100644 index 015ffe46..00000000 --- a/images/webhooks/src/v1alpha1/local_storage_class.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - -type LocalStorageClass struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - Spec LocalStorageClassSpec `json:"spec"` - Status *LocalStorageClassStatus `json:"status,omitempty"` -} - -// LocalStorageClassList contains a list of empty block device -type LocalStorageClassList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - Items []LocalStorageClass `json:"items"` -} - -type LocalStorageClassSpec struct { - ReclaimPolicy string `json:"reclaimPolicy"` - VolumeBindingMode string `json:"volumeBindingMode"` - LVM *LocalStorageClassLVM `json:"lvm,omitempty"` -} - -type LocalStorageClassLVM struct { - Type string `json:"type"` - LVMVolumeGroups []LocalStorageClassLVG `json:"lvmVolumeGroups"` -} - -type LocalStorageClassStatus struct { - Phase string `json:"phase,omitempty"` - Reason string `json:"reason,omitempty"` -} - -type LocalStorageClassLVG struct { - Name string `json:"name"` - Thin *LocalStorageClassThinPool `json:"thin,omitempty"` -} - -type LocalStorageClassThinPool struct { - PoolName string `json:"poolName"` -} diff --git a/images/webhooks/src/v1alpha1/lvm_volume_group.go b/images/webhooks/src/v1alpha1/lvm_volume_group.go deleted file mode 100644 index 52123b9d..00000000 --- a/images/webhooks/src/v1alpha1/lvm_volume_group.go +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright 2024 Flant JSC -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type LvmVolumeGroupList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - - Items []LvmVolumeGroup `json:"items"` -} - -type LvmVolumeGroup struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec LvmVolumeGroupSpec `json:"spec"` - Status LvmVolumeGroupStatus `json:"status,omitempty"` -} - -type SpecThinPool struct { - Name string `json:"name"` - Size resource.Quantity `json:"size"` -} - -type LvmVolumeGroupSpec struct { - ActualVGNameOnTheNode string `json:"actualVGNameOnTheNode"` - BlockDeviceNames []string `json:"blockDeviceNames"` - ThinPools []SpecThinPool `json:"thinPools"` - Type string `json:"type"` -} - -type LvmVolumeGroupDevice struct { - BlockDevice string `json:"blockDevice"` - DevSize resource.Quantity `json:"devSize"` - PVSize string `json:"pvSize"` - PVUuid string `json:"pvUUID"` - Path string `json:"path"` -} - -type LvmVolumeGroupNode struct { - Devices []LvmVolumeGroupDevice `json:"devices"` - Name string `json:"name"` -} - -type StatusThinPool struct { - Name string `json:"name"` - ActualSize resource.Quantity `json:"actualSize"` - UsedSize string `json:"usedSize"` -} - -type LvmVolumeGroupStatus struct { - AllocatedSize string `json:"allocatedSize"` - Health string `json:"health"` - Message string `json:"message"` - Nodes []LvmVolumeGroupNode `json:"nodes"` - ThinPools []StatusThinPool `json:"thinPools"` - VGSize string `json:"vgSize"` - VGUuid string `json:"vgUUID"` -} diff --git a/images/webhooks/src/v1alpha1/register.go b/images/webhooks/src/v1alpha1/register.go deleted file mode 100644 index e7a5d0dc..00000000 --- a/images/webhooks/src/v1alpha1/register.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/schema" -) - -const ( - LocalStorageClassKind = "LocalStorageClass" - APIGroup = "storage.deckhouse.io" - APIVersion = "v1alpha1" -) - -// SchemeGroupVersion is group version used to register these objects -var ( - SchemeGroupVersion = schema.GroupVersion{ - Group: APIGroup, - Version: APIVersion, - } - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - AddToScheme = SchemeBuilder.AddToScheme -) - -// Adds the list of known types to Scheme. -func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &LocalStorageClass{}, - &LocalStorageClassList{}, - &LvmVolumeGroup{}, - &LvmVolumeGroupList{}, - ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) - return nil -} diff --git a/images/webhooks/src/v1alpha1/zz_generated.deepcopy.go b/images/webhooks/src/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index abf5c426..00000000 --- a/images/webhooks/src/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,135 +0,0 @@ -/* -Copyright 2024 Flant JSC - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1alpha1 - -import "k8s.io/apimachinery/pkg/runtime" - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *LocalStorageClass) DeepCopyInto(out *LocalStorageClass) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice. -func (in *LocalStorageClass) DeepCopy() *LocalStorageClass { - if in == nil { - return nil - } - out := new(LocalStorageClass) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LocalStorageClass) 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 *LocalStorageClassList) DeepCopyInto(out *LocalStorageClassList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LocalStorageClass, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList. -func (in *LocalStorageClassList) DeepCopy() *LocalStorageClassList { - if in == nil { - return nil - } - out := new(LocalStorageClassList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LocalStorageClassList) 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 *LvmVolumeGroup) DeepCopyInto(out *LvmVolumeGroup) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EmptyBlockDevice. -func (in *LvmVolumeGroup) DeepCopy() *LvmVolumeGroup { - if in == nil { - return nil - } - out := new(LvmVolumeGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroup) 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 *LvmVolumeGroupList) DeepCopyInto(out *LvmVolumeGroupList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]LvmVolumeGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GuestbookList. -func (in *LvmVolumeGroupList) DeepCopy() *LvmVolumeGroupList { - if in == nil { - return nil - } - out := new(LvmVolumeGroupList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *LvmVolumeGroupList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} diff --git a/images/webhooks/werf.inc.yaml b/images/webhooks/werf.inc.yaml index 50aafafb..7877c299 100644 --- a/images/webhooks/werf.inc.yaml +++ b/images/webhooks/werf.inc.yaml @@ -1,6 +1,6 @@ --- image: webhooks -from: "registry.deckhouse.io/base_images/golang:1.22.1-alpine@sha256:0de6cf7cceab6ecbf0718bdfb675b08b78113c3709c5e4b99456cdb2ae8c2495" +from: "registry.deckhouse.io/base_images/golang:1.22.3-alpine@sha256:dbf216b880b802c22e3f4f2ef0a78396b4a9a6983cb9b767c5efc351ebf946b0" git: - add: /images/webhooks/src