-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Change injector overriding logic to be more generic #12405
Merged
Merged
Conversation
This file contains 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
The proxy-injector package has a `ResourceConfig` type that is responsible for parsing resources, applying overrides, and serialising a series of configuration values to a Kubernetes patch. The functionality is very concrete in its assumption; it always relies on a pod spec and it mutates inner state when deciding on which overrides to apply. This is not a flexible way to handle injection and configuration overriding for other types of resources. We change this by turning methods previously defined on `ResourceConfig` into free-standing functions. These functions can be applied for any type of resources in order to compute a set of configuration values based on annotation overrides. Through the change, the functions can be used to compute static configuration for non-Pod types or can be used in tests. Some of the functionality relies on concrete types, e.g. ContainerPorts. To allow the free-standing functions to be generic, we introduce an interface to abstract away the details of how the configuration value is produced. Signed-off-by: Matei David <matei@buoyant.io>
adleong
reviewed
Apr 8, 2024
Signed-off-by: Matei David <matei@buoyant.io>
adleong
approved these changes
Apr 9, 2024
Tested in a k3d cluster to ensure everything still works as expected, particularly around opaque ports, inbound ports and namespace overrides. An example ns and nginx workload:
We expect to see:
|
the-wondersmith
pushed a commit
to the-wondersmith/linkerd2
that referenced
this pull request
Apr 24, 2024
The proxy-injector package has a `ResourceConfig` type that is responsible for parsing resources, applying overrides, and serialising a series of configuration values to a Kubernetes patch. The functionality is very concrete in its assumption; it always relies on a pod spec and it mutates inner state when deciding on which overrides to apply. This is not a flexible way to handle injection and configuration overriding for other types of resources. We change this by turning methods previously defined on `ResourceConfig` into free-standing functions. These functions can be applied for any type of resources in order to compute a set of configuration values based on annotation overrides. Through the change, the functions can be used to compute static configuration for non-Pod types or can be used in tests. Signed-off-by: Matei David <matei@buoyant.io> Signed-off-by: Mark S <the@wondersmith.dev>
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.
The proxy-injector package has a
ResourceConfig
type that is responsible for parsing resources, applying overrides, and serialising a series of configuration values to a Kubernetes patch. The functionality is very concrete in its assumption; it always relies on a pod spec and it mutates inner state when deciding on which overrides to apply.This is not a flexible way to handle injection and configuration overriding for other types of resources. We change this by turning methods previously defined on
ResourceConfig
into free-standing functions. These functions can be applied for any type of resources in order to compute a set of configuration values based on annotation overrides. Through the change, the functions can be used to compute static configuration for non-Pod types or can be used in tests.Some of the functionality relies on concrete types, e.g. ContainerPorts. To allow the free-standing functions to be generic, we introduce an interface to abstract away the details of how the configuration value is produced.