mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #85747 from tnqn/networkpolicy-validation
Fix NetworkPolicy PolicyTypes validation
This commit is contained in:
commit
0ab1583240
@ -123,10 +123,8 @@ func ValidateNetworkPolicySpec(spec *networking.NetworkPolicySpec, fldPath *fiel
|
|||||||
}
|
}
|
||||||
for i, pType := range spec.PolicyTypes {
|
for i, pType := range spec.PolicyTypes {
|
||||||
policyPath := fldPath.Child("policyTypes").Index(i)
|
policyPath := fldPath.Child("policyTypes").Index(i)
|
||||||
for _, p := range spec.PolicyTypes {
|
if !allowed.Has(string(pType)) {
|
||||||
if !allowed.Has(string(p)) {
|
allErrs = append(allErrs, field.NotSupported(policyPath, pType, []string{string(networking.PolicyTypeIngress), string(networking.PolicyTypeEgress)}))
|
||||||
allErrs = append(allErrs, field.NotSupported(policyPath, pType, []string{string(networking.PolicyTypeIngress), string(networking.PolicyTypeEgress)}))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return allErrs
|
return allErrs
|
||||||
|
Loading…
Reference in New Issue
Block a user