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

Commit

Permalink
Add new Linux VHDs (#5041)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored Jan 13, 2023
1 parent 5c2febf commit 904b3ff
Show file tree
Hide file tree
Showing 15 changed files with 1,673 additions and 15 deletions.
1 change: 1 addition & 0 deletions .pipelines/e2e-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
MSI_USER_ASSIGNED_ID: '$(MSI_USER_ASSIGNED_ID_AKS_ENGINE_E2E)'
CONTAINER_RUNTIME: ${{ parameters.containerRuntime }}
BLOCK_SSH: ${{ parameters.runSSHTests }}
DISTRO: ${{ parameters.distro }}

steps:
- template: e2e-step-template.yaml
Expand Down
11 changes: 11 additions & 0 deletions .pipelines/pr-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,14 @@ jobs:
enableKMSEncryption: false
containerRuntime: 'containerd'
runSSHTests: true

- template: e2e-job-template.yaml
parameters:
name: 'k8s_1_24_2004_e2e'
k8sRelease: '1.24'
apimodel: 'examples/e2e-tests/kubernetes/release/default/definition-no-vnet.json'
createVNET: false
enableKMSEncryption: false
containerRuntime: 'containerd'
distro: 'aks-ubuntu-20.04'
runSSHTests: true
13 changes: 12 additions & 1 deletion pkg/api/azenvtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,15 @@ var (
ImageOffer: "aks",
ImageSku: "aks-engine-ubuntu-1804-202112",
ImagePublisher: "microsoft-aks",
ImageVersion: "2022.12.12",
ImageVersion: "2023.01.10",
}

// AKSUbuntu2004OSImageConfig is the AKS Engine image based on Ubuntu 20.04-LTS.
AKSUbuntu2004OSImageConfig = AzureOSImageConfig{
ImageOffer: "aks",
ImageSku: "aks-engine-ubuntu-2004-202301",
ImagePublisher: "microsoft-aks",
ImageVersion: "2023.01.10",
}

// AKSWindowsServer2019OSImageConfig is the aks-engine image based on Windows Server 2019
Expand Down Expand Up @@ -205,6 +213,7 @@ var (
AKS1604Deprecated: AKSUbuntu1604OSImageConfig, // for back-compat
AKSUbuntu1804: AKSUbuntu1804OSImageConfig,
AKS1804Deprecated: AKSUbuntu1804OSImageConfig, // for back-compat
AKSUbuntu2004: AKSUbuntu2004OSImageConfig,
ACC1604: ACC1604OSImageConfig,
},
}
Expand Down Expand Up @@ -248,6 +257,7 @@ var (
AKS1604Deprecated: AKSUbuntu1604OSImageConfig, // for back-compat
AKSUbuntu1804: AKSUbuntu1804OSImageConfig,
AKS1804Deprecated: AKSUbuntu1804OSImageConfig, // for back-compat
AKSUbuntu2004: AKSUbuntu2004OSImageConfig,
},
}

Expand Down Expand Up @@ -290,6 +300,7 @@ var (
AKS1604Deprecated: AKSUbuntu1604OSImageConfig, // for back-compat
AKSUbuntu1804: AKSUbuntu1804OSImageConfig,
AKS1804Deprecated: AKSUbuntu1804OSImageConfig, // for back-compat
AKSUbuntu2004: AKSUbuntu2004OSImageConfig,
},
}

