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

Commit

Permalink
chore: standardize nodeSelectors (#3406)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored Jun 4, 2020
1 parent efb978a commit dcc73fb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 30 deletions.
4 changes: 0 additions & 4 deletions parts/k8s/addons/azure-cni-networkmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ spec:
- operator: "Exists"
effect: NoSchedule
nodeSelector:
{{- if IsKubernetesVersionGe "1.19.0-alpha.2"}}
kubernetes.io/os: linux
{{else}}
kubernetes.io/os: linux
{{- end}}
containers:
- name: azure-cnms
image: {{ContainerImage "azure-cni-networkmonitor"}}
Expand Down
10 changes: 1 addition & 9 deletions parts/k8s/addons/cluster-autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,8 @@ spec:
value: "true"
key: node-role.kubernetes.io/master
nodeSelector:
{{- if IsKubernetesVersionGe "1.16.0"}}
kubernetes.azure.com/role: master
{{else}}
kubernetes.io/role: master
{{- end}}
{{- if IsKubernetesVersionGe "1.19.0-alpha.2"}}
kubernetes.{{if IsKubernetesVersionGe "1.16.0"}}azure.com{{else}}io{{end}}/role: master
kubernetes.io/os: linux
{{else}}
kubernetes.io/os: linux
{{- end}}
containers:
- image: {{ContainerImage "cluster-autoscaler"}}
imagePullPolicy: IfNotPresent
Expand Down
2 changes: 1 addition & 1 deletion parts/k8s/addons/coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ spec:
nodeSelector:
kubernetes.io/os: linux
{{- if ContainerConfig "use-host-network"}}
kubernetes.azure.com/role: agent
kubernetes.{{if IsKubernetesVersionGe "1.16.0"}}azure.com{{else}}io{{end}}/role: agent
{{end}}
containers:
- name: coredns
Expand Down
16 changes: 2 additions & 14 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions test/e2e/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,12 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
nodes, err := node.GetReadyWithRetry(1*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
for _, n := range nodes {
role := n.Metadata.Labels["kubernetes.io/role"]
var role string
if common.IsKubernetesVersionGe(eng.ExpandedDefinition.Properties.OrchestratorProfile.OrchestratorVersion, "1.16.0") {
role = n.Metadata.Labels["kubernetes.azure.com/role"]
} else {
role = n.Metadata.Labels["kubernetes.io/role"]
}
if role == "master" {
By("Ensuring that we get zones for each master node")
zones := n.Metadata.Labels["failure-domain.beta.kubernetes.io/zone"]
Expand All @@ -1615,7 +1620,12 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
nodes, err := node.GetReadyWithRetry(1*time.Second, cfg.Timeout)
Expect(err).NotTo(HaveOccurred())
for _, n := range nodes {
role := n.Metadata.Labels["kubernetes.io/role"]
var role string
if common.IsKubernetesVersionGe(eng.ExpandedDefinition.Properties.OrchestratorProfile.OrchestratorVersion, "1.16.0") {
role = n.Metadata.Labels["kubernetes.azure.com/role"]
} else {
role = n.Metadata.Labels["kubernetes.io/role"]
}
if role == "agent" {
By("Ensuring that we get zones for each agent node")
zones := n.Metadata.Labels["failure-domain.beta.kubernetes.io/zone"]
Expand Down

0 comments on commit dcc73fb

Please sign in to comment.