From 9921ae8d93f16a387bd43bcdf68a02329d8ca019 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 16 Apr 2024 21:07:13 +0000 Subject: [PATCH 1/5] backport of commit 6982b65ec569b71bb987240ad984a76a7e4da272 --- .../connect-inject/webhook/consul_dataplane_sidecar.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go b/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go index e8f471fc9f..c2ec239687 100644 --- a/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go +++ b/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go @@ -138,6 +138,12 @@ func (w *MeshWebhook) consulDataplaneSidecar(namespace corev1.Namespace, pod cor FieldRef: &corev1.ObjectFieldSelector{FieldPath: "metadata.uid"}, }, }, + { + Name: "HOST_IP", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.hostIP"}, + }, + }, { Name: "DP_CREDENTIAL_LOGIN_META", Value: "pod=$(POD_NAMESPACE)/$(POD_NAME)", From 02254f104ba0f7a20eed7326f9f6e59d8ebc4c6f Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 16 Apr 2024 21:10:13 +0000 Subject: [PATCH 2/5] backport of commit 63df1186f352575202f5b38438e7b8b0b4504936 --- .../webhook/consul_dataplane_sidecar.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go b/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go index c2ec239687..50f23dc472 100644 --- a/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go +++ b/control-plane/connect-inject/webhook/consul_dataplane_sidecar.go @@ -138,12 +138,6 @@ func (w *MeshWebhook) consulDataplaneSidecar(namespace corev1.Namespace, pod cor FieldRef: &corev1.ObjectFieldSelector{FieldPath: "metadata.uid"}, }, }, - { - Name: "HOST_IP", - ValueFrom: &corev1.EnvVarSource{ - FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.hostIP"}, - }, - }, { Name: "DP_CREDENTIAL_LOGIN_META", Value: "pod=$(POD_NAMESPACE)/$(POD_NAME)", @@ -158,6 +152,12 @@ func (w *MeshWebhook) consulDataplaneSidecar(namespace corev1.Namespace, pod cor Name: "DP_CREDENTIAL_LOGIN_META2", Value: "pod-uid=$(POD_UID)", }, + { + Name: "HOST_IP", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.hostIP"}, + }, + }, }, VolumeMounts: []corev1.VolumeMount{ { From 8f085d4e223625da38282165b874574256544ae1 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 16 Apr 2024 21:11:36 +0000 Subject: [PATCH 3/5] backport of commit fadb91efb9bb8cd1ab08c69f71654ae7c40edfd7 --- .../connect-inject/webhook/consul_dataplane_sidecar_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/control-plane/connect-inject/webhook/consul_dataplane_sidecar_test.go b/control-plane/connect-inject/webhook/consul_dataplane_sidecar_test.go index 8f927c62bd..430b082a5c 100644 --- a/control-plane/connect-inject/webhook/consul_dataplane_sidecar_test.go +++ b/control-plane/connect-inject/webhook/consul_dataplane_sidecar_test.go @@ -219,7 +219,7 @@ func TestHandlerConsulDataplaneSidecar(t *testing.T) { } require.Equal(t, expectedProbe, container.ReadinessProbe) require.Nil(t, container.StartupProbe) - require.Len(t, container.Env, 9) + require.Len(t, container.Env, 10) require.Equal(t, container.Env[0].Name, "TMPDIR") require.Equal(t, container.Env[0].Value, "/consul/connect-inject") require.Equal(t, container.Env[2].Name, "DP_SERVICE_NODE_NAME") @@ -233,6 +233,7 @@ func TestHandlerConsulDataplaneSidecar(t *testing.T) { require.Equal(t, container.Env[7].Value, "pod=$(POD_NAMESPACE)/$(POD_NAME)") require.Equal(t, container.Env[8].Name, "DP_CREDENTIAL_LOGIN_META2") require.Equal(t, container.Env[8].Value, "pod-uid=$(POD_UID)") + require.Equal(t, container.Env[9].Name, "HOST_IP") }) } } From 83b5507dae5bb961523dd55d3d64cb4d7e4ac235 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 16 Apr 2024 21:17:11 +0000 Subject: [PATCH 4/5] backport of commit 6e0710585db5956f7611fd714e4407c70f5685a5 --- control-plane/connect-inject/webhook/3916.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 control-plane/connect-inject/webhook/3916.txt diff --git a/control-plane/connect-inject/webhook/3916.txt b/control-plane/connect-inject/webhook/3916.txt new file mode 100644 index 0000000000..a653f63480 --- /dev/null +++ b/control-plane/connect-inject/webhook/3916.txt @@ -0,0 +1,3 @@ +```release-note:bug +control-plane: add missing `$HOST_IP` environment variable to to consul-dataplane sidecar containers +``` From eb8a962e92441f578bc6da7de942ba6d1f71350f Mon Sep 17 00:00:00 2001 From: woz5999 Date: Tue, 16 Apr 2024 21:20:32 +0000 Subject: [PATCH 5/5] backport of commit 7f7aa406671fa886196a6e30ca9bed9a1fe2324c --- {control-plane/connect-inject/webhook => .changelog}/3916.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {control-plane/connect-inject/webhook => .changelog}/3916.txt (100%) diff --git a/control-plane/connect-inject/webhook/3916.txt b/.changelog/3916.txt similarity index 100% rename from control-plane/connect-inject/webhook/3916.txt rename to .changelog/3916.txt