Expand Down
1 change: 1 addition & 0 deletions pkg/api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
AKSDockerEngine Distro = "aks-docker-engine" // deprecated docker-engine distro.
AKSUbuntu1604 Distro = "aks-ubuntu-16.04"
AKSUbuntu1804 Distro = "aks-ubuntu-18.04"
AKSUbuntu2004 Distro = "aks-ubuntu-20.04"
ACC1604 Distro = "acc-16.04"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/api/defaults-kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ func TestProtectKernelDefaults(t *testing.T) {
// Validate that --protect-kernel-defaults is "true" by default for relevant distros
for _, distro := range DistroValues {
switch distro {
case AKSUbuntu1604, AKSUbuntu1804:
case AKSUbuntu1604, AKSUbuntu1804, AKSUbuntu2004:
cs = CreateMockContainerService("testcluster", "", 3, 2, false)
cs.Properties.MasterProfile.Distro = distro
cs.Properties.AgentPoolProfiles[0].Distro = distro
Expand Down Expand Up @@ -839,7 +839,7 @@ func TestProtectKernelDefaults(t *testing.T) {
// Validate that --protect-kernel-defaults is overridable
for _, distro := range DistroValues {
switch distro {
case Ubuntu, Ubuntu2004, Ubuntu2004Gen2, Ubuntu1804, Ubuntu1804Gen2, AKSUbuntu1604, AKSUbuntu1804:
case Ubuntu, Ubuntu2004, Ubuntu2004Gen2, Ubuntu1804, Ubuntu1804Gen2, AKSUbuntu1604, AKSUbuntu1804, AKSUbuntu2004:
cs = CreateMockContainerService("testcluster", "", 3, 2, false)
cs.Properties.MasterProfile.Distro = "ubuntu"
cs.Properties.AgentPoolProfiles[0].Distro = "ubuntu"
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

// DistroValues is a list of currently supported distros
var DistroValues = []Distro{"", Ubuntu, Ubuntu2004, Ubuntu2004Gen2, Ubuntu1804, Flatcar, AKSUbuntu1604, AKSUbuntu1804, Ubuntu1804Gen2, ACC1604}
var DistroValues = []Distro{"", Ubuntu, Ubuntu2004, Ubuntu2004Gen2, Ubuntu1804, Flatcar, AKSUbuntu1604, AKSUbuntu1804, Ubuntu1804Gen2, AKSUbuntu2004, ACC1604}

// PropertiesDefaultsParams is the parameters when we set the properties defaults for ContainerService.
type PropertiesDefaultsParams struct {
Expand Down
8 changes: 4 additions & 4 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ func (m *MasterProfile) IsStorageAccount() bool {

// IsVHDDistro returns true if the distro uses VHD SKUs
func (m *MasterProfile) IsVHDDistro() bool {
return m.Distro == AKSUbuntu1604 || m.Distro == AKSUbuntu1804
return m.Distro == AKSUbuntu1604 || m.Distro == AKSUbuntu1804 || m.Distro == AKSUbuntu2004
}

// IsAuditDEnabled returns true if the master profile is configured for auditd
Expand Down Expand Up @@ -1361,7 +1361,7 @@ func (m *MasterProfile) IsUbuntu1804() bool {
// IsUbuntu2004 returns true if the master profile distro is based on Ubuntu 20.04
func (m *MasterProfile) IsUbuntu2004() bool {
switch m.Distro {
case Ubuntu2004, Ubuntu2004Gen2:
case AKSUbuntu2004, Ubuntu2004, Ubuntu2004Gen2:
return true
default:
return false
Expand Down Expand Up @@ -1430,7 +1430,7 @@ func (a *AgentPoolProfile) IsFlatcar() bool {

// IsVHDDistro returns true if the distro uses VHD SKUs
func (a *AgentPoolProfile) IsVHDDistro() bool {
return a.Distro == AKSUbuntu1604 || a.Distro == AKSUbuntu1804
return a.Distro == AKSUbuntu1604 || a.Distro == AKSUbuntu1804 || a.Distro == AKSUbuntu2004
}

// IsAuditDEnabled returns true if the master profile is configured for auditd
Expand Down Expand Up @@ -1513,7 +1513,7 @@ func (a *AgentPoolProfile) IsUbuntu1804() bool {
func (a *AgentPoolProfile) IsUbuntu2004() bool {
if a.OSType != Windows {
switch a.Distro {
case Ubuntu2004, Ubuntu2004Gen2:
case AKSUbuntu2004, Ubuntu2004, Ubuntu2004Gen2:
return true
default:
return false
Expand Down
3 changes: 2 additions & 1 deletion pkg/api/vlabs/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
AKSDockerEngine Distro = "aks-docker-engine" // deprecated docker-engine distro.
AKSUbuntu1604 Distro = "aks-ubuntu-16.04"
AKSUbuntu1804 Distro = "aks-ubuntu-18.04"
AKSUbuntu2004 Distro = "aks-ubuntu-20.04"
ACC1604 Distro = "acc-16.04"
)

Expand Down Expand Up @@ -100,7 +101,7 @@ var (
ContainerRuntimeValues = [...]string{"", Docker, Containerd}

// DistroValues holds the valid values for OS distros
DistroValues = []Distro{"", Ubuntu, Ubuntu2004, Ubuntu2004Gen2, Ubuntu1804, Ubuntu1804Gen2, Flatcar, AKSUbuntu1604, AKSUbuntu1804, ACC1604}
DistroValues = []Distro{"", Ubuntu, Ubuntu2004, Ubuntu2004Gen2, Ubuntu1804, Ubuntu1804Gen2, Flatcar, AKSUbuntu1604, AKSUbuntu1804, AKSUbuntu2004, ACC1604}

// DependenciesLocationValues holds the valid values for dependencies location
DependenciesLocationValues = []DependenciesLocation{"", AzureCustomCloudDependenciesLocationPublic, AzureCustomCloudDependenciesLocationChina, AzureCustomCloudDependenciesLocationGerman, AzureCustomCloudDependenciesLocationUSGovernment}
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/vlabs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ func (m *MasterProfile) IsUbuntu1804() bool {
// IsUbuntu2004 returns true if the master profile distro is based on Ubuntu 20.04
func (m *MasterProfile) IsUbuntu2004() bool {
switch m.Distro {
case Ubuntu2004, Ubuntu2004Gen2:
case AKSUbuntu2004, Ubuntu2004, Ubuntu2004Gen2:
return true
default:
return false
Expand Down Expand Up @@ -938,7 +938,7 @@ func (a *AgentPoolProfile) IsUbuntu1804() bool {
func (a *AgentPoolProfile) IsUbuntu2004() bool {
if a.OSType != Windows {
switch a.Distro {
case Ubuntu2004, Ubuntu2004Gen2:
case AKSUbuntu2004, Ubuntu2004, Ubuntu2004Gen2:
return true
default:
return false
Expand Down
9 changes: 7 additions & 2 deletions pkg/api/vlabs/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ func Test_OrchestratorProfile_Validate(t *testing.T) {
Count: 10,
Distro: AKSUbuntu1804,
},
{
Name: "ubuntu2004pool",
Count: 10,
Distro: AKSUbuntu2004,
},
},
},
},
Expand Down Expand Up @@ -4460,7 +4465,7 @@ func TestAgentPoolProfile_ValidateAuditDEnabled(t *testing.T) {
if err := cs.Properties.validateAgentPoolProfiles(false); err.Error() != expectedMsg {
t.Errorf("expected error with message : %s, but got %s", expectedMsg, err.Error())
}
case Ubuntu, Ubuntu1804, Ubuntu1804Gen2, AKSUbuntu1604, AKSUbuntu1804, ACC1604:
case Ubuntu, Ubuntu1804, Ubuntu1804Gen2, AKSUbuntu1604, AKSUbuntu1804, AKSUbuntu2004, ACC1604:
if err := cs.Properties.validateAgentPoolProfiles(false); err != nil {
t.Errorf("AuditDEnabled should work with distro %s, got error %s", distro, err.Error())
}
Expand All @@ -4483,7 +4488,7 @@ func TestMasterProfile_ValidateAuditDEnabled(t *testing.T) {
if err := cs.Properties.validateMasterProfile(false); err.Error() != expectedMsg {
t.Errorf("expected error with message : %s, but got %s", expectedMsg, err.Error())
}
case Ubuntu, Ubuntu1804, Ubuntu1804Gen2, AKSUbuntu1604, AKSUbuntu1804, ACC1604:
case Ubuntu, Ubuntu1804, Ubuntu1804Gen2, AKSUbuntu1604, AKSUbuntu1804, AKSUbuntu2004, ACC1604:
if err := cs.Properties.validateMasterProfile(false); err != nil {
t.Errorf("AuditDEnabled should work with distro %s, got error %s", distro, err.Error())
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/armhelpers/support_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func toImageConfig(distro api.Distro) api.AzureOSImageConfig {
return api.AKSUbuntu1604OSImageConfig
case api.AKSUbuntu1804:
return api.AKSUbuntu1804OSImageConfig
case api.AKSUbuntu2004:
return api.AKSUbuntu2004OSImageConfig
case api.ACC1604:
return api.ACC1604OSImageConfig
default:
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/engine/template.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//+build test
//go:build test
// +build test

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

Expand Down Expand Up @@ -428,7 +430,7 @@ func Build(cfg *config.Config, masterSubnetID string, agentSubnetIDs []string, i
if config.Distro != "" {
prop.MasterProfile.Distro = vlabs.Distro(config.Distro)
for _, pool := range prop.AgentPoolProfiles {
if !pool.IsWindows() {
if !pool.IsWindows() && pool.Distro == "" {
pool.Distro = vlabs.Distro(config.Distro)
}
}
Expand Down
Loading

0 comments on commit 904b3ff

Please sign in to comment.