Skip to content

Commit ee9f436

Browse files
author
OpenShift Bot
authored
Merge pull request #13842 from php-coder/improve_scc_provider_reporting
Merged by openshift-bot
2 parents 478696f + 0b87377 commit ee9f436

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/security/scc/matcher.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func AssignSecurityContext(provider kscc.SecurityContextConstraintsProvider, pod
7777

7878
psc, generatedAnnotations, err := provider.CreatePodSecurityContext(pod)
7979
if err != nil {
80-
errs = append(errs, field.Invalid(field.NewPath("spec", "securityContext"), pod.Spec.SecurityContext, err.Error()))
80+
errs = append(errs, field.Invalid(fldPath.Child("spec", "securityContext"), pod.Spec.SecurityContext, err.Error()))
8181
}
8282

8383
// save the original PSC and validate the generated PSC. Leave the generated PSC
@@ -88,11 +88,11 @@ func AssignSecurityContext(provider kscc.SecurityContextConstraintsProvider, pod
8888

8989
pod.Spec.SecurityContext = psc
9090
pod.Annotations = generatedAnnotations
91-
errs = append(errs, provider.ValidatePodSecurityContext(pod, field.NewPath("spec", "securityContext"))...)
91+
errs = append(errs, provider.ValidatePodSecurityContext(pod, fldPath.Child("spec", "securityContext"))...)
9292

9393
// Note: this is not changing the original container, we will set container SCs later so long
9494
// as all containers validated under the same SCC.
95-
containerPath := field.NewPath("spec", "initContainers")
95+
containerPath := fldPath.Child("spec", "initContainers")
9696
for i, containerCopy := range pod.Spec.InitContainers {
9797
csc, resolutionErrs := resolveContainerSecurityContext(provider, pod, &containerCopy, containerPath.Index(i))
9898
errs = append(errs, resolutionErrs...)
@@ -106,7 +106,7 @@ func AssignSecurityContext(provider kscc.SecurityContextConstraintsProvider, pod
106106

107107
// Note: this is not changing the original container, we will set container SCs later so long
108108
// as all containers validated under the same SCC.
109-
containerPath = field.NewPath("spec", "containers")
109+
containerPath = fldPath.Child("spec", "containers")
110110
for i, containerCopy := range pod.Spec.Containers {
111111
csc, resolutionErrs := resolveContainerSecurityContext(provider, pod, &containerCopy, containerPath.Index(i))
112112
errs = append(errs, resolutionErrs...)

0 commit comments

Comments
 (0)