8000 feature(inject): introduce `PatchProducer` abstraction by zaharidichev · Pull Request #14175 · linkerd/linkerd2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feature(inject): introduce PatchProducer abstraction #14175

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zaharidichev
Copy link
Member

This PR introduces the PatchProducer abstraction. This allows to abstract away the creation of proxy injection patches and to potentially layer multiple patches on top of each other.

Signed-off-by: Zahari Dichev zaharidichev@gmail.com

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
@zaharidichev zaharidichev requested a review from a team as a code owner June 25, 2025 07:59
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
8000

// PatchProducer is a function that generates a patch for a given resource configuration
// and OverriddenValues.
type PatchProducer func(conf *ResourceConfig, injectProxy bool, values *OverriddenValues, patchPathPrefix string) ([]byte, error)
Copy link
Member

Choose a reason for hiding this comment

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

If the return type here was JSONPatch instead of []byte, would that save some marshalling/unmarshalling?


// ValueOverrider is used to override the default values that are used in chart rendering based
// on the annotations provided in overrides.
type ValueOverrider func(values *l5dcharts.Values, overrides map[string]string, namedPorts map[string]int32) (*OverriddenValues, error)
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about making the return type here just map[string]interface{}? It simplifies things by getting rid of having both Values and Additional. On the other hand, setting things like PodInboundPorts and ClusterNetworks into an untyped nested map is less ergonomic so I'm not sure if it's better..... what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0