-
Notifications
You must be signed in to change notification settings - Fork 525
fix: ensure correct agent pool selection in scale operations #4851
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
cmd/scale_test.go
Outdated
agentPoolIndex: 0, | ||
agentPoolToScale: "linuxpool", | ||
agentPool: &api.AgentPoolProfile{ | ||
Name: "linuxpool2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure you can find yourself in a situation where sc.agentPoolToScale
and sc.agentPool.Name
are different: https://github.com/Azure/aks-engine/blob/master/cmd/scale.go#L204-L227
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated agentPool.Name
@@ -135,3 +136,106 @@ func TestScaleCmdValidate(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func TestVmInVMASAgentPool(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems we are missing a case where agentPoolToScale
is the empty string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agentPoolToScale
empty string case should have been covered by these lines (https://github.com/Azure/aks-engine/blob/master/cmd/scale.go#L209-L211)
Reason for Change:
When there are multiple Windows / Linux agent pools, the scale operation is not selecting the correct agent pool.
For Windows agent pools, the code
vmName[:9] == sc.containerService.Properties.GetAgentVMPrefix(sc.agentPool, winPoolIndex)[:9]
will always be true and thus all Windows agent pools will be mixed in scaling and indexing.For Linux agent pools, for example if one agentpool is named
linuxpool
and the other agentpool is namedlinxpool2
, and scale operation targetslinuxpool
, then codestrings.Contains(vmName, sc.agentPoolToScale)
will also consider VMs fromlinuxpool2
are in agentpoollinuxpool
.Issue Fixed:
#1065
Credit Where Due:
Does this change contain code from or inspired by another project?
If "Yes," did you notify that project's maintainers and provide attribution?
Requirements:
Notes: