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

WIP: Attempt at cordon but no drain #45

Closed
wants to merge 2 commits into from

Conversation

jaxxstorm
Copy link
Contributor

This is an attempt at setting an option which will cordon the nodes, but not drain them.

Some workloads, for example workloads that use a lot of kind: Job will eventually have nodes cleared out on their own. By specifying a flag --no-drain and using this method, we can cordon the nodes so new workloads don't appear.

I'm not the best Go programmer, so any feedback or suggestions would be greatly welcomed.

@codecov
Copy link

codecov bot commented Jul 28, 2019

Codecov Report

Merging #45 into master will decrease coverage by 1.4%.
The diff coverage is 16.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
- Coverage   85.41%   84.01%   -1.41%     
==========================================
  Files           6        6              
  Lines         288      294       +6     
==========================================
+ Hits          246      247       +1     
- Misses         40       44       +4     
- Partials        2        3       +1
Impacted Files Coverage Δ
internal/kubernetes/drainer.go 89.56% <16.66%> (-4.02%) ⬇️

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 83b5f70...f9386a2. Read the comment docs.

@negz
Copy link
Collaborator

negz commented Aug 7, 2019

Thanks for the contribution @jaxxstorm! I'm on vacation for another two weeks, but will take a closer look when I'm back home if @jacobstr doesn't beat me to it.

@jaxxstorm
Copy link
Contributor Author

Any thoughts here?

cmd/draino/draino.go Outdated Show resolved Hide resolved
@jacobstr
Copy link
Contributor

@jaxxstorm sorry for the slow response here. Thanks for this contribution - just a few comments.

As per feedback:

- Change flag name to drain (automatically adds `--no-drain` flag)
- Add drain flag to NewAPICordonDrainer
- Improve drain function to remove function wrap
@jaxxstorm
Copy link
Contributor Author

Hi, I've implemented the suggested changes and have an open question about the --no-drain flag

@@ -163,6 +174,12 @@ func (d *APICordonDrainer) Cordon(n *core.Node) error {

// Drain the supplied node. Evicts the node of all but mirror and DaemonSet pods.
func (d *APICordonDrainer) Drain(n *core.Node) error {

// Do nothing
if !d.withDrain {
Copy link
Contributor

Choose a reason for hiding this comment

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

This file just needs a gofmt run on it.

Draino can be run in dry run mode using the `--dry-run` flag.

### Cordon Only
Draino can also optionally be run in a mode where the nodes are only cordoned, and not drained. This can be achieved by using the `--no-drain` flag
Copy link
Contributor

Choose a reason for hiding this comment

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

Period at the end of this sentence.

@salanki
Copy link

salanki commented Mar 1, 2020

It would be nice to see this finished up and merged.

@jacobstr jacobstr mentioned this pull request Mar 2, 2020
@jacobstr jacobstr closed this Mar 28, 2020
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.

None yet

4 participants