Skip to content

Commit

Permalink
Merge pull request #142 from stoyanr/postpone-csi-to-1.20
Browse files Browse the repository at this point in the history
Postpone switch to CSI drivers to 1.20
  • Loading branch information
rfranzke authored Aug 3, 2020
2 parents 8710381 + 2165bb8 commit c5abb46
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 82 deletions.
4 changes: 2 additions & 2 deletions docs/usage-as-end-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ spec:

## CSI volume provisioners

Every Azure shoot cluster that has at least Kubernetes v1.19 will be deployed with the Azure Disk CSI driver and the Azure File CSI driver.
Every Azure shoot cluster that has at least Kubernetes v1.20 will be deployed with the Azure Disk CSI driver and the Azure File CSI driver.
Both are compatible with the legacy in-tree volume provisioners that were deprecated by the Kubernetes community and will be removed in future versions of Kubernetes.
End-users might want to update their custom `StorageClass`es to the new `disk.csi.azure.com` or `file.csi.azure.com` provisioner, respectively.
Shoot clusters with Kubernetes v1.18 or less will use the in-tree `kubernetes.io/azure-disk` and `kubernetes.io/azure-file` volume provisioners in the kube-controller-manager and the kubelet.
Shoot clusters with Kubernetes v1.19 or less will use the in-tree `kubernetes.io/azure-disk` and `kubernetes.io/azure-file` volume provisioners in the kube-controller-manager and the kubelet.

## Miscellaneous

Expand Down
18 changes: 9 additions & 9 deletions pkg/controller/controlplane/valuesprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ func (vp *valuesProvider) GetControlPlaneShootChartValues(
return nil, errors.Wrapf(err, "could not decode infrastructureProviderStatus of controlplane '%s'", kutil.ObjectName(cp))
}

k8sVersionLessThan119, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, "<", "1.19")
k8sVersionLessThan120, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, "<", "1.20")
if err != nil {
return nil, err
}
Expand All @@ -473,7 +473,7 @@ func (vp *valuesProvider) GetControlPlaneShootChartValues(
cloudProviderDiskConfigChecksum string
)

if !k8sVersionLessThan119 {
if !k8sVersionLessThan120 {
secret := &corev1.Secret{}
if err := vp.Client().Get(ctx, kutil.Key(cp.Namespace, azure.CloudProviderDiskConfigName), secret); err != nil {
return nil, err
Expand All @@ -485,7 +485,7 @@ func (vp *valuesProvider) GetControlPlaneShootChartValues(

enableRemedyController := cluster.Shoot.Annotations[enableRemedyControllerAnnotation] == "true"

return getControlPlaneShootChartValues(cluster, infraStatus, k8sVersionLessThan119, enableRemedyController, cloudProviderDiskConfig, cloudProviderDiskConfigChecksum), nil
return getControlPlaneShootChartValues(cluster, infraStatus, k8sVersionLessThan120, enableRemedyController, cloudProviderDiskConfig, cloudProviderDiskConfigChecksum), nil
}

// GetStorageClassesChartValues returns the values for the storage classes chart applied by the generic actuator.
Expand All @@ -494,13 +494,13 @@ func (vp *valuesProvider) GetStorageClassesChartValues(
_ *extensionsv1alpha1.ControlPlane,
cluster *extensionscontroller.Cluster,
) (map[string]interface{}, error) {
k8sVersionLessThan119, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, "<", "1.19")
k8sVersionLessThan120, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, "<", "1.20")
if err != nil {
return nil, err
}

return map[string]interface{}{
"useLegacyProvisioner": k8sVersionLessThan119,
"useLegacyProvisioner": k8sVersionLessThan120,
}, nil
}

Expand Down Expand Up @@ -650,12 +650,12 @@ func getCSIControllerChartValues(
checksums map[string]string,
scaledDown bool,
) (map[string]interface{}, error) {
k8sVersionLessThan119, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, "<", "1.19")
k8sVersionLessThan120, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, "<", "1.20")
if err != nil {
return nil, err
}

