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

fix: don’t assign distro if image ref is provided #2055

Merged
merged 4 commits into from Oct 9, 2019

Conversation

jackfrancis
Copy link
Member

@jackfrancis jackfrancis commented Sep 28, 2019

Reason for Change:

This PR addresses an unresolved collision between imageReference configuration and our curated OS images (which are delivered via the distro configuration property). Specifically, unknown outcomes will occur if we associate any specific distro value with a cluster spec that includes a custom imageReference configuration.

Includes additional validation to fail fast when imageReference + distro configurations are used.

Issue Fixed:

Requirements:

Notes:

@@ -404,7 +404,7 @@ func (p *Properties) setExtensionDefaults() {
}

func (p *Properties) setMasterProfileDefaults(isUpgrade, isScale bool, cloudName string) {
if p.MasterProfile.Distro == "" {
if p.MasterProfile.Distro == "" && p.MasterProfile.ImageRef == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should assign a Distro value custom or something like that so it's explicit and doesn't run into unexpected usages of empty distro value.

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 preference for using empty string as a more expressive/semantic value of "this cluster is not using any distro configuration"

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I think setting to nil is most clear if we want to say "no distro set." But that may have unfortunate ripple effects in the code, so I'm fine with empty string.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm... might be taste, but I'd vote for either *string to indicate emptiness or just document what "" means. I worry that adding a default that is not a golang idiomatic default value would further complicate. If we were to move down that path, then I think I'd not use a string, but rather a type (an enumeration).

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 don't understand this part

adding a default that is not a golang idiomatic default value would further complicate

Is it non-idiomatic to assign significance to the zero value of a type? (in this case a string, so "")

Copy link
Member

@devigned devigned Sep 30, 2019

Choose a reason for hiding this comment

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

I'm sorry for not being clear. "" is the idiomatic default value for string. In contrast, a default of "custom" would not be. If we were to use "custom" as the default value, I would vote we use a named type for Distro rather than a string.

@jackfrancis jackfrancis added this to In progress in backlog Sep 30, 2019
@acs-bot acs-bot added size/XL and removed size/L labels Sep 30, 2019
@codecov
Copy link

codecov bot commented Oct 1, 2019

Codecov Report

Merging #2055 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2055      +/-   ##
==========================================
+ Coverage   76.59%   76.59%   +<.01%     
==========================================
  Files         135      135              
  Lines       20618    20622       +4     
==========================================
+ Hits        15792    15796       +4     
  Misses       3903     3903              
  Partials      923      923

@marosset
Copy link
Contributor

marosset commented Oct 2, 2019

We should add a cluster config to use in a jenkins to validate this as well.
When i started looking at the way images were specified for windows pools there was documentation for targeting a VHD but the code behind that either never worked or had rotted :(

@CecileRobertMichon
Copy link
Contributor

@jackfrancis I took another look at this PR and I don't see how it fixes issue #2036. In order to fix it we need to change CSE to skip apt package installs for custom images that aren't using the AKS distro but have those packages pre-installed because they are based on the AKS VHD, does that make sense?

@jackfrancis
Copy link
Member Author

This tested out O.K. using the packer pipeline defined in #2118 🎉

@jackfrancis
Copy link
Member Author

@CecileRobertMichon I don't quite understand by I'm happy to remove the reference to #2036 if this doesn't address that. (i.e., I'd like to merge this as-is)

@devigned
Copy link
Member

devigned commented Oct 9, 2019

/lgtm

@acs-bot
Copy link

acs-bot commented Oct 9, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: devigned, jackfrancis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [devigned,jackfrancis]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jackfrancis jackfrancis merged commit 53ec5d9 into Azure:master Oct 9, 2019
backlog automation moved this from In progress to Done Oct 9, 2019
@jackfrancis jackfrancis deleted the fix-imageref-distro branch October 9, 2019 18:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
backlog
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants