-
Notifications
You must be signed in to change notification settings - Fork 340
feat(helm): limit webhooks only to namespaces with kuma.io/sidecar-injection label #13378
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Lukasz Dziedziak <[email protected]>
…jection label Signed-off-by: Lukasz Dziedziak <[email protected]>
Signed-off-by: Lukasz Dziedziak <[email protected]>
Signed-off-by: Lukasz Dziedziak <[email protected]>
Signed-off-by: Lukasz Dziedziak <[email protected]>
Reviewer Checklist🔍 Each of these sections need to be checked by the reviewer of the PR 🔍:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions for upgrade.md and there is definitely something that got merged badly because one point is in the middle of another
@@ -20,6 +20,28 @@ To simplify the namespace selector logic in webhooks, we now require the `kuma.i | |||
|
|||
Since Kubernetes v1.22, the API server automatically adds the `kubernetes.io/metadata.name` label to all namespaces. As a result, we’ve replaced the use of the custom `kuma.io/system-namespace` label in the secret webhook selector with this standard label. | |||
|
|||
### Namespaces that are part of the Mesh requires `kuma.io/sidecar-injection` label to exist | |||
|
|||
Since version 2.11.x, to improve performance and security, we require that each namespace participating in the Mesh has the `kuma.io/sidecar-injection` label set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since version 2.11.x, to improve performance and security, we require that each namespace participating in the Mesh has the `kuma.io/sidecar-injection` label set. | |
Since version 2.11.x, to improve performance and security, each namespace participating in the Mesh is required to have the `kuma.io/sidecar-injection` label set. |
|
||
Since version 2.11.x, to improve performance and security, we require that each namespace participating in the Mesh has the `kuma.io/sidecar-injection` label set. | ||
|
||
Before upgrading, check if you are running any deployments with the `kuma.io/sidecar-injection: true` or `enabled` label in namespaces that do not have the `kuma.io/sidecar-injection` label set. If so, add `kuma.io/sidecar-injection: false` or `disabled` to those namespaces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I think disabled
to mean false
is discouraged - isn't it? If so, I wouldn't recommend setting it.
Before upgrading, check if you are running any deployments with the `kuma.io/sidecar-injection: true` or `enabled` label in namespaces that do not have the `kuma.io/sidecar-injection` label set. If so, add `kuma.io/sidecar-injection: false` or `disabled` to those namespaces. | |
Before upgrading, check whether any deployments are using the `kuma.io/sidecar-injection: true` or `enabled` label in namespaces that do not have the `kuma.io/sidecar-injection` label set. If so, add `kuma.io/sidecar-injection: false` to those namespaces. |
|
||
Before upgrading, check if you are running any deployments with the `kuma.io/sidecar-injection: true` or `enabled` label in namespaces that do not have the `kuma.io/sidecar-injection` label set. If so, add `kuma.io/sidecar-injection: false` or `disabled` to those namespaces. | ||
|
||
You can use this script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use this script | |
You can use this script to detect such namespaces: |
You can later patch namespaces with the following command: | ||
|
||
```bash | ||
kubectl label namespace NAMESPACE_NAME kuma.io/sidecar-injection=disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a bad merge or something but this point shouldn't be in the middle of another point.
Motivation
Webhooks currently use a very broad namespace selector that only excludes the
kube-system
namespace. To improve both security and performance, we’ve decided to restrict webhooks to only watch namespaces that have thekuma.io/sidecar-injection
label.Implementation information
kuma.io/sidecar-injection
, orkuma-system
(for mesh defaulter/owner reference cases).kuma.io/sidecar-injection
labelNeeds: #13377
Supporting documentation
Fix #13372