From 32ed1f35c9a05c2be1d803f55e961bc8f044946c Mon Sep 17 00:00:00 2001 From: Oliver <69219753+ostempel@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:32:30 +0100 Subject: [PATCH] Add disableCsiLvm feature gate (#438) --- Makefile | 4 ++-- .../shoot-storageclasses/templates/storageclasses.yaml | 2 ++ charts/internal/shoot-storageclasses/values.yaml | 5 +++-- example/controller-registration.yaml | 2 +- pkg/apis/metal/types_controlplane.go | 5 +++++ pkg/apis/metal/v1alpha1/types_controlplane.go | 5 +++++ pkg/apis/metal/v1alpha1/zz_generated.conversion.go | 2 ++ pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go | 5 +++++ pkg/apis/metal/zz_generated.deepcopy.go | 5 +++++ pkg/controller/controlplane/valuesprovider.go | 6 ++++++ 10 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bdcc0a43..b71a141b 100644 --- a/Makefile +++ b/Makefile @@ -83,11 +83,11 @@ check: $(GOIMPORTS) $(GOLANGCI_LINT) $(HELM) .PHONY: generate generate: $(VGOPATH) $(HELM) $(YQ) + echo $(shell git -c safe.directory=/go/src/github.com/metal-stack/gardener-extension-provider-metal describe --abbrev=0 --tags) > VERSION @REPO_ROOT=$(REPO_ROOT) VGOPATH=$(VGOPATH) GARDENER_HACK_DIR=$(GARDENER_HACK_DIR) bash $(GARDENER_HACK_DIR)/generate-sequential.sh ./charts/... ./cmd/... ./pkg/... .PHONY: generate-in-docker -generate-in-docker: tidy update-crds $(HELM) - echo $(shell git describe --abbrev=0 --tags) > VERSION +generate-in-docker: tidy install update-crds $(HELM) docker run --rm -i$(DOCKER_TTY_ARG) \ --volume $(PWD):/go/src/github.com/metal-stack/gardener-extension-provider-metal golang:$(GO_VERSION) \ sh -c "cd /go/src/github.com/metal-stack/gardener-extension-provider-metal \ diff --git a/charts/internal/shoot-storageclasses/templates/storageclasses.yaml b/charts/internal/shoot-storageclasses/templates/storageclasses.yaml index cea045f1..c98126b6 100644 --- a/charts/internal/shoot-storageclasses/templates/storageclasses.yaml +++ b/charts/internal/shoot-storageclasses/templates/storageclasses.yaml @@ -1,3 +1,4 @@ +{{ if not .Values.disableCsiLvm }} --- apiVersion: v1 kind: Namespace @@ -255,3 +256,4 @@ spec: path: /run/lock/lvm type: DirectoryOrCreate name: lvmlock +{{ end }} diff --git a/charts/internal/shoot-storageclasses/values.yaml b/charts/internal/shoot-storageclasses/values.yaml index fee4fabe..26bfb9b3 100644 --- a/charts/internal/shoot-storageclasses/values.yaml +++ b/charts/internal/shoot-storageclasses/values.yaml @@ -1,6 +1,7 @@ --- images: - csi-lvm-controller: image-repository:image-tag - csi-lvm-provisioner: image-repository:image-tag + csi-lvm-controller: image-repository:image-tag + csi-lvm-provisioner: image-repository:image-tag isDefaultStorageClass: true +disableCsiLvm: false diff --git a/example/controller-registration.yaml b/example/controller-registration.yaml index efaeadf7..2597d56a 100644 --- a/example/controller-registration.yaml +++ b/example/controller-registration.yaml @@ -7,7 +7,7 @@ helm: rawChart: H4sIAAAAAAAAA+0ca2/cNjKf9SuIdQ9tD5H24bUdCMihru0mvib2wvaldyiKgCtxdxVrRVWU7Lhp/vsNX3prtbJTp2k1MOAVxRkOyZnhcDjUEkcuCUhkkvcxCZhHAzOM6I3nQtGaxNgfPnkwjAAO9vbEf4Dyf/F7vDsdT/Ym+/u8fLy/O5o+QXsPb7odEhbjCKEnEaXxpnpt779QWLbO/9EKR7F1h9f+fdvgE7w/nTbO/2R3Wpz/CRSNnqDRp+xoE/zN5x+H3hsS8Xm30c3YwGGYPg7G1mhguIQ5kRfGougQvST+GjlcJNCCRiheEfRCiRB6zeUFzZT4oFSijACviY1aRc240U2PLGjb+Nxj83eAdv13qWMt6UPaaNP/vXHZ/h/sHkx7/X8MGA6X1F5yCcAxQWyFTAcN5hh+fPXi8OL45Ozk4u3Lw6Mf3x6fXgx1PdOhQRxR3wchicjSYzGUguhYgFaUHmShr75xcIwsawh/b04uLk/Pz75Vj+Q9Xoc+GTaR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6oX+L75hh5I9ZbTQ2svgM+vDRMHIugo2ejZ6NjCz1ThSMDSOXMas+CZCeqMg9RSkLWCbeFY9JNlRM4/KyTl3+tY12eXaLPFLZ1GZT2rONFthnxDCqab42+vkXo5S0K8qMHVSX98M/g8Czmjx1H3wnlwEU4oTJDGORPGjI7Cc54Bf56fbiVTK3HLoeZg56/ufcp/PhGnP3ajhPPB/caE56KG+D8jx+Qyef5ahKGVpSuvTJ2+xehMQ18drdnyo0ITeDXf65WVmQfgh2bI3H1vsvu1fjSq8G/3rOezaRLyzLMoyC/2gbMldQJ3xyb9TY2YGymJ8dMPG9SqUrTxGxlhZi+qbT/A4Jpz67VgSYWrE4YaAjL0elF5U0rnhp6JvY+u6USmo0nJS1+q9a1H3TAvZJXN15peE7RgOtK9n3JWpriC8/jEcyhUx9lmEsdK749QOuF6UvBNTe+ef1Nny0QL7OrvOX7qlnV/l1gb6cL/kr3LdPb9sbOiuueoPeKDVRuAifXoOXJkIWli+sc2NZc9XndHEGjUD3iYiz1t4Cb7oDbqQf/ZPSR9RgaCOvvqrS+2M99NBDDz300EMPPfTQQw899NBDDz300EMPPfTQQw9/bvg/9RxdmAB4AAA= values: image: - tag: v0.25.0 + tag: v0.25.2 --- apiVersion: core.gardener.cloud/v1beta1 kind: ControllerRegistration diff --git a/pkg/apis/metal/types_controlplane.go b/pkg/apis/metal/types_controlplane.go index 365c4088..ee72254d 100644 --- a/pkg/apis/metal/types_controlplane.go +++ b/pkg/apis/metal/types_controlplane.go @@ -63,6 +63,11 @@ type ControlPlaneFeatures struct { // Deprecated: This is not used anymore. The gardener-extension-audit handles cluster auditing. // +optional AuditToSplunk *bool + + // DisableCsiLvm disables the deployment of the csi-lvm driver for the control plane. + // In order to deploy the new csi-driver-lvm, the feature gate must be enabled so the old driver is removed. + // +optional + DisableCsiLvm *bool `json:"disableCsiLvm,omitempty"` } // CloudControllerManagerConfig contains configuration settings for the cloud-controller-manager. diff --git a/pkg/apis/metal/v1alpha1/types_controlplane.go b/pkg/apis/metal/v1alpha1/types_controlplane.go index 4f3a9b56..b530dec5 100644 --- a/pkg/apis/metal/v1alpha1/types_controlplane.go +++ b/pkg/apis/metal/v1alpha1/types_controlplane.go @@ -62,6 +62,11 @@ type ControlPlaneFeatures struct { // Deprecated: This is not used anymore. The gardener-extension-audit handles cluster auditing. // +optional AuditToSplunk *bool `json:"auditToSplunk,omitempty"` + + // DisableCsiLvm disables the deployment of the csi-lvm driver for the control plane. + // In order to deploy the new csi-driver-lvm, the feature gate must be enabled so the old driver is removed. + // +optional + DisableCsiLvm *bool `json:"disableCsiLvm,omitempty"` } // CloudControllerManagerConfig contains configuration settings for the cloud-controller-manager. diff --git a/pkg/apis/metal/v1alpha1/zz_generated.conversion.go b/pkg/apis/metal/v1alpha1/zz_generated.conversion.go index a13f891b..8f2cbc99 100644 --- a/pkg/apis/metal/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/metal/v1alpha1/zz_generated.conversion.go @@ -337,6 +337,7 @@ func autoConvert_v1alpha1_ControlPlaneFeatures_To_metal_ControlPlaneFeatures(in out.RestrictEgress = (*bool)(unsafe.Pointer(in.RestrictEgress)) out.ClusterAudit = (*bool)(unsafe.Pointer(in.ClusterAudit)) out.AuditToSplunk = (*bool)(unsafe.Pointer(in.AuditToSplunk)) + out.DisableCsiLvm = (*bool)(unsafe.Pointer(in.DisableCsiLvm)) return nil } @@ -351,6 +352,7 @@ func autoConvert_metal_ControlPlaneFeatures_To_v1alpha1_ControlPlaneFeatures(in out.RestrictEgress = (*bool)(unsafe.Pointer(in.RestrictEgress)) out.ClusterAudit = (*bool)(unsafe.Pointer(in.ClusterAudit)) out.AuditToSplunk = (*bool)(unsafe.Pointer(in.AuditToSplunk)) + out.DisableCsiLvm = (*bool)(unsafe.Pointer(in.DisableCsiLvm)) return nil } diff --git a/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go index f3a544fb..938d56de 100644 --- a/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go @@ -168,6 +168,11 @@ func (in *ControlPlaneFeatures) DeepCopyInto(out *ControlPlaneFeatures) { *out = new(bool) **out = **in } + if in.DisableCsiLvm != nil { + in, out := &in.DisableCsiLvm, &out.DisableCsiLvm + *out = new(bool) + **out = **in + } return } diff --git a/pkg/apis/metal/zz_generated.deepcopy.go b/pkg/apis/metal/zz_generated.deepcopy.go index d855557c..52441a16 100644 --- a/pkg/apis/metal/zz_generated.deepcopy.go +++ b/pkg/apis/metal/zz_generated.deepcopy.go @@ -168,6 +168,11 @@ func (in *ControlPlaneFeatures) DeepCopyInto(out *ControlPlaneFeatures) { *out = new(bool) **out = **in } + if in.DisableCsiLvm != nil { + in, out := &in.DisableCsiLvm, &out.DisableCsiLvm + *out = new(bool) + **out = **in + } return } diff --git a/pkg/controller/controlplane/valuesprovider.go b/pkg/controller/controlplane/valuesprovider.go index 06c1d667..17b45ca8 100644 --- a/pkg/controller/controlplane/valuesprovider.go +++ b/pkg/controller/controlplane/valuesprovider.go @@ -700,8 +700,14 @@ func (vp *valuesProvider) GetStorageClassesChartValues(_ context.Context, contro isDefaultSC = false } + disableCsiLvm := false + if cp.FeatureGates.DisableCsiLvm != nil { + disableCsiLvm = *cp.FeatureGates.DisableCsiLvm + } + values := map[string]interface{}{ "isDefaultStorageClass": isDefaultSC, + "disableCsiLvm": disableCsiLvm, } return values, nil