From 675afe42648086a39f1345862f7fe9136a199e98 Mon Sep 17 00:00:00 2001 From: Andy Zhang Date: Wed, 21 Nov 2018 07:33:54 +0800 Subject: [PATCH] use mcr repos and disable smb flexvol addon (#4266) --- pkg/api/addons.go | 4 +- pkg/api/const.go | 2 +- pkg/api/defaults_test.go | 4 +- pkg/api/types_test.go | 159 ++++++++++++++++++++++++++++++++++----- 4 files changed, 144 insertions(+), 25 deletions(-) diff --git a/pkg/api/addons.go b/pkg/api/addons.go index 6b7a16266f..fd40c3e6ec 100644 --- a/pkg/api/addons.go +++ b/pkg/api/addons.go @@ -80,7 +80,7 @@ func (cs *ContainerService) setAddonsConfig(isUpdate bool) { MemoryRequests: "10Mi", CPULimits: "50m", MemoryLimits: "10Mi", - Image: "andyzhangx/blobfuse-flexvol-installer", + Image: "mcr.microsoft.com/k8s/flexvolume/blobfuse-flexvolume", }, }, } @@ -95,7 +95,7 @@ func (cs *ContainerService) setAddonsConfig(isUpdate bool) { MemoryRequests: "10Mi", CPULimits: "50m", MemoryLimits: "10Mi", - Image: "andyzhangx/smb-flexvol-installer", + Image: "mcr.microsoft.com/k8s/flexvolume/smb-flexvolume", }, }, } diff --git a/pkg/api/const.go b/pkg/api/const.go index e47cc4c441..bd19636c07 100644 --- a/pkg/api/const.go +++ b/pkg/api/const.go @@ -122,7 +122,7 @@ const ( // DefaultBlobfuseFlexVolumeAddonEnabled determines the acs-engine provided default for enabling blobfuse flexvolume addon DefaultBlobfuseFlexVolumeAddonEnabled = true // DefaultSMBFlexVolumeAddonEnabled determines the acs-engine provided default for enabling smb flexvolume addon - DefaultSMBFlexVolumeAddonEnabled = true + DefaultSMBFlexVolumeAddonEnabled = false // DefaultKeyVaultFlexVolumeAddonEnabled determines the acs-engine provided default for enabling key vault flexvolume addon DefaultKeyVaultFlexVolumeAddonEnabled = true // DefaultDashboardAddonEnabled determines the acs-engine provided default for enabling kubernetes-dashboard addon diff --git a/pkg/api/defaults_test.go b/pkg/api/defaults_test.go index ad3dc3b0de..2d01f3ded1 100644 --- a/pkg/api/defaults_test.go +++ b/pkg/api/defaults_test.go @@ -186,8 +186,8 @@ func TestAssignDefaultAddonImages(t *testing.T) { DefaultTillerAddonName: "gcr.io/kubernetes-helm/tiller:v2.8.1", DefaultACIConnectorAddonName: "microsoft/virtual-kubelet:latest", DefaultClusterAutoscalerAddonName: "k8s.gcr.io/cluster-autoscaler:v1.2.2", - DefaultBlobfuseFlexVolumeAddonName: "andyzhangx/blobfuse-flexvol-installer", - DefaultSMBFlexVolumeAddonName: "andyzhangx/smb-flexvol-installer", + DefaultBlobfuseFlexVolumeAddonName: "mcr.microsoft.com/k8s/flexvolume/blobfuse-flexvolume", + DefaultSMBFlexVolumeAddonName: "mcr.microsoft.com/k8s/flexvolume/smb-flexvolume", DefaultKeyVaultFlexVolumeAddonName: "mcr.microsoft.com/k8s/flexvolume/keyvault-flexvolume:v0.0.5", DefaultDashboardAddonName: "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0", DefaultReschedulerAddonName: "k8s.gcr.io/rescheduler:v0.3.1", diff --git a/pkg/api/types_test.go b/pkg/api/types_test.go index fe56867dd6..33a2537d24 100644 --- a/pkg/api/types_test.go +++ b/pkg/api/types_test.go @@ -979,6 +979,7 @@ func TestKubernetesAddon(t *testing.T) { } func TestIsTillerEnabled(t *testing.T) { + // Default case c := KubernetesConfig{ Addons: []KubernetesAddon{ getMockAddon("addon"), @@ -989,12 +990,28 @@ func TestIsTillerEnabled(t *testing.T) { if enabled != enabledDefault { t.Fatalf("KubernetesConfig.IsTillerEnabled() should return %t when no tiller addon has been specified, instead returned %t", enabledDefault, enabled) } + // Addon present, but enabled not specified c.Addons = append(c.Addons, getMockAddon(DefaultTillerAddonName)) enabled = c.IsTillerEnabled() + if enabled != enabledDefault { + t.Fatalf("KubernetesConfig.IsTillerEnabled() should return default when a custom tiller addon has been specified w/ no enabled value, expected %t, instead returned %t", enabledDefault, enabled) + } + // Addon present and enabled + b := true + c = KubernetesConfig{ + Addons: []KubernetesAddon{ + { + Name: DefaultTillerAddonName, + Enabled: &b, + }, + }, + } + enabled = c.IsTillerEnabled() if !enabled { - t.Fatalf("KubernetesConfig.IsTillerEnabled() should return true when a custom tiller addon has been specified, instead returned %t", enabled) + t.Fatalf("KubernetesConfig.IsTillerEnabled() should return true when a custom tiller addon has been specified as enabled, instead returned %t", enabled) } - b := false + // Addon present and disabled + b = false c = KubernetesConfig{ Addons: []KubernetesAddon{ { @@ -1010,6 +1027,7 @@ func TestIsTillerEnabled(t *testing.T) { } func TestIsAADPodIdentityEnabled(t *testing.T) { + // Default case c := KubernetesConfig{ Addons: []KubernetesAddon{ getMockAddon("addon"), @@ -1020,11 +1038,13 @@ func TestIsAADPodIdentityEnabled(t *testing.T) { if enabled != enabledDefault { t.Fatalf("KubernetesConfig.IsAADPodIdentityEnabled() should return %t when no aad pod identity addon has been specified, instead returned %t", enabledDefault, enabled) } + // Addon present, but enabled not specified c.Addons = append(c.Addons, getMockAddon(DefaultAADPodIdentityAddonName)) enabled = c.IsAADPodIdentityEnabled() - if enabled { - t.Fatalf("KubernetesConfig.IsAADPodIdentityEnabled() should return true when aad pod identity addon has been specified, instead returned %t", enabled) + if enabled != enabledDefault { + t.Fatalf("KubernetesConfig.IsAADPodIdentityEnabled() should return default when aad pod identity addon has been specified w/ no enabled value, expected %t, instead returned %t", enabledDefault, enabled) } + // Addon present and enabled b := true c = KubernetesConfig{ Addons: []KubernetesAddon{ @@ -1036,11 +1056,26 @@ func TestIsAADPodIdentityEnabled(t *testing.T) { } enabled = c.IsAADPodIdentityEnabled() if !enabled { + t.Fatalf("KubernetesConfig.IsAADPodIdentityEnabled() should return true when aad pod identity addon has been specified as enabled, instead returned %t", enabled) + } + // Addon present and disabled + b = false + c = KubernetesConfig{ + Addons: []KubernetesAddon{ + { + Name: DefaultAADPodIdentityAddonName, + Enabled: &b, + }, + }, + } + enabled = c.IsAADPodIdentityEnabled() + if enabled { t.Fatalf("KubernetesConfig.IsAADPodIdentityEnabled() should return false when aad pod identity addon has been specified as disabled, instead returned %t", enabled) } } func TestIsACIConnectorEnabled(t *testing.T) { + // Default case c := KubernetesConfig{ Addons: []KubernetesAddon{ getMockAddon("addon"), @@ -1051,11 +1086,13 @@ func TestIsACIConnectorEnabled(t *testing.T) { if enabled != enabledDefault { t.Fatalf("KubernetesConfig.IsACIConnectorEnabled() should return %t when no ACI connector addon has been specified, instead returned %t", enabledDefault, enabled) } + // Addon present, but enabled not specified c.Addons = append(c.Addons, getMockAddon(DefaultACIConnectorAddonName)) enabled = c.IsACIConnectorEnabled() - if enabled { - t.Fatalf("KubernetesConfig.IsACIConnectorEnabled() should return true when ACI connector has been specified, instead returned %t", enabled) + if enabled != enabledDefault { + t.Fatalf("KubernetesConfig.IsACIConnectorEnabled() should return default when ACI connector has been specified w/ no enabled value, expected %t, instead returned %t", enabledDefault, enabled) } + // Addon present and enabled b := true c = KubernetesConfig{ Addons: []KubernetesAddon{ @@ -1067,11 +1104,26 @@ func TestIsACIConnectorEnabled(t *testing.T) { } enabled = c.IsACIConnectorEnabled() if !enabled { + t.Fatalf("KubernetesConfig.IsACIConnectorEnabled() should return true when ACI connector addon has been specified as enabled, instead returned %t", enabled) + } + // Addon present and disabled + b = false + c = KubernetesConfig{ + Addons: []KubernetesAddon{ + { + Name: DefaultACIConnectorAddonName, + Enabled: &b, + }, + }, + } + enabled = c.IsACIConnectorEnabled() + if enabled { t.Fatalf("KubernetesConfig.IsACIConnectorEnabled() should return false when ACI connector addon has been specified as disabled, instead returned %t", enabled) } } func TestIsClusterAutoscalerEnabled(t *testing.T) { + // Default case c := KubernetesConfig{ Addons: []KubernetesAddon{ getMockAddon("addon"), @@ -1082,11 +1134,13 @@ func TestIsClusterAutoscalerEnabled(t *testing.T) { if enabled != enabledDefault { t.Fatalf("KubernetesConfig.IsClusterAutoscalerEnabled() should return %t when no cluster autoscaler addon has been specified, instead returned %t", enabledDefault, enabled) } + // Addon present, but enabled not specified c.Addons = append(c.Addons, getMockAddon(DefaultClusterAutoscalerAddonName)) enabled = c.IsClusterAutoscalerEnabled() - if enabled { - t.Fatalf("KubernetesConfig.IsClusterAutoscalerEnabled() should return true when cluster autoscaler has been specified, instead returned %t", enabled) + if enabled != enabledDefault { + t.Fatalf("KubernetesConfig.IsClusterAutoscalerEnabled() should return default when cluster autoscaler has been specified w/ no enabled value, expected %t, instead returned %t", enabledDefault, enabled) } + // Addon present and enabled b := true c = KubernetesConfig{ Addons: []KubernetesAddon{ @@ -1098,11 +1152,26 @@ func TestIsClusterAutoscalerEnabled(t *testing.T) { } enabled = c.IsClusterAutoscalerEnabled() if !enabled { + t.Fatalf("KubernetesConfig.IsClusterAutoscalerEnabled() should return true when cluster autoscaler addon has been specified as enabled, instead returned %t", enabled) + } + // Addon present and disabled + b = false + c = KubernetesConfig{ + Addons: []KubernetesAddon{ + { + Name: DefaultClusterAutoscalerAddonName, + Enabled: &b, + }, + }, + } + enabled = c.IsClusterAutoscalerEnabled() + if enabled { t.Fatalf("KubernetesConfig.IsClusterAutoscalerEnabled() should return false when cluster autoscaler addon has been specified as disabled, instead returned %t", enabled) } } func TestIsBlobfuseFlexVolumeEnabled(t *testing.T) { + // Default case c := KubernetesConfig{ Addons: []KubernetesAddon{ getMockAddon("addon"), @@ -1111,13 +1180,15 @@ func TestIsBlobfuseFlexVolumeEnabled(t *testing.T) { enabled := c.IsBlobfuseFlexVolumeEnabled() enabledDefault := DefaultBlobfuseFlexVolumeAddonEnabled if enabled != enabledDefault { - t.Fatalf("KubernetesConfig.IsBlobfuseFlexVolumeEnabled() should return %t when no blob fuse flex volume addon has been specified, instead returned %t", enabledDefault, enabled) + t.Fatalf("KubernetesConfig.IsBlobfuseFlexVolumeEnabled() should return %t when no blobfuse flexvolume addon has been specified, instead returned %t", enabledDefault, enabled) } + // Addon present, but enabled not specified c.Addons = append(c.Addons, getMockAddon(DefaultBlobfuseFlexVolumeAddonName)) enabled = c.IsBlobfuseFlexVolumeEnabled() - if !enabled { - t.Fatalf("KubernetesConfig.IsBlobfuseFlexVolumeEnabled() should return true when blob fuse flex volume has been specified, instead returned %t", enabled) + if enabled != enabledDefault { + t.Fatalf("KubernetesConfig.IsBlobfuseFlexVolumeEnabled() should return default when blobfuse flexvolume has been specified w/ no enabled value, expected %t, instead returned %t", enabledDefault, enabled) } + // Addon present and enabled b := true c = KubernetesConfig{ Addons: []KubernetesAddon{ @@ -1129,11 +1200,26 @@ func TestIsBlobfuseFlexVolumeEnabled(t *testing.T) { } enabled = c.IsBlobfuseFlexVolumeEnabled() if !enabled { - t.Fatalf("KubernetesConfig.IsBlobfuseFlexVolumeEnabled() should return false when blob fuse flex volume addon has been specified as disabled, instead returned %t", enabled) + t.Fatalf("KubernetesConfig.IsBlobfuseFlexVolumeEnabled() should return true when blobfuse flexvolume addon has been specified as enabled, instead returned %t", enabled) + } + // Addon present and disabled + b = false + c = KubernetesConfig{ + Addons: []KubernetesAddon{ + { + Name: DefaultBlobfuseFlexVolumeAddonName, + Enabled: &b, + }, + }, + } + enabled = c.IsBlobfuseFlexVolumeEnabled() + if enabled { + t.Fatalf("KubernetesConfig.IsBlobfuseFlexVolumeEnabled() should return false when blobfuse flexvolume addon has been specified as disabled, instead returned %t", enabled) } } func TestIsSMBFlexVolumeEnabled(t *testing.T) { + // Default case c := KubernetesConfig{ Addons: []KubernetesAddon{ getMockAddon("addon"), @@ -1142,13 +1228,15 @@ func TestIsSMBFlexVolumeEnabled(t *testing.T) { enabled := c.IsSMBFlexVolumeEnabled() enabledDefault := DefaultSMBFlexVolumeAddonEnabled if enabled != enabledDefault { - t.Fatalf("KubernetesConfig.IsSMBFlexVolumeEnabled() should return %t when no SMB flex volume addon has been specified, instead returned %t", enabledDefault, enabled) + t.Fatalf("KubernetesConfig.IsSMBFlexVolumeEnabled() should return %t when no SMB flexvolume addon has been specified, instead returned %t", enabledDefault, enabled) } + // Addon present, but enabled not specified c.Addons = append(c.Addons, getMockAddon(DefaultSMBFlexVolumeAddonName)) enabled = c.IsSMBFlexVolumeEnabled() - if !enabled { - t.Fatalf("KubernetesConfig.IsSMBFlexVolumeEnabled() should return true when SMB flex volume has been specified, instead returned %t", enabled) + if enabled != enabledDefault { + t.Fatalf("KubernetesConfig.IsSMBFlexVolumeEnabled() should return default when SMB flexvolume has been specified w/ no enabled value, expected %t, instead returned %t", enabledDefault, enabled) } + // Addon present and enabled b := true c = KubernetesConfig{ Addons: []KubernetesAddon{ @@ -1160,11 +1248,26 @@ func TestIsSMBFlexVolumeEnabled(t *testing.T) { } enabled = c.IsSMBFlexVolumeEnabled() if !enabled { - t.Fatalf("KubernetesConfig.IsSMBFlexVolumeEnabled() should return false when SMB flex volume addon has been specified as disabled, instead returned %t", enabled) + t.Fatalf("KubernetesConfig.IsSMBFlexVolumeEnabled() should return true when SMB flexvolume addon has been specified as enabled, instead returned %t", enabled) + } + // Addon present and disabled + b = false + c = KubernetesConfig{ + Addons: []KubernetesAddon{ + { + Name: DefaultSMBFlexVolumeAddonName, + Enabled: &b, + }, + }, + } + enabled = c.IsSMBFlexVolumeEnabled() + if enabled { + t.Fatalf("KubernetesConfig.IsSMBFlexVolumeEnabled() should return true when SMB flexvolume addon has been specified as enabled, instead returned %t", enabled) } } func TestIsKeyVaultFlexVolumeEnabled(t *testing.T) { + // Default case c := KubernetesConfig{ Addons: []KubernetesAddon{ getMockAddon("addon"), @@ -1173,14 +1276,30 @@ func TestIsKeyVaultFlexVolumeEnabled(t *testing.T) { enabled := c.IsKeyVaultFlexVolumeEnabled() enabledDefault := DefaultKeyVaultFlexVolumeAddonEnabled if enabled != enabledDefault { - t.Fatalf("KubernetesConfig.IsKeyVaultFlexVolumeEnabled() should return %t when no key vault flex volume addon has been specified, instead returned %t", enabledDefault, enabled) + t.Fatalf("KubernetesConfig.IsKeyVaultFlexVolumeEnabled() should return %t when no key vault flexvolume addon has been specified, instead returned %t", enabledDefault, enabled) } + // Addon present, but enabled not specified c.Addons = append(c.Addons, getMockAddon(DefaultKeyVaultFlexVolumeAddonName)) enabled = c.IsKeyVaultFlexVolumeEnabled() + if enabled != enabledDefault { + t.Fatalf("KubernetesConfig.IsKeyVaultFlexVolumeEnabled() should return default when no keyvault flexvolume has been specified w/ no enabled value, expected %t, instead returned %t", enabledDefault, enabled) + } + // Addon present and enabled + b := true + c = KubernetesConfig{ + Addons: []KubernetesAddon{ + { + Name: DefaultKeyVaultFlexVolumeAddonName, + Enabled: &b, + }, + }, + } + enabled = c.IsKeyVaultFlexVolumeEnabled() if !enabled { - t.Fatalf("KubernetesConfig.IsKeyVaultFlexVolumeEnabled() should return true when no keyvault flex volume has been specified, instead returned %t", enabled) + t.Fatalf("KubernetesConfig.IsKeyVaultFlexVolumeEnabled() should return true when keyvault flexvolume addon has been specified as enabled, instead returned %t", enabled) } - b := false + // Addon present and disabled + b = false c = KubernetesConfig{ Addons: []KubernetesAddon{ { @@ -1191,7 +1310,7 @@ func TestIsKeyVaultFlexVolumeEnabled(t *testing.T) { } enabled = c.IsKeyVaultFlexVolumeEnabled() if enabled { - t.Fatalf("KubernetesConfig.IsKeyVaultFlexVolumeEnabled() should return false when keyvault flex volume addon has been specified as disabled, instead returned %t", enabled) + t.Fatalf("KubernetesConfig.IsKeyVaultFlexVolumeEnabled() should return false when keyvault flexvolume addon has been specified as disabled, instead returned %t", enabled) } }