Skip to content
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

Add abort functionality #224

Merged
merged 11 commits into from
Oct 29, 2019
Merged

Add abort functionality #224

merged 11 commits into from
Oct 29, 2019

Conversation

dthomson25
Copy link
Member

Future work:

  • add abort status into the list kubectl plugin command

@codecov
Copy link

codecov bot commented Oct 25, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@b4837fe). Click here to learn what that means.
The diff coverage is 96.69%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #224   +/-   ##
=========================================
  Coverage          ?   85.14%           
=========================================
  Files             ?       49           
  Lines             ?     4376           
  Branches          ?        0           
=========================================
  Hits              ?     3726           
  Misses            ?      460           
  Partials          ?      190
Impacted Files Coverage Δ
utils/conditions/conditions.go 89.13% <ø> (ø)
rollout/sync.go 75.77% <100%> (ø)
utils/replicaset/canary.go 68.38% <100%> (ø)
pkg/kubectl-argo-rollouts/cmd/abort/abort.go 100% <100%> (ø)
rollout/canary.go 87.02% <100%> (ø)
rollout/pause.go 100% <100%> (ø)
rollout/analysis.go 85.9% <100%> (ø)
pkg/kubectl-argo-rollouts/cmd/cmd.go 100% <100%> (ø)
pkg/kubectl-argo-rollouts/cmd/retry/retry.go 100% <100%> (ø)
rollout/experiment.go 83.03% <77.77%> (ø)

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 b4837fe...04f7dad. Read the comment docs.

@dthomson25
Copy link
Member Author

Closes #199 #201 #200

Copy link
Member

@jessesuen jessesuen left a comment

Choose a reason for hiding this comment

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

In syncRolloutStatusCanary(), why don't we clear the abort flag in the if replicasetutil.PodTemplateOrStepsChanged(r, newRS) block of code:

https://github.com/argoproj/argo-rollouts/pull/224/files#diff-d1ccd8052e9aba96f2e786d68daf4a7bR268-R277

@@ -64,7 +64,12 @@ func (c *RolloutController) rolloutCanary(rollout *v1alpha1.Rollout, rsList []*a
}

logCtx.Info("Reconciling AnalysisRun step")
if err = c.reconcileAnalysisRuns(roCtx); err != nil {
addPause, err := c.reconcileAnalysisRuns(roCtx)
if addPause {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than surfacing a bool here, could we call

err := c.reconcileAnalysisRuns(roCtx)
if roCtx.PauseContext().HasAddPause() {
    logCtx.Info("Detected pause due to inconclusive AnalysisRun")
    return c.syncRolloutStatusCanary(roCtx)
}
if err != nil {
    return err
}

@@ -41,44 +41,49 @@ func (c *RolloutController) getAnalysisRunsForRollout(rollout *v1alpha1.Rollout)
return ownedByRollout, nil
}

func (c *RolloutController) reconcileAnalysisRuns(roCtx *canaryContext) error {
func (c *RolloutController) reconcileAnalysisRuns(roCtx *canaryContext) (bool, error) {
Copy link
Member

Choose a reason for hiding this comment

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

See my other comment, I think instead of making sure we are returning true/false correctly in this function, I think the caller can check for roCtx.PauseContext().HasAddPause() after calling this function. With my suggested approach, it means we don't have to ensure we correctly return true/false everywhere, because there is a single source of truth.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I like that a lot more

if currBackgroundAr != nil {
if currBackgroundAr.Status == nil || !currBackgroundAr.Status.Status.Completed() || analysisutil.IsTerminating(currBackgroundAr) {
if currBackgroundAr != nil && !r.Status.Abort {
if currBackgroundAr.Status == nil || !currBackgroundAr.Status.Status.Completed() {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why I made AnalysisRun.Status a bool pointer. Seems like it just makes the code annoying to deal with.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it adds a lot of nil checks.

@dthomson25
Copy link
Member Author

The clearing of abort is implicit because I do not set the newStatus.Abort to the old status value. As a result, I have a couple locations that add the abort:

newStatus.Abort = true

newStatus.Abort = true

newStatus.Abort = true

@dthomson25
Copy link
Member Author

I'm thinking about adding abort to the pauseContext and setting the newstatus using the CalculatePauseStatus method.

@dthomson25 dthomson25 merged commit 37bc1f7 into master Oct 29, 2019
@dthomson25 dthomson25 deleted the add-abort branch October 29, 2019 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants