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

AKS distro is for Kubernetes only #3951

Merged
merged 4 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pkg/acsengine/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,11 @@ func setExtensionDefaults(a *api.Properties) {
}

func setMasterProfileDefaults(a *api.Properties, isUpgrade bool) {
// don't default Distro for OpenShift
if !a.OrchestratorProfile.IsOpenShift() {
if a.MasterProfile.Distro == "" {
if a.MasterProfile.Distro == "" {
if a.OrchestratorProfile.IsKubernetes() {
a.MasterProfile.Distro = api.AKS
} else if !a.OrchestratorProfile.IsOpenShift() {
a.MasterProfile.Distro = api.Ubuntu
}
}
// set default to VMAS for now
Expand Down Expand Up @@ -646,14 +647,15 @@ func setAgentProfileDefaults(a *api.Properties, isUpgrade, isScale bool) {
profile.AcceleratedNetworkingEnabled = helpers.PointerToBool(!isUpgrade && !isScale && helpers.AcceleratedNetworkingSupported(profile.VMSize))
}

// don't default Distro for OpenShift
if !a.OrchestratorProfile.IsOpenShift() {
if profile.Distro == "" {
if profile.Distro == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if profile.Distro == "" {
			if a.OrchestratorProfile.IsKubernetes() && profile.OSDiskSizeGB >= api.VHDDiskSizeAKS {
				profile.Distro = api.AKS
			} else {
				profile.Distro = api.Ubuntu
			}
		}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've optimized it to that. Does it look okay?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a slight preference for the current implementation as it emphasizes the k8s-specific conditions (which could grow over time based on more k8s-specific distros.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition profile.OSDiskSizeGB >= api.VHDDiskSizeAKS is not equivalent to profile.OSDiskSizeGB != 0 && profile.OSDiskSizeGB < api.VHDDiskSizeAKS

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. profile.OSDiskSizeGB=0 represents a nil state I am assuming?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also again we don't want to set the distro for openshift

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also what @CecileRobertMichon said. It's bit clumsy, but we want to include the zero value (0) when evaluating what to do. zero value means AKS distro, in this case.

if a.OrchestratorProfile.IsKubernetes() {
if profile.OSDiskSizeGB != 0 && profile.OSDiskSizeGB < api.VHDDiskSizeAKS {
profile.Distro = api.Ubuntu
} else {
profile.Distro = api.AKS
}
} else if !a.OrchestratorProfile.IsOpenShift() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CecileRobertMichon we're covering the OpenShift condition here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, my comment was regarding Tariq's proposed implementation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool then. Thanks for the clarifications

profile.Distro = api.Ubuntu
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/acsengine/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,14 @@ func TestSetComponentsNetworkDefaults(t *testing.T) {
expectedDistro api.Distro // expected result default disto to be used
}{
{
"ubuntu_kubernetes",
"default_kubernetes",
api.OrchestratorProfile{
OrchestratorType: api.Kubernetes,
},
api.AKS,
},
{
"rhel_openshift",
"default_openshift",
api.OrchestratorProfile{
OrchestratorType: api.OpenShift,
},
Expand Down