Documentation
¶
Index ¶
- Constants
- Variables
- func NameIsDNS1035Label(name string, prefix bool) []string
- func NameIsDNSLabel(name string, prefix bool) []string
- func NameIsDNSSubdomain(name string, prefix bool) []string
- func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList
- func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList
- func ValidateObjectMeta(objMeta *metav1.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc, ...) field.ErrorList
- func ValidateObjectMetaAccessor(meta metav1.Object, requiresNamespace bool, nameFn ValidateNameFunc, ...) field.ErrorList
- type ValidateNameFunc
Constants ¶
const IsNegativeErrorMsg string = `must be greater than or equal to 0`
Variables ¶
var ValidateClusterName = NameIsDNS1035Label
ValidateClusterName can be used to check whether the given cluster name is valid.
var ValidateNamespaceName = NameIsDNSLabel
ValidateNamespaceName can be used to check whether the given namespace name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.
var ValidateServiceAccountName = NameIsDNSSubdomain
ValidateServiceAccountName can be used to check whether the given service account name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.
Functions ¶
func NameIsDNS1035Label ¶
NameIsDNS1035Label is a ValidateNameFunc for names that must be a DNS 952 label.
func NameIsDNSLabel ¶
NameIsDNSLabel is a ValidateNameFunc for names that must be a DNS 1123 label.
func NameIsDNSSubdomain ¶
NameIsDNSSubdomain is a ValidateNameFunc for names that must be a DNS subdomain.
func ValidateAnnotations ¶
ValidateAnnotations validates that a set of annotations are correctly defined.
func ValidateNonnegativeField ¶
Validates that given value is not negative.
func ValidateObjectMeta ¶
func ValidateObjectMeta(objMeta *metav1.ObjectMeta, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList
ValidateObjectMeta validates an object's metadata on creation. It expects that name generation has already been performed. It doesn't return an error for rootscoped resources with namespace, because namespace should already be cleared before.
func ValidateObjectMetaAccessor ¶
func ValidateObjectMetaAccessor(meta metav1.Object, requiresNamespace bool, nameFn ValidateNameFunc, fldPath *field.Path) field.ErrorList
ValidateObjectMeta validates an object's metadata on creation. It expects that name generation has already been performed. It doesn't return an error for rootscoped resources with namespace, because namespace should already be cleared before.
Types ¶
type ValidateNameFunc ¶
ValidateNameFunc validates that the provided name is valid for a given resource type. Not all resources have the same validation rules for names. Prefix is true if the name will have a value appended to it. If the name is not valid, this returns a list of descriptions of individual characteristics of the value that were not valid. Otherwise this returns an empty list or nil.