diff --git a/Makefile b/Makefile index bdcc0a43..6182a482 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/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