From e82d4f8e559e1ddf285c6cb82ab2d71166321e80 Mon Sep 17 00:00:00 2001 From: Alex Pana <8968914+acpana@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:25:42 +0000 Subject: [PATCH] review: feedback Signed-off-by: Alex Pana <8968914+acpana@users.noreply.github.com> --- pkg/kubelet/container/helpers.go | 3 ++- pkg/kubelet/container/helpers_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/container/helpers.go b/pkg/kubelet/container/helpers.go index 9e6780310e6..28540b14ce4 100644 --- a/pkg/kubelet/container/helpers.go +++ b/pkg/kubelet/container/helpers.go @@ -151,7 +151,8 @@ func v1EnvVarsToMap(envs []v1.EnvVar) map[string]string { } // ExpandContainerCommandOnlyStatic substitutes only static environment variable values from the -// container environment definitions. This does *not* include valueFrom substitutions. +// container environment definitions. This does *not* include valueFrom substitutions. Note any unbound +// variables will not be expanded or empty substituted, i.e. "echo $(MISSING) => echo $(MISSING)". // TODO: callers should use ExpandContainerCommandAndArgs with a fully resolved list of environment. func ExpandContainerCommandOnlyStatic(containerCommand []string, envs []v1.EnvVar) (command []string) { mapping := expansion.MappingFuncFor(v1EnvVarsToMap(envs)) diff --git a/pkg/kubelet/container/helpers_test.go b/pkg/kubelet/container/helpers_test.go index c668515b09a..01c85b06073 100644 --- a/pkg/kubelet/container/helpers_test.go +++ b/pkg/kubelet/container/helpers_test.go @@ -1159,7 +1159,7 @@ func TestExpandContainerCommandOnlyStatic(t *testing.T) { envs: []v1.EnvVar{ {Name: "FOO", Value: "foo-value"}, }, - expected: []string{"echo", "foo-value", "$(MISSING)"}, // should this behave as "echo", "foo-value", "" ? + expected: []string{"echo", "foo-value", "$(MISSING)"}, }, }