Convert CLI inject proxy options to annotations#2547
Conversation
| overrideAnnotations[k8s.ProxyOutboundPortAnnotation] = parsePort(configs.Proxy.OutboundPort) | ||
| } | ||
|
|
||
| if options.dockerRegistry != "" { |
There was a problem hiding this comment.
We still need to check for image name even if the registry option isn't provided.
alpeb
left a comment
There was a problem hiding this comment.
Code looks good to me. Reusing resourceTransformerInject is neat 🎈
I did find a use case that might need to be addressed.
Say we have a POD annotated with config.linkerd.io/proxy-memory-limit: 10Mi
Then we inject it with inject --proxy-memory-limit 20Mi.
The annotation will get updated correctly, but the memory limit in the sidecar will get set to the old 10Mi, because getOverride() only looks at the annotations from parsing the payload, disregarding the map of overriding annotations that cli/cmd/inject.go created.
First thing that comes to mind to address this would be to augment ResourceConfig to include that map (that cli/cmd/inject.go would pass when calling NewResourceConfig), for getOverride to take into account.
| transformer := &resourceTransformerInject{ | ||
| configs: configs, | ||
| overrideAnnotations: overrideAnnotations, | ||
| } |
There was a problem hiding this comment.
How about defining this earlier, and have overridedConfigs() receive it as its sole argument?
There was a problem hiding this comment.
I prefer to keep the arguments of overrideConfigs() to config data. A function that reads overrideConfigs(someKindOfTransformer) sounds like we are overriding the transformer's config, which it isn't because the transformer has no configs of its own, and it's more a YAML-parsing receiver, than a config receiver.
@alpeb My thought is that the payload that is parsed by |
463085a to
804225c
Compare
|
Integration test results for 463085a: success 🎉 |
804225c to
5822eea
Compare
|
Integration test results for 804225c: success 🎉 |
|
Integration test results for 5822eea: success 🎉 |
57b7781 to
49e67c0
Compare
|
Integration test results for 0b7c992: success 🎉 |
|
Integration test results for 57b7781: fail 👎 |
|
Integration test results for 49e67c0: success 🎉 |
49e67c0 to
4e80636
Compare
|
Integration test results for 4e80636: success 🎉 |
8e7a7d2 to
ed35d24
Compare
|
Integration test results for afeec47: success 🎉 |
|
Integration test results for 8e7a7d2: fail 👎 |
|
Integration test results for ed35d24: success 🎉 |
Signed-off-by: Ivan Sim <[email protected]>
The override logic depends on this option to assign different profile suffix. Signed-off-by: Ivan Sim <[email protected]>
… empty Signed-off-by: Ivan Sim <[email protected]>
…atch This ensures that any configs provided via the CLI options are persisted as annotations before the configs override. Signed-off-by: Ivan Sim <[email protected]>
ed35d24 to
ec01a9e
Compare
|
Integration test results for ec01a9e: fail 👎 |
Signed-off-by: Ivan Sim <[email protected]>
|
Integration test results for 4b09829: success 🎉 |
Signed-off-by: Ivan Sim <[email protected]>
Signed-off-by: Ivan Sim <[email protected]>
klingerf
left a comment
There was a problem hiding this comment.
⭐️ Thanks for making those updates. Looks good to me.
| } | ||
|
|
||
| // AppendPodAnnotations appends the given annotations to the pod spec in conf | ||
| func (conf *ResourceConfig) AppendPodAnnotations(annotations map[string]string) { |
There was a problem hiding this comment.
TIOLI I'd prefer to call this AddPodAnnotations, since I don't typically think of appending to a map.
|
Integration test results for 4c375e2: fail 👎 |
The PR introduces code to convert CLI inject proxy options into config annotations. The annotations ensure that these configs are persisted in subsequent resource updates.
Fixes #2447
Signed-off-by: Ivan Sim [email protected]