Skip to content
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

fix(nd-common): support istio-proxy native sidecar (initContainer) preStop override #361

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

Conversation

schahal
Copy link
Contributor

@schahal schahal commented Feb 11, 2025

Why

Context

Kubernetes native sidecar containers run as InitContainers

Istio allows us to run the proxy as a native sidecar.

What This Change Does

Allows preStop commands to be set on initContainers as well.

But Why Is This Change Needed?

Ideally, the default /drain on native sidecars should suffice.

However, an open bug (istio/istio#51855) is forcing us to potentially bring our default preStop commands on the native sidecars as well.

Diffs

Diff between default values and setting istio.nativeSidecarsEnabled: true

When to use: This is the proposed ideal setting when we want a workaround to istio/istio#51855

@@ -234,7 +234,7 @@
         traffic.sidecar.istio.io/excludeInboundPorts: "9090"
         proxy.istio.io/overrides: >-
           {
-            "containers": [
+            "initContainers": [
               {
                 "name": "istio-proxy",
                 "lifecycle": {

Diff between default values and setting istio.nativeSidecarsEnabled: true and preStopDefaultEnabled: false

When to use: This is the proposed ideal setting when istio/istio#51855 is fixed and we want to default to upstream/Istio's drain mechanism... i.e., no override

@@ -232,25 +232,6 @@
         checksum/secrets: c8fa9ff9cda8a0e2d93fdc712c82373c94a1a5f1a48fc6d8db9f978047d937b6
         proxy.istio.io/config: '<redacted>'
         traffic.sidecar.istio.io/excludeInboundPorts: "9090"
-        proxy.istio.io/overrides: >-
-          {
-            "containers": [
-              {
-                "name": "istio-proxy",
-                "lifecycle": {
-                  "preStop": {
-                    "exec": {
-                      "command": [
-                        "/bin/sh",
-                        "-c",
-                        "while [ $(netstat -plunt | grep tcp | egrep -v 'envoy|pilot-agent' | wc -l | xargs) -ne 0 ]; do sleep 1; done"
-                      ]
-                    }
-                  }
-                }
-              }
-            ]
-          }
         ad.datadoghq.com/simple-app.check_names: '["prometheus"]'
         ad.datadoghq.com/simple-app.init_configs: '[{}]'
         ad.datadoghq.com/simple-app.instances: |-

@schahal schahal requested a review from a team as a code owner February 11, 2025 01:51
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.

1 participant