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 NamespaceSelector to select namespaces for Initializers #1191

Conversation

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 15, 2017
@caesarxuchao
Copy link
Member

/assign @caesarxuchao

@caesarxuchao
Copy link
Member

@cheftako could you also take a look? This is very similar to the webhook bootstrapping problem.

* Apply initializer to limited namespaces using label selector;

Since most users won't add extra labels for namespaces explicitly when creating new resources, the selector matching should only be applied to
`labels.Set(map[string]string{"namespace": namespace})` instead of widely-used `metadata.Labels`.
Copy link
Member

@liggitt liggitt Oct 16, 2017

Choose a reason for hiding this comment

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

is this proposing matching on an artificial label set, disconnected from the actual namespace labels?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Getnamespace value from attributeRecord when admitting, metadata.Labels is not used/referenced here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dixudx sorry, do not quite catch this, can you please show an example here? How to handle the case if a namespaces do not have labels?

Copy link
Member Author

Choose a reason for hiding this comment

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

@gyliu513 Please refer to findInitializers of PR #53879 for the matching implementation.

And the namespace here is retrieved from admission.Attributes when admitting initializers. So metadata.Labels is not used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, thanks @dixudx

Copy link
Member

Choose a reason for hiding this comment

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

I'll bring this idea up when discussing the bootstrap problem of webhooks. I want to avoid artificial label set if possible.

## Enforce initializers to specific namespaces

Current `InitializerConfiguration` is at the cluster level and all of the to-be-created resources (such as rc and deployments) defined in `Rules`
will be appended with the pending initializers automatically during creating, regardless of the namespace.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/creating/creation

* Apply initializer to limited namespaces using label selector;

Since most users won't add extra labels for namespaces explicitly when creating new resources, the selector matching should only be applied to
`labels.Set(map[string]string{"namespace": namespace})` instead of widely-used `metadata.Labels`.
Copy link
Contributor

Choose a reason for hiding this comment

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

@dixudx sorry, do not quite catch this, can you please show an example here? How to handle the case if a namespaces do not have labels?

@dixudx dixudx force-pushed the add_namespaceSelector_for_initializer branch from 64fad5a to ee12917 Compare October 20, 2017 03:36
Copy link
Contributor

@gyliu513 gyliu513 left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 20, 2017
@gyliu513
Copy link
Contributor

/cc @caesarxuchao for review

@k8s-ci-robot
Copy link
Contributor

@gyliu513: GitHub didn't allow me to request PR reviews from the following users: for, review.

Note that only kubernetes members can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @caesarxuchao for review

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.

@k8s-github-robot
Copy link

Automatic merge from submit-queue.

@k8s-github-robot k8s-github-robot merged commit df08771 into kubernetes:master Oct 20, 2017
@gyliu513
Copy link
Contributor

Do not know why a "lgtm" trigger this merge?

@liggitt
Copy link
Member

liggitt commented Oct 20, 2017

this should not have merged. opened revert in #1243
can reopen for discussion

k8s-github-robot pushed a commit that referenced this pull request Oct 20, 2017
Automatic merge from submit-queue.

Revert initializer namespace selector change

#1191 was accidentally merged
@caesarxuchao
Copy link
Member

Please take a look at a similar API we proposed for the webhook configuration. We'll keep the webhook configuration aligned with the initializer configuration.

@dixudx dixudx deleted the add_namespaceSelector_for_initializer branch October 26, 2017 01:56
k8s-github-robot pushed a commit that referenced this pull request Oct 30, 2017
Automatic merge from submit-queue.

Add a design doc for admission webhook bootstrapping

Originally distributed as a [google doc](https://docs.google.com/document/d/1pw6FyobY3pVxfWYwmAFuF5WJpvjfq-M3Ciz996kblVc/edit?ts=59f1d824#).

The idea is from an Oct. 23 meeting with lavalamp, cheftako, deads2k, smarterclayton, liggitt. It also draws inspiration from #1191.

cc @kubernetes/sig-api-machinery-api-reviews  @lavalamp @deads2k
MadhavJivrajani pushed a commit to MadhavJivrajani/community that referenced this pull request Nov 30, 2021
…for_initializer

Automatic merge from submit-queue.

add NamespaceSelector to select namespaces for Initializers

issue kubernetes/kubernetes#51290, kubernetes/kubernetes#53859
xref PR kubernetes/kubernetes#53879

/cc @ahmetb @gyliu513 @liggitt @smarterclayton @caesarxuchao
MadhavJivrajani pushed a commit to MadhavJivrajani/community that referenced this pull request Nov 30, 2021
…r-webhook

Automatic merge from submit-queue.

Add a design doc for admission webhook bootstrapping

Originally distributed as a [google doc](https://docs.google.com/document/d/1pw6FyobY3pVxfWYwmAFuF5WJpvjfq-M3Ciz996kblVc/edit?ts=59f1d824#).

The idea is from an Oct. 23 meeting with lavalamp, cheftako, deads2k, smarterclayton, liggitt. It also draws inspiration from kubernetes#1191.

cc @kubernetes/sig-api-machinery-api-reviews  @lavalamp @deads2k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants