-
Notifications
You must be signed in to change notification settings - Fork 931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v8] Max in flight flag #3085
[v8] Max in flight flag #3085
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.
Looks mostly-good to me. some comments are concerns, most are minor suggestions
dep.DropletGUID = pushPlan.DropletGUID | ||
dep.Strategy = pushPlan.Strategy | ||
dep.Relationships = resources.Relationships{constant.RelationshipTypeApplication: resources.Relationship{GUID: pushPlan.Application.GUID}} | ||
dep := resources.Deployment{ |
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.
[comment, no action] good improvement / we should be using this style. I wonder if our linter catches the assignment approach you've replaced
|
||
import "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" | ||
|
||
func SetupDeploymentInformationForPushPlan(pushPlan PushPlan, overrides FlagOverrides) (PushPlan, error) { |
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.
[suggestion / question / nonblocking] why is this separate from create_deployment_for_push_plan
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.
actor.PreparePushPlanSequence
looked like the place where we were configuring the push plan by translating all the needed flags.
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.
Okay makes sense (the pushplansequence). In that case what's strangely-shaped is the location (siblings within v7pushaction) of two deployment functions that both take pushPlans. I see that this parallels the situation for e.g. droplet config, so I'm happy to move on from this topic for now and leave it up to a separate refactor
command/v7/copy_source_command.go
Outdated
@@ -17,6 +17,7 @@ type CopySourceCommand struct { | |||
RequiredArgs flag.CopySourceArgs `positional-args:"yes"` | |||
usage interface{} `usage:"CF_NAME copy-source SOURCE_APP DESTINATION_APP [-s TARGET_SPACE [-o TARGET_ORG]] [--no-restart] [--strategy STRATEGY] [--no-wait]"` | |||
Strategy flag.DeploymentStrategy `long:"strategy" description:"Deployment strategy can be canary, rolling or null"` | |||
MaxInFlight int `long:"max-in-flight" default:"-1" description:"Defines the maximum number of instances that will be actively being started. Only applies when --strategy flag is specified."` |
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.
[suggestion, blocking] it feels like the default should be the same as CAPI (1) or at least a valid value (resolves to the same, since 0 and negative numbers are invalid here)
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.
@pivotalgeorge looks like this concern has been addressed. Are you ok for this conversation to be resolved?
command/v7/copy_source_command.go
Outdated
return translatableerror.RequiredFlagsError{Arg1: "--max-in-flight", Arg2: "--strategy"} | ||
} | ||
|
||
if cmd.Strategy.Name != constant.DeploymentStrategyDefault && (cmd.MaxInFlight < -1 || cmd.MaxInFlight == 0) { |
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.
[suggestion, nonblocking] (cmd.MaxInFlight <= 0)
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.
[code since changed, comment in new review]
})) | ||
}) | ||
|
||
It("returns errors and warnings", func() { |
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.
[suggestion, nonblocking] do we want a happy-path case covered?
command/v7/rollback_command.go
Outdated
@@ -19,6 +20,7 @@ type RollbackCommand struct { | |||
Version flag.Revision `long:"version" required:"true" description:"Roll back to the specified revision"` | |||
relatedCommands interface{} `related_commands:"revisions"` | |||
usage interface{} `usage:"CF_NAME rollback APP_NAME [--version VERSION] [-f]"` | |||
MaxInFlight int `long:"max-in-flight" default:"-1" description:"Defines the maximum number of instances that will be actively being rolled back."` |
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.
same as previous default value comment
command/v7/restart_command.go
Outdated
"code.cloudfoundry.org/cli/command/v7/shared" | ||
) | ||
|
||
type RestartCommand struct { | ||
BaseCommand | ||
|
||
MaxInFlight int `long:"max-in-flight" default:"-1" description:"Defines the maximum number of instances that will be actively restarted at any given time. Only applies when --strategy flag is specified."` |
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.
same as previous default value comment
@@ -22,6 +23,10 @@ type Deployment struct { | |||
Strategy constant.DeploymentStrategy | |||
} | |||
|
|||
type DeploymentOpts struct { | |||
MaxInFlight int `json:"max_in_flight"` |
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.
👍
if d.Options != b { | ||
ccDeployment.Options = &d.Options | ||
if d.Options.MaxInFlight < 1 { | ||
ccDeployment.Options.MaxInFlight = 1 |
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.
[concern, blocking] what happens when we talk to an older CAPI, I.e. one that doesn't have max-in-flight? in #3088 we approached this by assuming that a value of 0 was "max-in-flight unset in the response" but I'm reading this block to mean that we'll always be setting max-in-flight to the default value of 1 and including it in a POST to CAPI
edit: Unless I am missing something and this object is only for unmarshalling the CAPI response
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.
The concern is valid. When max-in-flight gets to this point with a value we just send it to CAPI and CAPI will return an error, which I am going to address in the next commit.
Also did change the way we are defining if --max-in-flight is present or not by using a pointer instead of the -1 value which should make everything much easier to reason about.
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.
agreed on the nullable pointer being easy to reason about. If we handle the version issue in followup work I'm happy to consider this resolved.
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
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
- Provide a better error when talking to older versions of CAPI - Address some comments in the PR review Signed-off-by: João Pereira <joaod@vmware.com>
Signed-off-by: João Pereira <joaod@vmware.com>
33f58ca
to
deff01c
Compare
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
@@ -48,6 +49,14 @@ func (cmd *CopySourceCommand) ValidateFlags() error { | |||
} | |||
} | |||
|
|||
if cmd.Strategy.Name == constant.DeploymentStrategyDefault && cmd.MaxInFlight != nil { |
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.
[suggestion, blocking] I believe this is now incorrect: MaxInFlight can take a value of 0, which should be invalid for this flag
edit: I was looking at a diff against the previous changeset version of this PR, so missed the block below. So, disregard the positive value check comment.
However, shouldn't this read && cmd.MaxInFlight == nil
, as a required-arg check
-> I see that the default deployment strategy is empty-string, so this is actually correct.
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
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.
thanks for addressing previous comments
LGTM
* Allow the user to set max-in-flight while pushing app * Add max-in-flight flag to the restart command * Add max-in-flight flag to restage command * Add max-in-flight flag to rollback command * Add max-in-flight flag to copy-src command * Remove `--no-wait` to ensure no flakes --------- Signed-off-by: João Pereira <joaod@vmware.com>
* Allow the user to set max-in-flight while pushing app * Add max-in-flight flag to the restart command * Add max-in-flight flag to restage command * Add max-in-flight flag to rollback command * Add max-in-flight flag to copy-src command * Remove `--no-wait` to ensure no flakes --------- Signed-off-by: João Pereira <joaod@vmware.com>
* Allow the user to set max-in-flight while pushing app * Add max-in-flight flag to the restart command * Add max-in-flight flag to restage command * Add max-in-flight flag to rollback command * Add max-in-flight flag to copy-src command * Remove `--no-wait` to ensure no flakes --------- Signed-off-by: João Pereira <joaod@vmware.com>
* Allow the user to set max-in-flight while pushing app * Add max-in-flight flag to the restart command * Add max-in-flight flag to restage command * Add max-in-flight flag to rollback command * Add max-in-flight flag to copy-src command * Remove `--no-wait` to ensure no flakes --------- Signed-off-by: João Pereira <joaod@vmware.com> Co-authored-by: Pavel Busko <pavel.busko@sap.com>
Description of the Change
Add the max-in-flight flag to all the commands