validation

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const RestAPIPort = 6421

Variables

View Source
var ValidateNodeName = NameIsDNSSubdomain
View Source
var ValidatePodName = NameIsValidPodName

ValidatePodName can be used to check whether the given pod name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.

Functions

func NameIsDNS952Label

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

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

func NameIsDNSLabel

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

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

func NameIsDNSSubdomain

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

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

func NameIsValidPodName

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

Pod names are unique, they get to have slashes in them

func ValidateAnnotations

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

ValidateAnnotations validates that a set of annotations are correctly defined.

func ValidateDNS1123Label

func ValidateDNS1123Label(value string, fldPath *field.Path) field.ErrorList

func ValidateDNS1123Subdomain

func ValidateDNS1123Subdomain(value string, fldPath *field.Path) field.ErrorList

func ValidateFileExists

func ValidateFileExists(path string, fldPath *field.Path) field.ErrorList

func ValidateGPUSpec added in v0.0.6

func ValidateGPUSpec(gpuStr string, fldPath *field.Path) field.ErrorList

func ValidateInstanceType

func ValidateInstanceType(instanceType string, fldPath *field.Path) field.ErrorList

func ValidateLabelName

func ValidateLabelName(labelName string, fldPath *field.Path) field.ErrorList

ValidateLabelName validates that the label name is correctly defined.

func ValidateLabelSelector

func ValidateLabelSelector(ps *api.LabelSelector, fldPath *field.Path) field.ErrorList

func ValidateLabelSelectorRequirement

func ValidateLabelSelectorRequirement(sr api.LabelSelectorRequirement, fldPath *field.Path) field.ErrorList

func ValidateLabels

func ValidateLabels(labels map[string]string, fldPath *field.Path) field.ErrorList

ValidateLabels validates that a set of labels are correctly defined.

func ValidateNode

func ValidateNode(node *api.Node) field.ErrorList

ValidateNode tests if required fields in the node are set.

func ValidateNonnegativeField

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

Validates that given value is not negative.

func ValidateObjectMeta

func ValidateObjectMeta(meta *api.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. TODO: Remove calls to this method scattered in validations of specific resources, e.g., ValidatePodUpdate.

func ValidatePod

func ValidatePod(pod *api.Pod) field.ErrorList

ValidatePod tests if required fields in the pod are set.

func ValidatePodAnnotations

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

ValidatePodAnnotations validates pod annotations.

func ValidatePodSpec

func ValidatePodSpec(spec *api.PodSpec, fldPath *field.Path) field.ErrorList

ValidatePodSpec tests that the specified PodSpec has valid data. This includes checking formatting and uniqueness. It also canonicalizes the structure by setting default values and implementing any backwards-compatibility tricks.

func ValidatePositiveField

func ValidatePositiveField(value int, fldPath *field.Path) field.ErrorList

Validates that given value is not negative.

func ValidateResourceParses

func ValidateResourceParses(resourceStr string, fldPath *field.Path) field.ErrorList

Types

type StatefulValidator

type StatefulValidator struct {
	// contains filtered or unexported fields
}

func NewStatefulValidator

func NewStatefulValidator(cloudProvider string, vpcCIDRs []string) *StatefulValidator

func (*StatefulValidator) ValidatePodSpec

func (v *StatefulValidator) ValidatePodSpec(spec *api.PodSpec, fldPath *field.Path) field.ErrorList

type ValidateNameFunc

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.

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

+k8s:deepcopy-gen=false

func NewError

func NewError(kind, name string, errs field.ErrorList) *ValidationError

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL