Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
remove during upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis committed Apr 12, 2021
1 parent f474dc9 commit 2a1b5d2
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/api/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,14 @@ func (cs *ContainerService) setAddonsConfig(isUpgrade bool) {
}
}

// Deal with legacy Azure CNI networkmonitor addon configuration
if isUpgrade {
// Force disabling of the deprecated Azure CNI networkmonitor addon
if i := getAddonsIndexByName(o.KubernetesConfig.Addons, common.AzureCNINetworkMonitorAddonName); i > -1 {
o.KubernetesConfig.Addons[i].Enabled = to.BoolPtr(false)
}
}

// Honor customKubeProxyImage field
if o.KubernetesConfig.CustomKubeProxyImage != "" {
if i := getAddonsIndexByName(o.KubernetesConfig.Addons, common.KubeProxyAddonName); i > -1 {
Expand Down
28 changes: 28 additions & 0 deletions pkg/api/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3737,6 +3737,34 @@ func TestSetAddonsConfig(t *testing.T) {
},
}, "1.18.1"),
},
{
name: "upgrade w/ Azure CNI networkmonitor enabled",
cs: &ContainerService{
Properties: &Properties{
OrchestratorProfile: &OrchestratorProfile{
OrchestratorVersion: "1.18.1",
KubernetesConfig: &KubernetesConfig{
KubernetesImageBaseType: common.KubernetesImageBaseTypeMCR,
DNSServiceIP: DefaultKubernetesDNSServiceIP,
KubeletConfig: map[string]string{
"--cluster-domain": "cluster.local",
},
ClusterSubnet: DefaultKubernetesSubnet,
ProxyMode: KubeProxyModeIPTables,
NetworkPlugin: NetworkPluginAzure,
Addons: []KubernetesAddon{
{
Name: common.AzureCNINetworkMonitorAddonName,
Enabled: to.BoolPtr(true),
},
},
},
},
},
},
isUpgrade: true,
expectedAddons: getDefaultAddons("1.18.1", "", common.KubernetesImageBaseTypeMCR),
},
{
name: "kube-proxy w/ user configuration",
cs: &ContainerService{
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ const (
ContainerMonitoringAddonName = "container-monitoring"
// IPMASQAgentAddonName is the name of the ip masq agent addon
IPMASQAgentAddonName = "ip-masq-agent"
// AzureCNINetworkMonitorAddonName is the name of the Azure CNI networkmonitor addon
AzureCNINetworkMonitorAddonName = "azure-cni-networkmonitor"
// AzureNetworkPolicyAddonName is the name of the Azure network policy manager addon
AzureNetworkPolicyAddonName = "azure-npm-daemonset"
// AzureVnetTelemetryContainerName is the name of the deprecated Azure vnet telemetry container in the azure-npm-daemonset addon
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/vlabs/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,10 @@ func (a *Properties) validateAddons(isUpdate bool) error {
return errors.Errorf("The rescheduler addon has been deprecated and disabled, please remove it from your cluster configuration before creating a new cluster")
case common.DashboardAddonName:
log.Warnf("The kube-dashboard addon is deprecated, we recommend you install the dashboard yourself, see https://github.com/kubernetes/dashboard")
case common.AzureCNINetworkMonitorAddonName:
if isUpdate {
log.Warnf("The Azure CNI networkmonitor addon has been deprecated, it will be marked as disabled")
}
}
} else {
// Validation for addons if they are disabled
Expand Down
10 changes: 10 additions & 0 deletions pkg/api/vlabs/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,19 @@ func ExampleProperties_validateAddons() {
fmt.Printf("error in validateAddons: %s", err)
}

cs.Properties.OrchestratorProfile.KubernetesConfig = &KubernetesConfig{}
cs.Properties.OrchestratorProfile.KubernetesConfig.Addons = []KubernetesAddon{
{Name: common.AzureCNINetworkMonitorAddonName,
Enabled: to.BoolPtr(true)},
}
if err := cs.Properties.validateAddons(true); err != nil {
fmt.Printf("error in validateAddons: %s", err)
}

// Output:
// level=warning msg="The rescheduler addon has been deprecated and disabled, it will be removed during this update"
// level=warning msg="The kube-dashboard addon is deprecated, we recommend you install the dashboard yourself, see https://github.com/kubernetes/dashboard"
// level=warning msg="The Azure CNI networkmonitor addon has been deprecated, it will be marked as disabled"
}

func Test_Properties_ValidateNetworkPlugin(t *testing.T) {
Expand Down

0 comments on commit 2a1b5d2

Please sign in to comment.