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

Improve docs for NamespaceDefaultLabelName #27377

Conversation

sftim
Copy link
Contributor

@sftim sftim commented Apr 1, 2021

Tweak the documentation for namespaces and labels in light of the new NamespaceDefaultLabelName behavior.

Previews:

/cc rikatz
@jayunit100 FYI - you reviewed the original PR.

Follows on from PR #26995

/milestone 1.21

@sftim sftim requested a review from rikatz April 1, 2021 19:15
@k8s-ci-robot k8s-ci-robot added this to the 1.21 milestone Apr 1, 2021
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 1, 2021
@k8sio-netlify-preview-bot
Copy link
Collaborator

k8sio-netlify-preview-bot commented Apr 1, 2021

Deploy preview for kubernetes-io-vnext-staging processing.

Building with commit 0bfff0b

https://app.netlify.com/sites/kubernetes-io-vnext-staging/deploys/6066308ef0ffad000768f3f6

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. language/en Issues or PRs related to English language sig/docs Categorizes an issue or PR as relevant to SIG Docs. labels Apr 1, 2021
Comment on lines 40 to 42
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled,
the Kubernetes API server defaults newly-added namespaces to have this label set to the
name of the namespace.
Copy link
Contributor Author

@sftim sftim Apr 1, 2021

Choose a reason for hiding this comment

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

If I'm understanding correctly, an attacker with access to write labels to namespaces could cannot overwrite the default label provided the feature gate remains enabled. Have I got that right?

(Also, I'm not sure what the behavior is for clusters upgraded from earlier versions - do existing namespaces get this label as well)?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, they do :) The correct statement here is that all namespaces (even the old one) get this new label, and it's rewritten.

Actually the label is not persisted as far as I can remember by my tests, but it's still mutated from the original request by the APIServer.

Discussion here: kubernetes/kubernetes#96968 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make clear here, I would change this to
"the Kubernetes API server defaults all namespaces to have this label set to the name of the namespace, even existing namespaces"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It sounds like it's a bit stronger than “defaults”, it's enforced and unchangeable. I'll write that - but I'm keen to get this reviewed for technical accuracy!

@sftim
Copy link
Contributor Author

sftim commented Apr 1, 2021

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Apr 1, 2021
@sftim
Copy link
Contributor Author

sftim commented Apr 1, 2021

Relevant to kubernetes/enhancements#2161

@sftim
Copy link
Contributor Author

sftim commented Apr 1, 2021

The follow-up commit is to match the style guide recommendation to avoid statements about the future in docs.

Statements about the future in blog posts, KEPs, etc are fine, of course.


## What you can't do with network policies (at least, not yet)

As of Kubernetes 1.20, the following functionality does not exist in the NetworkPolicy API, but you might be able to implement workarounds using Operating System components (such as SELinux, OpenVSwitch, IPTables, and so on) or Layer 7 technologies (Ingress controllers, Service Mesh implementations) or admission controllers. In case you are new to network security in Kubernetes, its worth noting that the following User Stories cannot (yet) be implemented using the NetworkPolicy API. Some (but not all) of these user stories are actively being discussed for future releases of the NetworkPolicy API.
As of Kubernetes {{< skew latestVersion >}}, the following functionality does not exist in the NetworkPolicy API, but you might be able to implement workarounds using Operating System components (such as SELinux, OpenVSwitch, IPTables, and so on) or Layer 7 technologies (Ingress controllers, Service Mesh implementations) or admission controllers. In case you are new to network security in Kubernetes, its worth noting that the following User Stories cannot (yet) be implemented using the NetworkPolicy API.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Open vSwitch (but it was wrong previously so 🤷‍♂️ )

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 might log that as a good-first-issue against master, post release.

@sftim sftim force-pushed the 20210401_namespace_default_label_name_tweaks branch from 4b2ef7f to 151a9de Compare April 1, 2021 19:36
@sftim sftim force-pushed the 20210401_namespace_default_label_name_tweaks branch from 151a9de to 0bfff0b Compare April 1, 2021 20:43
@sftim
Copy link
Contributor Author

sftim commented Apr 3, 2021

@rikatz should I make more changes here?

@reylejano
Copy link
Member

/assign

@rikatz
Copy link
Contributor

rikatz commented Apr 5, 2021

Hey folks sorry. Notification got missed here

@sftim @reylejano I will review this in 15 minutes here so this can ship with the release :)

@rikatz
Copy link
Contributor

rikatz commented Apr 5, 2021

/lgtm

Thanks for improving this doc @sftim

@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 7b18d04918810114d00875ef2970eac6e94fa3cd

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 5, 2021
@reylejano
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: reylejano, rikatz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 5, 2021
@k8s-ci-robot k8s-ci-robot merged commit dfaf833 into kubernetes:dev-1.21 Apr 5, 2021
@sftim sftim deleted the 20210401_namespace_default_label_name_tweaks branch June 9, 2021 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/en Issues or PRs related to English language lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/docs Categorizes an issue or PR as relevant to SIG Docs. 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.

None yet

5 participants