Skip to content

Commit

Permalink
fix: ensure flatcar configs use transparent Azure CNI (Azure#3972)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored Oct 27, 2020
1 parent cfc1196 commit e7a5680
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pkg/api/vlabs/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ func (a *Properties) ValidateOrchestratorProfile(isUpdate bool) error {
}
}

if a.HasFlatcar() && o.KubernetesConfig.NetworkPlugin == "azure" && o.KubernetesConfig.NetworkMode == NetworkModeBridge {
return errors.Errorf("Flatcar node pools require 'transparent' networkMode with Azure CNI")
}

if o.OrchestratorType != Kubernetes && o.KubernetesConfig != nil {
return errors.Errorf("KubernetesConfig can be specified only when OrchestratorType is Kubernetes")
}
Expand Down
42 changes: 42 additions & 0 deletions pkg/api/vlabs/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,48 @@ func Test_OrchestratorProfile_Validate(t *testing.T) {
},
expectedError: "EtcdStorageLimitGB value of 1 is too small, the minimum allowed is 2",
},
"should error when using flatcar + Azure CNI + bridge mode": {
properties: &Properties{
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: "Kubernetes",
KubernetesConfig: &KubernetesConfig{
NetworkPlugin: "azure",
NetworkMode: NetworkModeBridge,
},
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Name: "flatcarpool",
Count: 10,
Distro: Flatcar,
},
},
},
expectedError: "Flatcar node pools require 'transparent' networkMode with Azure CNI",
},
"should not error when using Azure CNI + bridge mode + ubuntu": {
properties: &Properties{
OrchestratorProfile: &OrchestratorProfile{
OrchestratorType: "Kubernetes",
KubernetesConfig: &KubernetesConfig{
NetworkPlugin: "azure",
NetworkMode: NetworkModeBridge,
},
},
AgentPoolProfiles: []*AgentPoolProfile{
{
Name: "ubuntu1604pool",
Count: 10,
Distro: AKSUbuntu1604,
},
{
Name: "ubuntu1804pool",
Count: 10,
Distro: AKSUbuntu1804,
},
},
},
},
}

for testName, test := range tests {
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/test_cluster_configs/flatcar/flatcar.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"env": {
"SKIP_TESTS": "true"
},
"apiModel": {
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"kubernetesConfig": {
"networkPlugin": "azure",
"networkMode": "transparent",
"addons": [
{
"name": "cluster-autoscaler",
Expand Down

0 comments on commit e7a5680

Please sign in to comment.