From b6e34187ca4d0b5e0f222390f991d574409d47ee Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Thu, 30 Nov 2023 10:38:15 -0500 Subject: [PATCH] Update duplicate env var warning --- pkg/api/pod/warnings.go | 2 +- pkg/api/pod/warnings_test.go | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/api/pod/warnings.go b/pkg/api/pod/warnings.go index 2d472dcf7d754..30dbf352a8b12 100644 --- a/pkg/api/pod/warnings.go +++ b/pkg/api/pod/warnings.go @@ -257,7 +257,7 @@ func warningsForPodSpecAndMeta(fieldPath *field.Path, podSpec *api.PodSpec, meta bad = true } if bad { - warnings = append(warnings, fmt.Sprintf("%s: hides previous definition of %q", p.Child("env").Index(i), item.Name)) + warnings = append(warnings, fmt.Sprintf("%s: hides previous definition of %q, which may be dropped when using apply", p.Child("env").Index(i), item.Name)) } } else { items.Insert(item.Name) diff --git a/pkg/api/pod/warnings_test.go b/pkg/api/pod/warnings_test.go index d94fc40f745d0..9922c0da175ac 100644 --- a/pkg/api/pod/warnings_test.go +++ b/pkg/api/pod/warnings_test.go @@ -296,16 +296,16 @@ func TestWarnings(t *testing.T) { }}}, }}, expected: []string{ - `spec.initContainers[0].env[1]: hides previous definition of "a"`, - `spec.initContainers[0].env[2]: hides previous definition of "a"`, - `spec.initContainers[0].env[3]: hides previous definition of "a"`, - `spec.initContainers[0].env[4]: hides previous definition of "a"`, - `spec.initContainers[0].env[5]: hides previous definition of "a"`, - `spec.containers[0].env[1]: hides previous definition of "b"`, - `spec.containers[0].env[2]: hides previous definition of "b"`, - `spec.containers[0].env[3]: hides previous definition of "b"`, - `spec.containers[0].env[4]: hides previous definition of "b"`, - `spec.containers[0].env[5]: hides previous definition of "b"`, + `spec.initContainers[0].env[1]: hides previous definition of "a", which may be dropped when using apply`, + `spec.initContainers[0].env[2]: hides previous definition of "a", which may be dropped when using apply`, + `spec.initContainers[0].env[3]: hides previous definition of "a", which may be dropped when using apply`, + `spec.initContainers[0].env[4]: hides previous definition of "a", which may be dropped when using apply`, + `spec.initContainers[0].env[5]: hides previous definition of "a", which may be dropped when using apply`, + `spec.containers[0].env[1]: hides previous definition of "b", which may be dropped when using apply`, + `spec.containers[0].env[2]: hides previous definition of "b", which may be dropped when using apply`, + `spec.containers[0].env[3]: hides previous definition of "b", which may be dropped when using apply`, + `spec.containers[0].env[4]: hides previous definition of "b", which may be dropped when using apply`, + `spec.containers[0].env[5]: hides previous definition of "b", which may be dropped when using apply`, }, }, {