kumahq / kuma

🐻 The multi-zone service mesh for containers, Kubernetes and VMs. Built with Envoy. CNCF Sandbox Project.
https://kuma.io/install
Apache License 2.0
3.56k stars 328 forks source link

Add a more systematic way to add transparent-proxy config #8324

Open lahabana opened 8 months ago

lahabana commented 8 months ago

Description

At the moment adding transparent proxy config is very cumborsome and error prone.

You have to:

  1. Add to https://github.com/kumahq/kuma/blob/07fcbed400fad5113c3d2140b337bb657a88e091/pkg/transparentproxy/config/config.go#L11-L43

  2. Add to https://github.com/kumahq/kuma/blob/07fcbed400fad5113c3d2140b337bb657a88e091/pkg/transparentproxy/config/config.go#L129-L169

  3. Add to config in kumactl install: https://github.com/kumahq/kuma/blob/07fcbed400fad5113c3d2140b337bb657a88e091/app/kumactl/cmd/install/install_transparent_proxy.go#L20-L51

  4. Add to args: https://github.com/kumahq/kuma/blob/07fcbed400fad5113c3d2140b337bb657a88e091/app/kumactl/cmd/install/install_transparent_proxy.go#L190-L222

  5. Add to annotations for CNI: https://github.com/kumahq/kuma/blob/07fcbed400fad5113c3d2140b337bb657a88e091/app/cni/pkg/cni/annotations.go#L20-L31

  6. Map correctly: https://github.com/kumahq/kuma/blob/07fcbed400fad5113c3d2140b337bb657a88e091/app/cni/pkg/cni/injector_linux.go#L70-L142

  7. Map transparent proxy annotations too: https://github.com/kumahq/kuma/blob/07fcbed400fad5113c3d2140b337bb657a88e091/pkg/transparentproxy/kubernetes/kubernetes.go#L48-L137

No-one can get that right from the first time. Is there a better way to do this? Seems like transparent-proxy already uses pkg/config.Config which enables env var and json config. Should the annotation maybe just: traffic.kuma.io/transparent-proxy-config-json ?

lahabana commented 8 months ago

Is there use cases where we need to set this twice and we need to merge multiple configs?