Skip to content

Updated commands to oc adm drain node #5709

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

Merged
merged 1 commit into from
Feb 21, 2018

Conversation

ahardin-rh
Copy link
Contributor

Addresses #5613

@pravisankar Can you please check the syntax here?

@ahardin-rh
Copy link
Contributor Author

@pravisankar PTAL

@@ -245,22 +245,19 @@ To list pods that will be migrated without actually performing the evacuation,
use the `--dry-run` option:

----
$ oadm manage-node <node1> <node2> \
--evacuate --dry-run [--pod-selector=<pod_selector>]
$ oadm drain <node1> <node2> --dry-run [--pod-selector=<pod_selector>]

Choose a reason for hiding this comment

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

--pod-selector is not a valid option for oadm drain.
Supported options:

 Usage:
  oadm drain NODE [options]

Examples:
  # Drain node "foo", even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet on it.
  $ oadm drain foo --force
  
  # As above, but abort if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet, and use a grace period of 15 minutes.
  $ oadm drain foo --grace-period=900

Options:
      --delete-local-data=false: Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained).
      --dry-run=false: If true, only print the object that would be sent, without sending it.
      --force=false: Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet.
      --grace-period=-1: Period of time in seconds given to each pod to terminate gracefully. If negative, the default value specified in the pod will be used.
      --ignore-daemonsets=false: Ignore DaemonSet-managed pods.
      --timeout=0s: The length of time to wait before giving up, zero means infinite

@ncbaratta ncbaratta added the peer-review-done Signifies that the peer review team has reviewed this PR label Nov 9, 2017
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 6, 2017
@ahardin-rh
Copy link
Contributor Author

@pravisankar Thanks for your guidance. This is now updated. PTAL.

Copy link

@pravisankar pravisankar left a comment

Choose a reason for hiding this comment

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

I'm not sure if this doc holds true for enterprise 3.5, 3.6, 3.7 and 3.9.
At least latest origin code (3.9) currently does not show --dry-run option but 3.9 is not released yet. Currently k8s rebase is in progress (openshift/origin#17576) and we may have --pod-selector and selector options (openshift/origin#17616) and also --dry-run option (openshift/origin#16333).
I would recommend holding off publishing this change for 3.9 until we have final build ready and make sure all the oadm drain flags are same in 3.5, 3.6 and 3.7.

----

If `dry-run` is set to `true`, you only print the object that would be sent,
without sending it.

To actually evacuate all or selected pods on one or more nodes:

Choose a reason for hiding this comment

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

To actually evacuate all pods on one or more nodes: (currently there is no option to select pods)

@ahardin-rh
Copy link
Contributor Author

@pravisankar Okay, thanks. I will check back in later on this.

@@ -245,27 +245,45 @@ To list pods that will be migrated without actually performing the evacuation,
use the `--dry-run` option:

----
$ oadm manage-node <node1> <node2> \
--evacuate --dry-run [--pod-selector=<pod_selector>]
$ oadm drain <node1> --dry-run=true
Copy link

Choose a reason for hiding this comment

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

oadm has been removed: openshift/origin#17396
it's being re-added already but with a fat decprecated warning though
oc adm is preferred

@miminar
Copy link

miminar commented Dec 14, 2017

👍

I've just received complaints about this from a customer. I'm pleased to see it being fixed.

@vikram-redhat vikram-redhat modified the milestones: Next Release, Staging Jan 8, 2018
@ghost
Copy link

ghost commented Feb 13, 2018

@ahardin-rh Any update on this? I have a bug that is related: https://bugzilla.redhat.com/show_bug.cgi?id=1477380

Cc: @vikram-redhat

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 17, 2018
@ahardin-rh
Copy link
Contributor Author

@tmorriso-rh Per discussion earlier in this PR, we decided to hold off on merging this until there is a final build ready so that we can confirm that oc adm drain flags are the same in 3.5, 3.6, and 3.7.
@pravisankar Any updates on this?

@pravisankar
Copy link

drain is an upstream k8s CLI command, corresponding kube docs already available but depending on when we do k8s rebase in openshift, available CLI options may vary. I'm guessing we are also documenting these commands to exactly show available command options for a particular release.

This is how drain command was evolved:
Options available in 3.5 and 3.6 release:

      --delete-local-data=false: Continue even if there are pods using emptyDir (local data that will be deleted when
the node is drained).
      --force=false: Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet
or StatefulSet.
      --grace-period=-1: Period of time in seconds given to each pod to terminate gracefully. If negative, the default
value specified in the pod will be used.
      --ignore-daemonsets=false: Ignore DaemonSet-managed pods.
      --timeout=0s: The length of time to wait before giving up, zero means infinite

3.7 release:

In addition to options in 3.6
--dry-run=false: If true, only print the object that would be sent, without sending it.

3.8 release:

In addition to options in 3.7
--pod-selector='': Label selector to filter pods on the node
option --dry-run was removed, not sure why that was done

3.9 release:

In addition to options in 3.8
[option '--dry-run' was re-introduced]
--dry-run=false: If true, only print the object that would be sent, without sending it.
 -l, --selector='': Selector (label query) to filter on

Copy link

@pravisankar pravisankar left a comment

Choose a reason for hiding this comment

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

We have enough information now to doc this command. Provided needed details

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 20, 2018
@ahardin-rh ahardin-rh changed the title Updated commands to oadm drain node Updated commands to oc adm drain node Feb 20, 2018
@ahardin-rh
Copy link
Contributor Author

@pravisankar Thanks for your guidance! PTAL. This PR addresses 3.5 and 3.6. I will open companion PRs for 3.7 and 3.9 to add in the additional details for each. We are not releasing docs for 3.8, but it's interesting seeing the evolution. Thanks again for all of your help in getting this moved along!

Copy link

@pravisankar pravisankar left a comment

Choose a reason for hiding this comment

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

Minor nit otherwise LGTM

@@ -241,31 +241,49 @@ controller] can be evacuated; the replication controllers create new pods on
other nodes and remove the existing pods from the specified node(s). Bare pods,
meaning those not backed by a replication controller, are unaffected by default.

To list pods that will be migrated without actually performing the evacuation,
use the `--dry-run` option:
To actually evacuate all or selected pods on one or more nodes:

Choose a reason for hiding this comment

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

To actually evacuate one or more nodes:
[Selecting pods needs --pod-selector and this option is not available in 3.5/3.6]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pravisankar Updated. Thank you!

@ahardin-rh
Copy link
Contributor Author

Updated per feedback. I will merge this and build off of it for 3.7 and 3.9 docs in separate PRs. Revision histories for each will be applied in the cherry-pick PRs.

@ahardin-rh ahardin-rh merged commit 9dc4af3 into openshift:master Feb 21, 2018
@ahardin-rh
Copy link
Contributor Author

/cherrypick enterprise-3.5

@openshift-cherrypick-robot

@ahardin-rh: new pull request created: #7874

In response to this:

/cherrypick enterprise-3.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ahardin-rh
Copy link
Contributor Author

/cherrypick enterprise-3.6

@openshift-cherrypick-robot

@ahardin-rh: new pull request created: #7875

In response to this:

/cherrypick enterprise-3.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/enterprise-3.5 branch/enterprise-3.6 peer-review-done Signifies that the peer review team has reviewed this PR size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants