mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Add remove label command
This commit is contained in:
@@ -64,6 +64,21 @@ func (v *KustValidator) MakeLabelValidator() func(map[string]string) error {
|
||||
}
|
||||
}
|
||||
|
||||
// MakeLabelNameValidator returns a ArrayValidatorFunc using apimachinery.
|
||||
func (v *KustValidator) MakeLabelNameValidator() func([]string) error {
|
||||
return func(x []string) error {
|
||||
errs := field.ErrorList{}
|
||||
fldPath := field.NewPath("field")
|
||||
for _, k := range x {
|
||||
errs = append(errs, v1validation.ValidateLabelName(k, fldPath)...)
|
||||
}
|
||||
if len(errs) > 0 {
|
||||
return errors.New(errs.ToAggregate().Error())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateNamespace validates a string is a valid namespace using apimachinery.
|
||||
func (v *KustValidator) ValidateNamespace(s string) []string {
|
||||
return validation.IsDNS1123Label(s)
|
||||
|
||||
Reference in New Issue
Block a user