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

Unwind Failed Deploys Improvements #427

Merged
merged 33 commits into from
Mar 5, 2019
Merged

Conversation

aballman
Copy link
Contributor

@aballman aballman commented Feb 7, 2019

  • Unwinds rollbacks with scaling operations
  • Handles removing deploys/rs when they are a 'new' service part of an existing deploy
  • Grabs ReplicaSet definitions before Deployment and stores in-memory
  • Simplifies testing framework for Deployments test

@aballman aballman added T/Enhancement Type: Enhancement of existing feature P/Medium Priority: Medium labels Feb 7, 2019
@codecov
Copy link

codecov bot commented Feb 7, 2019

Codecov Report

Merging #427 into master will increase coverage by 0.74%.
The diff coverage is 43.13%.

@@            Coverage Diff             @@
##           master     #427      +/-   ##
==========================================
+ Coverage   61.31%   62.05%   +0.74%     
==========================================
  Files          51       51              
  Lines        5260     5239      -21     
==========================================
+ Hits         3225     3251      +26     
+ Misses       1717     1666      -51     
- Partials      318      322       +4

@aballman aballman added S/Review Status: Please review S/Testing Status: Testing labels Feb 11, 2019
@aballman aballman removed the S/Testing Status: Testing label Feb 11, 2019
}
}
// This is used in case the above updatescale operation does not complete.
// In that case we'll need to delete all the pods that are in this namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, is deleting pods this way the same as how deleting pods through kubectl is? If that's the case, wouldn't new pods spring up to replace the deleted pods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't looked through the source for kubectl, but in practice if you delete the replica set via the API it does NOT delete the associated pods. I tell the RS to scale down here to initiate the termination process and then delete the RS. If that all fails, then I just delete the pods.

Copy link
Contributor

@drshrey drshrey Feb 13, 2019

Choose a reason for hiding this comment

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

I see! I did find the PropagationPolicy option in DeleteOptions that seems relevant to this problem: https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#DeleteOptions. If we specify Foreground or Background, then it will delete dependents of that particular object.

I'm not sure if we should handle dependent deletion ourselves if they already provide a way to do it. More information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#additional-note-on-deployments.

plugins/kubernetes/deployment.go Outdated Show resolved Hide resolved
plugins/kubernetes/deployment_test.go Outdated Show resolved Hide resolved
plugins/kubernetes/deployment_test.go Show resolved Hide resolved
plugins/kubernetes/deployment_test.go Show resolved Hide resolved
Replicas: 0,
},
}
if firstDeploy {
Copy link
Contributor

Choose a reason for hiding this comment

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

kind of personal preference I suppose, but I think you can collapse this statement into the if/else on line 1399

@aballman aballman merged commit d7c08fa into master Mar 5, 2019
drshrey pushed a commit that referenced this pull request Mar 5, 2019
* waitForDeploymentSuccess now reports what failed and what succeeded

* WIP Unwind Failed Deploys

* Apply deployment annotations to deployment. Not replicaset annotations to deployment

* Corrected issues with retrieving replicasets based off of generation vs revision annotation

* Added comments to deployment updates
drshrey pushed a commit that referenced this pull request Mar 11, 2019
* waitForDeploymentSuccess now reports what failed and what succeeded

* WIP Unwind Failed Deploys

* Apply deployment annotations to deployment. Not replicaset annotations to deployment

* Corrected issues with retrieving replicasets based off of generation vs revision annotation

* Added comments to deployment updates
@aballman aballman deleted the andrew/unwind-failed-deploys branch April 29, 2019 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P/Medium Priority: Medium S/Review Status: Please review T/Enhancement Type: Enhancement of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants