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

Warn user to disable default node selector when using daemonsets #8125

Merged

Conversation

tnozicka
Copy link
Contributor

Stems from https://bugzilla.redhat.com/show_bug.cgi?id=1501514#c9

Permissions were disabled here: openshift/origin#18971

This is a part of solving 3.9 blocker, so we need to backport it in time.

/cc @mfojtik

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 14, 2018
@tnozicka
Copy link
Contributor Author

/cherrypick enterprise-3.9

@openshift-cherrypick-robot

@tnozicka: once the present PR merges, I will cherry-pick it on top of enterprise-3.9 in a new PR and assign it to you.

In response to this:

/cherrypick enterprise-3.9

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.

@tnozicka tnozicka requested a review from bfallonf March 14, 2018 17:58
@tnozicka
Copy link
Contributor Author

/cc @openshift/team-documentation

@tnozicka tnozicka requested a review from Miciah March 15, 2018 10:01
@tnozicka tnozicka changed the title Warn user to disable default node selector when using daemonset Warn user to disable default node selector when using daemonsets Mar 15, 2018
@tnozicka
Copy link
Contributor Author

This is 3.9 blocker, needs to go asap.

/cc @vikram-redhat @adellape @bmcelvee @ahardin-rh @gaurav-nelson

@vikram-redhat
Copy link
Contributor

'{"metadata": {"annotations": {"openshift.io/node-selector": ""}}}'
----

xref:../admin_guide/manage_projects.adoc#using-node-selectors[Learn more about node selectors.]
Copy link
Contributor

Choose a reason for hiding this comment

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

managing_projects.adoc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch; one would say that CI should scream though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@vikram-redhat
Copy link
Contributor

@tnozicka I have one comment. Assigning it to @mburke5678 to have a proper look when he is in for a follow up.

@vikram-redhat
Copy link
Contributor

@mburke5678 note that @tnozicka has already started the CP process by using the robot. If it fails, you will need to resolve and fix on command line. If it succeeds, remember to merge the CP.

@tnozicka
Copy link
Contributor Author

@vikram-redhat thanks for the quick reply!

Does this apply to dedicated and online as well?

Well, it kinda does apply to online but only for it's admins since users can't create daemonsets.

@tnozicka please squash commits as

I don't think squashing unrelated commits is a good idea as you will make cherry-picking or reverting harder, but I can do that if you want me to.

@tnozicka tnozicka force-pushed the daemonsets-disable-default-node-selector branch from 66d965d to 160befe Compare March 15, 2018 13:14
@@ -19,8 +19,36 @@ A daemonset can be used to run replicas of a pod on specific or all nodes in an
Use daemonsets to create shared storage, run a logging pod on every node in
your cluster, or deploy a monitoring agent on every node.

For security reasons and by their nature creating DaemonSets is restricted to cluster administrators.

Copy link
Contributor

@mburke5678 mburke5678 Mar 15, 2018

Choose a reason for hiding this comment

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

@tnozicka Do we need the and by their nature?
For security reasons, only cluster administrators can create daemonsets.

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'll rephrase

[IMPORTANT]
====
Before you start using daemonset you need to make sure to disable project default node selector in your namespace.

Copy link
Contributor

@mburke5678 mburke5678 Mar 15, 2018

Choose a reason for hiding this comment

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

Before you start using daemonsets ensure that you disable the default project-wide xref:../admin_guide/managing_projects.adoc#using-node-selectors[node selector] in your namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

s/daemonset/DaemonSets

I'd prefer it to be this way but the rest of the doc uses all lowercase.

Copy link
Contributor

Choose a reason for hiding this comment

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

@tnozicka I agree. The term is used both ways throughout the full docs set. But, we should be consistent in this topic at least.

Copy link
Contributor

@gaurav-nelson gaurav-nelson Mar 15, 2018

Choose a reason for hiding this comment

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

maybe we can get rid of you need to make sure so the sentence becomes Before you start using daemonsets, disable the default project-wide... as per @mburke5678 's comment.

----

xref:../admin_guide/managing_projects.adoc#using-node-selectors[Learn more about node selectors.]

Copy link
Contributor

Choose a reason for hiding this comment

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

If you use the node selector link above, don't need it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you are pointing out those commands to disable it there is no such patch in the link. There is one for setting the selector, not disabling it.


xref:../admin_guide/managing_projects.adoc#using-node-selectors[Learn more about node selectors.]

Daemonset scheduling is incompatible with project default node selector. Nor you usually want the default node selector
Copy link
Contributor

Choose a reason for hiding this comment

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

Daemonset

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lowercase to honor rest of the doc, plus D in the start of a sentence

@mburke5678
Copy link
Contributor

@tnozicka A couple small comments. Let me know when you are ready and we can merge.

@enj
Copy link

enj commented Mar 15, 2018

@tnozicka we probably need to link between this and #8126

@tnozicka tnozicka force-pushed the daemonsets-disable-default-node-selector branch from 160befe to 656965e Compare March 15, 2018 19:50
@tnozicka
Copy link
Contributor Author

updated as @enj sugested

-For security reasons and by their nature creating DaemonSets is restricted to cluster administrators.
+For security reasons, only cluster administrators can create daemonsets.
+(xref:../admin_guide/manage_rbac.adoc#admin-guide-granting-users-daemonset-permissions[Granting Users Daemonset Permissions.])

====
Before you start using daemonset you need to make sure to disable project default node selector in your namespace.

If you are creating a new project make sure to overwrite the default node selector using
Copy link
Contributor

Choose a reason for hiding this comment

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

As with previous case, maybe If you are creating a new project, overwrite the...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

`oc adm new-project --node-selector=""`.

To disable the default node selector on existing project set namespace annotation
`openshift.io/node-selector` to empty string:
Copy link
Contributor

Choose a reason for hiding this comment

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

s/to empty string/to an empty string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@vikram-redhat
Copy link
Contributor

I don't think squashing unrelated commits is a good idea as you will make cherry-picking or reverting harder, but I can do that if you want me to.

Yes please.

@vikram-redhat
Copy link
Contributor

@geliu2016 would you be the right person to review this from the QE side?

For more information on daemonsets, see the link:http://kubernetes.io/docs/admin/daemons/[Kubernetes documentation].

[IMPORTANT]
Copy link
Contributor

@gaurav-nelson gaurav-nelson Mar 16, 2018

Choose a reason for hiding this comment

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

We can reword it like this:

  • shows what goes wrong first
  • and then how to deal with it.
[IMPORTANT]
====
Daemonset scheduling is incompatible with project's default node selector. If
you fail to disable it, the daemonset gets restricted by merging with the
default node selector. This results in frequent pod recreates on the nodes that
got unselected by the merged node selector, which in turn puts unwanted load on
the cluster.

Therefore, 

* Before you start using daemonsets, disable the default project-wide xref:../admin_guide/managing_projects.adoc#using-node-selectors[node selector]
in your namespace, by setting the namespace
annotation `openshift.io/node-selector` to an empty string:
+
----
# oc patch namespace myproject -p \
    '{"metadata": {"annotations": {"openshift.io/node-selector": ""}}}'
----
* If you are creating a new project, overwrite the default node selector using
`oc adm new-project --node-selector=""`.
====

Choose a reason for hiding this comment

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

@vikram-redhat LGTM, thx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thx

@vikram-redhat
Copy link
Contributor

@mburke5678 - we have QE approval as well. Not sure if it requires peer review. Commits need squashing before merging.

@tnozicka tnozicka force-pushed the daemonsets-disable-default-node-selector branch from 656965e to 97308db Compare March 19, 2018 14:13
@tnozicka tnozicka force-pushed the daemonsets-disable-default-node-selector branch from 97308db to 1a7b10c Compare March 19, 2018 14:16
@tnozicka
Copy link
Contributor Author

comments addressed; commits squasched per request

@openshift-cherrypick-robot

@tnozicka: new pull request created: #8197

In response to this:

/cherrypick enterprise-3.9

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.

@tnozicka tnozicka deleted the daemonsets-disable-default-node-selector branch March 19, 2018 16:37
@mburke5678
Copy link
Contributor

mburke5678 commented Apr 10, 2018

@tnozicka @geliu2016
Should this go into 3.7 also? Or any other OpenShift versions?
Please see #8674

@enj
Copy link

enj commented May 4, 2018

@tnozicka please work with @kalexand-rh to get these docs updated to v3.9.26-1.

https://bugzilla.redhat.com/show_bug.cgi?id=1536304#c19

Per David Eads in https://bugzilla.redhat.com/show_bug.cgi?id=1555363#c5:

> https://github.com/openshift/ose/pull/1205 merged, so the controller doesn't
> create pods it knows will be rejected.  "fixing" the default role to
> disallow the creation of a daemonset was a bug.

The change is merged as of v3.9.26-1

This readds the deamonset permission as it is safe for normal users to have.  Thus this is the expected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/dedicated branch/enterprise-3.9 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