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

feat: Make cordon drain timeout configurable with --upgrade #1276

Merged
merged 6 commits into from
May 10, 2019

Conversation

aramase
Copy link
Member

@aramase aramase commented May 10, 2019

Reason for Change:

Make the cordon drain timeout value configurable in --upgrade command.

Issue Fixed:

Fixes #950

Requirements:

Notes:

@acs-bot acs-bot added the size/L label May 10, 2019
@acs-bot
Copy link

acs-bot commented May 10, 2019

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aramase
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: mboersma

If they are not already assigned, you can assign the PR to them by writing /assign @mboersma in a comment when ready.

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:

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

cmd/upgrade.go Outdated Show resolved Hide resolved
@aramase aramase changed the title feat: Make cordon drain timeout configurable with --upgrade [WIP] feat: Make cordon drain timeout configurable with --upgrade May 10, 2019
@codecov
Copy link

codecov bot commented May 10, 2019

Codecov Report

Merging #1276 into master will decrease coverage by 0.02%.
The diff coverage is 47.61%.

@@            Coverage Diff             @@
##           master    #1276      +/-   ##
==========================================
- Coverage   74.76%   74.73%   -0.03%     
==========================================
  Files         128      128              
  Lines       18333    18348      +15     
==========================================
+ Hits        13706    13713       +7     
- Misses       3836     3843       +7     
- Partials      791      792       +1

@aramase aramase changed the title [WIP] feat: Make cordon drain timeout configurable with --upgrade feat: Make cordon drain timeout configurable with --upgrade May 10, 2019
@aramase
Copy link
Member Author

aramase commented May 10, 2019

@CecileRobertMichon Had to fix unit tests. Let me know what you think.

cmd/upgrade.go Outdated
@@ -70,6 +72,7 @@ func newUpgradeCmd() *cobra.Command {
f.StringVar(&uc.deploymentDirectory, "deployment-dir", "", "the location of the output from `generate`")
f.StringVarP(&uc.upgradeVersion, "upgrade-version", "k", "", "desired kubernetes version (required)")
f.IntVar(&uc.timeoutInMinutes, "vm-timeout", -1, "how long to wait for each vm to be upgraded in minutes")
f.IntVar(&uc.cordonDrainTimeoutInMinutes, "cordon-drain-timeout", 20, "how long to wait for each vm to be cordoned in minutes")
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon May 10, 2019

Choose a reason for hiding this comment

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

let's move the default logic to the upgrader code (similar to how timeoutInMinutes is doing it) because AKS also calls upgrader so we want to make sure that the timeout isn't nil for them.

In other words, let's set the arg default to -1 and only set uc.cordonDrainTimeout if the timeout != -1. Then in the upgrader, do something like https://github.com/Azure/aks-engine/blob/master/pkg/operations/kubernetesupgrade/upgrader.go#L261.

We could arguably leave the 20 default here as well instead of setting it to -1 but having a default timeout const in one place will make it easier to change the default in the future.

Copy link
Member Author

@aramase aramase May 10, 2019

Choose a reason for hiding this comment

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

Yeah, I was wondering why the default was being set there instead of here for vm upgrade timeout. Now I know 😊 I’ll make the change.

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've made the changes to set the default value in upgrader.

@aramase aramase force-pushed the cordondraintimeout branch from f3020be to 0f285b9 Compare May 10, 2019 17:14
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -497,6 +505,11 @@ func (ku *Upgrader) upgradeAgentScaleSets(ctx context.Context) error {

ku.logger.Infof("Successfully set capacity for VMSS %s", vmssToUpgrade.Name)

cordonDrainTimeout := defaultCordonDrainTimeout
Copy link
Member

Choose a reason for hiding this comment

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

Let's settle on a common "use default value if not provided" pattern. Lines 269-273 are doing the same thing, it seems, but in a sort of inverse way.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@jackfrancis
Copy link
Member

lgtm pending upgrade validation

thanks @aramase!

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

Successfully merging this pull request may close these issues.

Make cordon/drain timeout during upgrade configurable
4 participants