Repository navigation
fix(inject): inherit beta native sidecar annotation from namespace - #15734
Open
spicysharkco wants to merge 1 commit into
Open
spicysharkco wants to merge 1 commit into
spicysharkco wants to merge 1 commit into
Conversation
Problem A namespace annotated with `config.beta.linkerd.io/proxy-enable-native-sidecar: "false"` no longer turns native sidecars off: new pods in it get one anyway, because native sidecars are now the default. The same annotation on the pod works. The annotation is deprecated, not removed ([doc](https://github.com/linkerd/linkerd2/blob/b60b8e74786e5c6d47d211375d223446f9ae1857/cli/cmd/doc.go#L287-L290), [override code](https://github.com/linkerd/linkerd2/blob/b60b8e74786e5c6d47d211375d223446f9ae1857/pkg/inject/inject.go#L429-L445)), and the deprecated alpha key is still inherited. linkerd#15267 replaced the beta key in `ProxyAnnotations` with the GA key, so [the beta key is in neither list](https://github.com/linkerd/linkerd2/blob/b60b8e74786e5c6d47d211375d223446f9ae1857/pkg/inject/inject.go#L85-L90) that [`AppendNamespaceAnnotations`](https://github.com/linkerd/linkerd2/blob/b60b8e74786e5c6d47d211375d223446f9ae1857/pkg/inject/inject.go#L177-L189) copies. Solution Add the beta key to `ProxyAlphaConfigAnnotations`, next to the alpha key. It cannot go in `ProxyAnnotations`: the proxy injector builds metric labels from that list, the beta and GA keys give the same label, and the duplicate panics the injector at start-up. Validation `go test -count=3 -run TestGetOverriddenValues ./pkg/inject/`: the new beta row fails without the change (`Proxy.NativeSidecar: true != false`) and passes with it; the new alpha row passes both ways. The `pkg/inject` and `controller/proxy-injector` packages pass. Signed-off-by: Leo King <321699413+spicysharkco@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A namespace annotated with
config.beta.linkerd.io/proxy-enable-native-sidecar: "false"no longer turns native sidecars off: new pods in it get one anyway, because native sidecars are now the default. The same annotation on the pod works. The annotation is deprecated, not removed (doc, override code), and the deprecated alpha key is still inherited.#15267 replaced the beta key in
ProxyAnnotationswith the GA key, so the beta key is in neither list thatAppendNamespaceAnnotationscopies.Solution
Add the beta key to
ProxyAlphaConfigAnnotations, next to the alpha key. It cannot go inProxyAnnotations: the proxy injector builds metric labels from that list, the beta and GA keys give the same label, and the duplicate panics the injector at start-up.Validation
go test -count=3 -run TestGetOverriddenValues ./pkg/inject/: the new beta row fails without the change (Proxy.NativeSidecar: true != false) and passes with it; the new alpha row passes both ways. Thepkg/injectandcontroller/proxy-injectorpackages pass.Fixes #15733