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

Backport of Add HOST_IP environment variable to consul_dataplane_sidecar.go into release/1.1.x #4282

Open
wants to merge 5 commits into
base: release/1.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3916.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
control-plane: add missing `$HOST_IP` environment variable to to consul-dataplane sidecar containers
```
Original file line number Diff line number Diff line change
Expand Up @@ -152,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{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
})
}
}
Expand Down
Loading