apimachinery: k8s.io/apimachinery/pkg/api/validation Index | Files | Directories

package validation

import "k8s.io/apimachinery/pkg/api/validation"

Package validation contains generic api type validation functions.

Index

Package Files

doc.go generic.go objectmeta.go

Constants

const FieldImmutableErrorMsg string = `field is immutable`
const IsNegativeErrorMsg string = `must be greater than or equal to 0`

Variables

var BannedOwners = map[schema.GroupVersionKind]struct{}{
    {Group: "", Version: "v1", Kind: "Event"}: {},
}

BannedOwners is a black list of object that are not allowed to be owners.

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.

func NameIsDNS1035Label Uses

func NameIsDNS1035Label(name string, prefix bool) []string

NameIsDNS1035Label is a ValidateNameFunc for names that must be a DNS 952 label.

func NameIsDNSLabel Uses

func NameIsDNSLabel(name string, prefix bool) []string

NameIsDNSLabel is a ValidateNameFunc for names that must be a DNS 1123 label.

func NameIsDNSSubdomain Uses

func NameIsDNSSubdomain(name string, prefix bool) []string

NameIsDNSSubdomain is a ValidateNameFunc for names that must be a DNS subdomain.

func ValidateAnnotations Uses

func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList

ValidateAnnotations validates that a set of annotations are correctly defined.

func ValidateFinalizerName Uses

func ValidateFinalizerName(stringValue string, fldPath *field.Path) field.ErrorList

Validate finalizer names

func ValidateFinalizers Uses

func ValidateFinalizers(finalizers []string, fldPath *field.Path) field.ErrorList

ValidateFinalizers tests if the finalizers name are valid, and if there are conflicting finalizers.

func ValidateImmutableField Uses

func ValidateImmutableField(newVal, oldVal interface{}, fldPath *field.Path) field.ErrorList

func ValidateNoNewFinalizers Uses

func ValidateNoNewFinalizers(newFinalizers []string, oldFinalizers []string, fldPath *field.Path) field.ErrorList

func ValidateNonnegativeField Uses

func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList

Validates that given value is not negative.

func ValidateObjectMeta Uses

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 Uses

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.

func ValidateObjectMetaAccessorUpdate Uses

func ValidateObjectMetaAccessorUpdate(newMeta, oldMeta metav1.Object, fldPath *field.Path) field.ErrorList

func ValidateObjectMetaUpdate Uses

func ValidateObjectMetaUpdate(newMeta, oldMeta *metav1.ObjectMeta, fldPath *field.Path) field.ErrorList

ValidateObjectMetaUpdate validates an object's metadata when updated

func ValidateOwnerReferences Uses

func ValidateOwnerReferences(ownerReferences []metav1.OwnerReference, fldPath *field.Path) field.ErrorList

type ValidateNameFunc Uses

type ValidateNameFunc func(name string, prefix bool) []string

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.

Directories

PathSynopsis
path

Package validation imports 10 packages (graph) and is imported by 90 packages. Updated 2019-03-11. Refresh now. Tools for package owners.