banzaicloud / istio-operator

An operator that manages Istio deployments on Kubernetes
Apache License 2.0
535 stars 94 forks source link

IstioControlPlane sidecarInjector additionalEnvVars spec absence #885

Closed vitalii-buchyn-exa closed 1 year ago

vitalii-buchyn-exa commented 1 year ago

Describe the bug Hello community.

This might not be a bug, but rather a question. I'm not able to find how to specify additional environment variables for istio sidecar in IstioControlPlane CR. For example, I need to disable tcp probe rewriting by setting REWRITE_TCP_PROBES variable to false. In older istio-operator Istio CRD there was a sidecarInjector.injectedContainerAdditionalEnvVars spec.

Please advise.

Steps to reproduce the issue: Inspect IstioControlPlane CRD for additional sidecar proxy env vars.

Expected behavior To have analogue for spec.sidecarInjector.injectedContainerAdditionalEnvVars in IstioControlPlane CDR

Additional context istio-operator version v2.16.0 installed by helm chart 2.1.0

Laci21 commented 1 year ago

Hi,

I think something like this should work:

apiVersion: servicemesh.cisco.com/v1alpha1
kind: IstioControlPlane
metadata:
  name: icp-v116x
  namespace: istio-system
spec:
...
  meshConfig:
    defaultConfig:
      proxyMetadata:
        REWRITE_TCP_PROBES: "false"

Source: https://github.com/banzaicloud/istio-operator/blob/release-1.16/internal/assets/manifests/istio-discovery/resources/injection-template.yaml#L329-L332

vitalii-buchyn-exa commented 1 year ago

@Laci21 Hi,

That worked, I can see now a REWRITE_TCP_PROBES: false in istio-proxy envs. Envoy doesn't respect it anyway, but that's another story.

Thank you!

Laci21 commented 1 year ago

Hi,

Good to hear it works. I hope your other problem is resolved soon as well. Closing this one.

vitalii-buchyn-exa commented 1 year ago

for those who interested, wrt REWRITE_TCP_PROBES variable, that was my misunderstanding. it should be specified for istiod, not istio-proxy

so, the config for IstioControlPlane CR should look like:

istiod:
    deployment:
      env:
        - name: REWRITE_TCP_PROBES
          value: "false"