Merge pull request #122126 from liggitt/duplicate-warning

Update duplicate env var warning
This commit is contained in:
Kubernetes Prow Robot 2023-12-19 04:37:27 +01:00 committed by GitHub
commit b5ba7bc4f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -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)

View File

@ -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`,
},
},
{