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

Commit

Permalink
feat: deprecate Azure CNI networkmonitor daemonset (#4363)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored Apr 12, 2021
1 parent 3445c1b commit 925a31c
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 538 deletions.
79 changes: 0 additions & 79 deletions parts/k8s/addons/azure-cni-networkmonitor.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions parts/k8s/kubernetesparams.t
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,6 @@
}
}
{{end}}
{{if IsAzureCNI}}
,"AzureCNINetworkMonitorImageURL": {
"defaultValue": "",
"metadata": {
"description": "Azure CNI networkmonitor Image URL"
},
"type": "string"
}
{{end}}
{{if .OrchestratorProfile.KubernetesConfig.IsAppGWIngressEnabled}}
,"appGwSubnet": {
"metadata": {
Expand Down
26 changes: 8 additions & 18 deletions pkg/api/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,23 +285,6 @@ func (cs *ContainerService) setAddonsConfig(isUpgrade bool) {
},
}

defaultAzureCNINetworkMonitorAddonsConfig := KubernetesAddon{
Name: common.AzureCNINetworkMonitorAddonName,
Enabled: to.BoolPtr(o.IsAzureCNI() &&
o.KubernetesConfig.NetworkPolicy != NetworkPolicyCalico &&
o.KubernetesConfig.NetworkPolicy != NetworkPolicyAntrea),
Containers: []KubernetesContainerSpec{
{
Name: common.AzureCNINetworkMonitorAddonName,
Image: specConfig.AzureCNIImageBase + k8sComponents[common.AzureCNINetworkMonitorAddonName],
CPURequests: "30m",
MemoryRequests: "25Mi",
CPULimits: "200m",
MemoryLimits: "256Mi",
},
},
}

defaultAzureNetworkPolicyAddonsConfig := KubernetesAddon{
Name: common.AzureNetworkPolicyAddonName,
Enabled: to.BoolPtr(o.KubernetesConfig.NetworkPlugin == NetworkPluginAzure && o.KubernetesConfig.NetworkPolicy == NetworkPolicyAzure),
Expand Down Expand Up @@ -883,7 +866,6 @@ func (cs *ContainerService) setAddonsConfig(isUpgrade bool) {
defaultMetricsServerAddonsConfig,
defaultNVIDIADevicePluginAddonsConfig,
defaultContainerMonitoringAddonsConfig,
defaultAzureCNINetworkMonitorAddonsConfig,
defaultAzureNetworkPolicyAddonsConfig,
defaultCloudNodeManagerAddonsConfig,
defaultIPMasqAgentAddonsConfig,
Expand Down Expand Up @@ -987,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
85 changes: 42 additions & 43 deletions pkg/api/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: false,
expectedAddons: omitFromAddons([]string{common.AzureCNINetworkMonitorAddonName}, concatenateDefaultAddons([]KubernetesAddon{
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.CalicoAddonName,
Enabled: to.BoolPtr(true),
Expand Down Expand Up @@ -1675,7 +1675,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
},
}, "1.15.4")),
}, "1.15.4"),
},
{
name: "calico addon enabled with user configuration",
Expand Down Expand Up @@ -1708,7 +1708,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: false,
expectedAddons: omitFromAddons([]string{common.AzureCNINetworkMonitorAddonName}, concatenateDefaultAddons([]KubernetesAddon{
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.CalicoAddonName,
Enabled: to.BoolPtr(true),
Expand Down Expand Up @@ -1739,7 +1739,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
},
}, "1.15.4")),
}, "1.15.4"),
},
{
name: "calico addon back-compat",
Expand Down Expand Up @@ -1794,7 +1794,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: true,
expectedAddons: omitFromAddons([]string{common.AzureCNINetworkMonitorAddonName}, concatenateDefaultAddons([]KubernetesAddon{
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.CalicoAddonName,
Enabled: to.BoolPtr(true),
Expand Down Expand Up @@ -1825,7 +1825,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
},
}, "1.15.4")),
}, "1.15.4"),
},
{
name: "aad-pod-identity enabled",
Expand Down Expand Up @@ -1957,7 +1957,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: false,
expectedAddons: omitFromAddons([]string{common.IPMASQAgentAddonName, common.AzureCNINetworkMonitorAddonName}, concatenateDefaultAddons([]KubernetesAddon{
expectedAddons: omitFromAddons([]string{common.IPMASQAgentAddonName}, concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.CiliumAddonName,
Enabled: to.BoolPtr(true),
Expand Down Expand Up @@ -2056,20 +2056,6 @@ func TestSetAddonsConfig(t *testing.T) {
"enable-ipv6": "false",
},
},
{
Name: common.AzureCNINetworkMonitorAddonName,
Enabled: to.BoolPtr(true),
Containers: []KubernetesContainerSpec{
{
Name: common.AzureCNINetworkMonitorAddonName,
Image: "AzureCNIImageBase" + k8sComponentsByVersionMap["1.15.12"][common.AzureCNINetworkMonitorAddonName],
CPURequests: "30m",
MemoryRequests: "25Mi",
CPULimits: "200m",
MemoryLimits: "256Mi",
},
},
},
{
Name: common.CoreDNSAddonName,
Enabled: to.BoolPtr(DefaultCoreDNSAddonEnabled),
Expand Down Expand Up @@ -3779,6 +3765,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 Expand Up @@ -4081,7 +4095,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: false,
expectedAddons: omitFromAddons([]string{common.IPMASQAgentAddonName, common.AzureCNINetworkMonitorAddonName}, concatenateDefaultAddons([]KubernetesAddon{
expectedAddons: omitFromAddons([]string{common.IPMASQAgentAddonName}, concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AntreaAddonName,
Enabled: to.BoolPtr(true),
Expand Down Expand Up @@ -4123,7 +4137,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: false,
expectedAddons: omitFromAddons([]string{common.AzureCNINetworkMonitorAddonName}, concatenateDefaultAddons([]KubernetesAddon{
expectedAddons: concatenateDefaultAddons([]KubernetesAddon{
{
Name: common.AntreaAddonName,
Enabled: to.BoolPtr(true),
Expand All @@ -4133,7 +4147,7 @@ func TestSetAddonsConfig(t *testing.T) {
"serviceCidr": DefaultKubernetesServiceCIDR,
},
},
}, "1.15.4")),
}, "1.15.4"),
},
{
name: "addons with IPv6 single stack",
Expand Down Expand Up @@ -4168,7 +4182,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: false,
expectedAddons: omitFromAddons([]string{common.AzureCNINetworkMonitorAddonName}, overwriteDefaultAddons([]KubernetesAddon{
expectedAddons: overwriteDefaultAddons([]KubernetesAddon{
{
Name: common.CoreDNSAddonName,
Enabled: to.BoolPtr(DefaultCoreDNSAddonEnabled),
Expand Down Expand Up @@ -4229,7 +4243,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
},
}, "1.18.0")),
}, "1.18.0"),
},
{
name: "addons with dual stack",
Expand Down Expand Up @@ -4262,7 +4276,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
isUpgrade: false,
expectedAddons: omitFromAddons([]string{common.AzureCNINetworkMonitorAddonName}, overwriteDefaultAddons([]KubernetesAddon{
expectedAddons: overwriteDefaultAddons([]KubernetesAddon{
{
Name: common.IPMASQAgentAddonName,
Enabled: to.BoolPtr(true),
Expand Down Expand Up @@ -4298,7 +4312,7 @@ func TestSetAddonsConfig(t *testing.T) {
},
},
},
}, "1.18.0")),
}, "1.18.0"),
},
{
name: "kube proxy w/ customKubeProxyImage",
Expand Down Expand Up @@ -4516,7 +4530,6 @@ func TestSetAddonsConfig(t *testing.T) {
common.NVIDIADevicePluginAddonName,
common.ContainerMonitoringAddonName,
common.IPMASQAgentAddonName,
common.AzureCNINetworkMonitorAddonName,
common.AzureNetworkPolicyAddonName,
common.CalicoAddonName,
common.AADPodIdentityAddonName,
Expand Down Expand Up @@ -5059,20 +5072,6 @@ func getDefaultAddons(version, kubernetesImageBase, kubernetesImageBaseType stri
"enable-ipv6": "false",
},
},
{
Name: common.AzureCNINetworkMonitorAddonName,
Enabled: to.BoolPtr(true),
Containers: []KubernetesContainerSpec{
{
Name: common.AzureCNINetworkMonitorAddonName,
Image: specConfig.AzureCNIImageBase + k8sComponentsByVersionMap[version][common.AzureCNINetworkMonitorAddonName],
CPURequests: "30m",
MemoryRequests: "25Mi",
CPULimits: "200m",
MemoryLimits: "256Mi",
},
},
},
{
Name: common.AuditPolicyAddonName,
Enabled: to.BoolPtr(true),
Expand Down
Loading

0 comments on commit 925a31c

Please sign in to comment.