if k8sVersionLessThan119 {
if k8sVersionLessThan120 {
return map[string]interface{}{"enabled": false}, nil
}

Expand Down Expand Up @@ -704,7 +704,7 @@ func getRemedyControllerChartValues(
func getControlPlaneShootChartValues(
cluster *extensionscontroller.Cluster,
infraStatus *apisazure.InfrastructureStatus,
k8sVersionLessThan119 bool,
k8sVersionLessThan120 bool,
enableRemedyController bool,
cloudProviderDiskConfig string,
cloudProviderDiskConfigChecksum string,
Expand All @@ -713,7 +713,7 @@ func getControlPlaneShootChartValues(
azure.AllowUDPEgressName: map[string]interface{}{"enabled": infraStatus.Zoned},
azure.CloudControllerManagerName: map[string]interface{}{"enabled": true},
azure.CSINodeName: map[string]interface{}{
"enabled": !k8sVersionLessThan119,
"enabled": !k8sVersionLessThan120,
"vpaEnabled": gardencorev1beta1helper.ShootWantsVerticalPodAutoscaler(cluster.Shoot),
"podAnnotations": map[string]interface{}{
"checksum/configmap-" + azure.CloudProviderDiskConfigName: cloudProviderDiskConfigChecksum,
Expand Down
54 changes: 27 additions & 27 deletions pkg/controller/controlplane/valuesprovider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ var _ = Describe("ValuesProvider", func() {
}

cidr = "10.250.0.0/19"
clusterK8sLessThan119 = &extensionscontroller.Cluster{
clusterK8sLessThan120 = &extensionscontroller.Cluster{
Shoot: &gardencorev1beta1.Shoot{
Spec: gardencorev1beta1.ShootSpec{
Networking: gardencorev1beta1.Networking{
Expand All @@ -139,14 +139,14 @@ var _ = Describe("ValuesProvider", func() {
},
},
}
clusterK8sAtLeast119 = &extensionscontroller.Cluster{
clusterK8sAtLeast120 = &extensionscontroller.Cluster{
Shoot: &gardencorev1beta1.Shoot{
Spec: gardencorev1beta1.ShootSpec{
Networking: gardencorev1beta1.Networking{
Pods: &cidr,
},
Kubernetes: gardencorev1beta1.Kubernetes{
Version: "1.19.4",
Version: "1.20.4",
VerticalPodAutoscaler: &gardencorev1beta1.VerticalPodAutoscaler{
Enabled: true,
},
Expand Down Expand Up @@ -278,7 +278,7 @@ var _ = Describe("ValuesProvider", func() {
c.EXPECT().Get(ctx, cpSecretKey, &corev1.Secret{}).DoAndReturn(clientGet(cpSecret))
c.EXPECT().Delete(ctx, acrConfigMap).Return(errorAcrConfigMapNotFound)

_, err := vp.GetConfigChartValues(ctx, cpNoSubnet, clusterK8sLessThan119)
_, err := vp.GetConfigChartValues(ctx, cpNoSubnet, clusterK8sLessThan120)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("could not determine subnet for purpose 'nodes'"))
})
Expand All @@ -287,7 +287,7 @@ var _ = Describe("ValuesProvider", func() {
c.EXPECT().Get(ctx, cpSecretKey, &corev1.Secret{}).DoAndReturn(clientGet(cpSecret))
c.EXPECT().Delete(ctx, acrConfigMap).Return(errorAcrConfigMapNotFound)

_, err := vp.GetConfigChartValues(ctx, cpNoAvailabilitySet, clusterK8sLessThan119)
_, err := vp.GetConfigChartValues(ctx, cpNoAvailabilitySet, clusterK8sLessThan120)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("could not determine availability set for purpose 'nodes'"))
})
Expand All @@ -296,7 +296,7 @@ var _ = Describe("ValuesProvider", func() {
c.EXPECT().Get(ctx, cpSecretKey, &corev1.Secret{}).DoAndReturn(clientGet(cpSecret))
c.EXPECT().Delete(ctx, acrConfigMap).Return(errorAcrConfigMapNotFound)

_, err := vp.GetConfigChartValues(ctx, cpNoRouteTables, clusterK8sLessThan119)
_, err := vp.GetConfigChartValues(ctx, cpNoRouteTables, clusterK8sLessThan120)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("could not determine route table for purpose 'nodes'"))
})
Expand All @@ -305,7 +305,7 @@ var _ = Describe("ValuesProvider", func() {
c.EXPECT().Get(ctx, cpSecretKey, &corev1.Secret{}).DoAndReturn(clientGet(cpSecret))
c.EXPECT().Delete(ctx, acrConfigMap).Return(errorAcrConfigMapNotFound)

_, err := vp.GetConfigChartValues(ctx, cpNoSecurityGroups, clusterK8sLessThan119)
_, err := vp.GetConfigChartValues(ctx, cpNoSecurityGroups, clusterK8sLessThan120)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("could not determine security group for purpose 'nodes'"))
})
Expand All @@ -314,7 +314,7 @@ var _ = Describe("ValuesProvider", func() {
c.EXPECT().Get(ctx, cpSecretKey, &corev1.Secret{}).DoAndReturn(clientGet(cpSecret))
c.EXPECT().Delete(ctx, acrConfigMap).Return(errorAcrConfigMapNotFound)

values, err := vp.GetConfigChartValues(ctx, cp, clusterK8sLessThan119)
values, err := vp.GetConfigChartValues(ctx, cp, clusterK8sLessThan120)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
"tenantId": "TenantID",
Expand All @@ -337,7 +337,7 @@ var _ = Describe("ValuesProvider", func() {
c.EXPECT().Get(ctx, cpSecretKey, &corev1.Secret{}).DoAndReturn(clientGet(cpSecret))
c.EXPECT().Delete(ctx, acrConfigMap).Return(errorAcrConfigMapNotFound)

values, err := vp.GetConfigChartValues(ctx, cpZoned, clusterK8sLessThan119)
values, err := vp.GetConfigChartValues(ctx, cpZoned, clusterK8sLessThan120)

Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
Expand All @@ -359,7 +359,7 @@ var _ = Describe("ValuesProvider", func() {
It("should return correct control plane chart values with identity", func() {
c.EXPECT().Get(ctx, cpSecretKey, &corev1.Secret{}).DoAndReturn(clientGet(cpSecret))

values, err := vp.GetConfigChartValues(ctx, cpIdentity, clusterK8sLessThan119)
values, err := vp.GetConfigChartValues(ctx, cpIdentity, clusterK8sLessThan120)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
"tenantId": "TenantID",
Expand Down Expand Up @@ -406,25 +406,25 @@ var _ = Describe("ValuesProvider", func() {
c.EXPECT().Delete(ctx, &corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: azure.CloudProviderDiskConfigName, Namespace: namespace}}).Return(nil)
})

It("should return correct control plane chart values (k8s < 1.19)", func() {
values, err := vp.GetControlPlaneChartValues(ctx, cp, clusterK8sLessThan119, checksums, false)
It("should return correct control plane chart values (k8s < 1.20)", func() {
values, err := vp.GetControlPlaneChartValues(ctx, cp, clusterK8sLessThan120, checksums, false)

Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
azure.CloudControllerManagerName: utils.MergeMaps(ccmChartValues, map[string]interface{}{
"kubernetesVersion": clusterK8sLessThan119.Shoot.Spec.Kubernetes.Version,
"kubernetesVersion": clusterK8sLessThan120.Shoot.Spec.Kubernetes.Version,
}),
azure.CSIControllerName: enabledFalse,
azure.RemedyControllerName: enabledFalse,
}))
})

It("should return correct control plane chart values (k8s >= 1.19)", func() {
values, err := vp.GetControlPlaneChartValues(ctx, cp, clusterK8sAtLeast119, checksums, false)
It("should return correct control plane chart values (k8s >= 1.20)", func() {
values, err := vp.GetControlPlaneChartValues(ctx, cp, clusterK8sAtLeast120, checksums, false)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
azure.CloudControllerManagerName: utils.MergeMaps(ccmChartValues, map[string]interface{}{
"kubernetesVersion": clusterK8sAtLeast119.Shoot.Spec.Kubernetes.Version,
"kubernetesVersion": clusterK8sAtLeast120.Shoot.Spec.Kubernetes.Version,
}),
azure.CSIControllerName: utils.MergeMaps(enabledTrue, map[string]interface{}{
"replicas": 1,
Expand Down Expand Up @@ -453,7 +453,7 @@ var _ = Describe("ValuesProvider", func() {
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
azure.CloudControllerManagerName: utils.MergeMaps(ccmChartValues, map[string]interface{}{
"kubernetesVersion": clusterK8sLessThan119.Shoot.Spec.Kubernetes.Version,
"kubernetesVersion": clusterK8sLessThan120.Shoot.Spec.Kubernetes.Version,
}),
azure.CSIControllerName: enabledFalse,
azure.RemedyControllerName: utils.MergeMaps(enabledTrue, map[string]interface{}{
Expand Down Expand Up @@ -485,9 +485,9 @@ var _ = Describe("ValuesProvider", func() {
})
)

Context("k8s < 1.19", func() {
Context("k8s < 1.20", func() {
It("should return correct control plane shoot chart values for non zoned cluster", func() {
values, err := vp.GetControlPlaneShootChartValues(ctx, cp, clusterK8sLessThan119, checksums)
values, err := vp.GetControlPlaneShootChartValues(ctx, cp, clusterK8sLessThan120, checksums)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
azure.AllowUDPEgressName: enabledFalse,
Expand All @@ -498,7 +498,7 @@ var _ = Describe("ValuesProvider", func() {
})

It("should return correct control plane shoot chart values for zoned cluster", func() {
values, err := vp.GetControlPlaneShootChartValues(ctx, cpZoned, clusterK8sLessThan119, checksums)
values, err := vp.GetControlPlaneShootChartValues(ctx, cpZoned, clusterK8sLessThan120, checksums)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
azure.AllowUDPEgressName: enabledTrue,
Expand All @@ -509,13 +509,13 @@ var _ = Describe("ValuesProvider", func() {
})
})

Context("k8s >= 1.19", func() {
Context("k8s >= 1.20", func() {
BeforeEach(func() {
c.EXPECT().Get(ctx, cpDiskConfigKey, &corev1.Secret{}).DoAndReturn(clientGet(cpDiskConfig))
})

It("should return correct control plane shoot chart values for non zoned cluster", func() {
values, err := vp.GetControlPlaneShootChartValues(ctx, cp, clusterK8sAtLeast119, checksums)
values, err := vp.GetControlPlaneShootChartValues(ctx, cp, clusterK8sAtLeast120, checksums)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
azure.AllowUDPEgressName: enabledFalse,
Expand All @@ -526,7 +526,7 @@ var _ = Describe("ValuesProvider", func() {
})

It("should return correct control plane shoot chart values for zoned cluster", func() {
values, err := vp.GetControlPlaneShootChartValues(ctx, cpZoned, clusterK8sAtLeast119, checksums)
values, err := vp.GetControlPlaneShootChartValues(ctx, cpZoned, clusterK8sAtLeast120, checksums)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{
azure.AllowUDPEgressName: enabledTrue,
Expand Down Expand Up @@ -563,14 +563,14 @@ var _ = Describe("ValuesProvider", func() {
})

Describe("#GetStorageClassesChartValues()", func() {
It("should return correct storage class chart values (k8s < 1.19)", func() {
values, err := vp.GetStorageClassesChartValues(ctx, cp, clusterK8sLessThan119)
It("should return correct storage class chart values (k8s < 1.20)", func() {
values, err := vp.GetStorageClassesChartValues(ctx, cp, clusterK8sLessThan120)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{"useLegacyProvisioner": true}))
})

It("should return correct storage class chart values (k8s >= 1.19)", func() {
values, err := vp.GetStorageClassesChartValues(ctx, cp, clusterK8sAtLeast119)
It("should return correct storage class chart values (k8s >= 1.20)", func() {
values, err := vp.GetStorageClassesChartValues(ctx, cp, clusterK8sAtLeast120)
Expect(err).NotTo(HaveOccurred())
Expect(values).To(Equal(map[string]interface{}{"useLegacyProvisioner": false}))
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/csimigration/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type AddOptions struct {
func AddToManagerWithOptions(mgr manager.Manager, opts AddOptions) error {
return csimigration.Add(mgr, csimigration.AddArgs{
ControllerOptions: opts.Controller,
CSIMigrationKubernetesVersion: "1.19",
CSIMigrationKubernetesVersion: "1.20",
Type: azure.Type,
StorageClassNameToLegacyProvisioner: map[string]string{
"default": "kubernetes.io/azure-disk",
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/healthcheck/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
// HealthChecks are grouped by extension (e.g worker), extension.type (e.g azure) and Health Check Type (e.g SystemComponentsHealthy)
func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs) error {
csiEnabledPreCheckFunc := func(_ runtime.Object, cluster *extensionscontroller.Cluster) bool {
csiEnabled, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, ">=", "1.19")
csiEnabled, err := version.CompareVersions(cluster.Shoot.Spec.Kubernetes.Version, ">=", "1.20")
if err != nil {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/controlplane/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (

const (
acrConfigPath = "/var/lib/kubelet/acr.conf"
csiMigrationVersion = "1.19"
csiMigrationVersion = "1.20"
)

// NewEnsurer creates a new controlplane ensurer.
Expand Down
Loading

0 comments on commit c5abb46

Please sign in to comment.