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

fix: upgrade broken for VMAS + managed identities #4021

Merged
merged 7 commits into from
Nov 12, 2020

Conversation

jadarsie
Copy link
Member

@jadarsie jadarsie commented Nov 11, 2020

Reason for Change:

Upgrade fails for VMAS clusters if its VMs own a roleAssignment resource.

The problem is that NormalizeResourcesForK8sMasterUpgrade is not filtering roleAssignments resources and ARM complains because these roleAssignments resources depend on missing VM resources.

stdout message:

INFO[0005] Starting ARM Deployment master-20-11-10T15.11.09-1247996574 in resource group upgrade. This will take some time... 
INFO[0006] Error creating upgraded master VM with index: 0 
Error: upgrading cluster: resources.DeploymentsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidTemplate" Message="Deployment template validation failed: 'The resource 'Microsoft.Compute/virtualMachines/k8s-linuxpool-25762572-0' is not defined in the template. Please see https://aka.ms/arm-template for usage details.'." AdditionalInfo=[{"info":{"lineNumber":0,"linePosition":0,"path":""},"type":"TemplateViolation"}]

Notes:

  • Fixed what I think is a problem with the existing tests (nodepool name typo).
  • Added a new test to truly validate NormalizeResourcesForK8sMasterUpgrade when upgrading master nodes

Credit Where Due:

Does this change contain code from or inspired by another project?

  • No
  • Yes

Requirements:

@codecov
Copy link

codecov bot commented Nov 11, 2020

Codecov Report

Merging #4021 (13e6c61) into master (c309c3f) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4021      +/-   ##
==========================================
+ Coverage   73.69%   73.72%   +0.03%     
==========================================
  Files         147      147              
  Lines       23164    23177      +13     
==========================================
+ Hits        17070    17087      +17     
+ Misses       4979     4976       -3     
+ Partials     1115     1114       -1     
Impacted Files Coverage Δ
...g/operations/kubernetesupgrade/upgradeagentnode.go 47.88% <ø> (ø)
.../operations/kubernetesupgrade/upgrademasternode.go 42.55% <ø> (ø)
pkg/engine/transform/transform.go 71.76% <100.00%> (+2.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c309c3f...13e6c61. Read the comment docs.

logger.Infoln(fmt.Sprintf("Evaluating if agent resource: %s needs to be removed", resourceName))
removeRole := true
// The usage of NormalizeResourcesForK8sMasterUpgrade across the code base seems to indicate that
// agentPoolsToPreserve == nil => master node upgrade
Copy link
Member

Choose a reason for hiding this comment

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

do you mean if agentPoolsToPreserve has a length of 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -1,5 +1,6 @@
{
"env": {
"UPGRADE_CLUSTER": true,
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@jackfrancis jackfrancis left a comment

Choose a reason for hiding this comment

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

/lgtm

@acs-bot acs-bot added the lgtm label Nov 12, 2020
@jackfrancis jackfrancis merged commit 3fa95be into Azure:master Nov 12, 2020
@acs-bot
Copy link

acs-bot commented Nov 12, 2020

[APPROVALNOTIFIER] This PR is APPROVED

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

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 [jackfrancis,jadarsie]

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants