apimachineryk8s.io/apimachinery/pkg/apis/meta/v1/validation Index | Files

package validation

import "k8s.io/apimachinery/pkg/apis/meta/v1/validation"

Index

Constants

const MaxSubresourceNameLength = 256
const UninitializedStatusUpdateErrorMsg string = `must not update status when the object is uninitialized`

Variables

var FieldManagerMaxLength = 128

Functions

func LabelSelectorHasInvalidLabelValue

func LabelSelectorHasInvalidLabelValue(ps *metav1.LabelSelector) bool

LabelSelectorHasInvalidLabelValue returns true if the given selector contains an invalid label value in a match expression. This is useful for determining whether AllowInvalidLabelValueInSelector should be set to true when validating an update based on existing persisted invalid values.

func ValidateCondition

func ValidateCondition(condition metav1.Condition, fldPath *field.Path) field.ErrorList

func ValidateConditions

func ValidateConditions(conditions []metav1.Condition, fldPath *field.Path) field.ErrorList

func ValidateCreateOptions

func ValidateCreateOptions(options *metav1.CreateOptions) field.ErrorList

func ValidateDeleteOptions

func ValidateDeleteOptions(options *metav1.DeleteOptions) field.ErrorList

func ValidateDryRun

func ValidateDryRun(fldPath *field.Path, dryRun []string) field.ErrorList

ValidateDryRun validates that a dryRun query param only contains allowed values.

func ValidateFieldManager

func ValidateFieldManager(fieldManager string, fldPath *field.Path) field.ErrorList

ValidateFieldManager valides that the fieldManager is the proper length and only has printable characters.

func ValidateFieldSelectorRequirement

func ValidateFieldSelectorRequirement(requirement metav1.FieldSelectorRequirement, opts FieldSelectorValidationOptions, fldPath *field.Path) field.ErrorList

ValidateLabelSelectorRequirement validates the requirement according to the opts and returns any validation errors.

func ValidateFieldValidation

func ValidateFieldValidation(fldPath *field.Path, fieldValidation string) field.ErrorList

ValidateFieldValidation validates that a fieldValidation query param only contains allowed values.

func ValidateIgnoreStoreReadError

func ValidateIgnoreStoreReadError(fldPath *field.Path, options *metav1.DeleteOptions) field.ErrorList

ValidateIgnoreStoreReadError validates that delete options are valid when ignoreStoreReadErrorWithClusterBreakingPotential is enabled

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 *metav1.LabelSelector, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList

ValidateLabelSelector validate the LabelSelector according to the opts and returns any validation errors. opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data.

func ValidateLabelSelectorRequirement

func ValidateLabelSelectorRequirement(sr metav1.LabelSelectorRequirement, opts LabelSelectorValidationOptions, fldPath *field.Path) field.ErrorList

ValidateLabelSelectorRequirement validate the requirement according to the opts and returns any validation errors. opts.AllowInvalidLabelValueInSelector is only expected to be set to true when required for backwards compatibility with existing invalid data.

func ValidateLabels

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

ValidateLabels validates that a set of labels are correctly defined.

func ValidateManagedFields

func ValidateManagedFields(fieldsList []metav1.ManagedFieldsEntry, fldPath *field.Path) field.ErrorList

func ValidatePatchOptions

func ValidatePatchOptions(options *metav1.PatchOptions, patchType types.PatchType) field.ErrorList

func ValidateTableOptions

func ValidateTableOptions(opts *metav1.TableOptions) field.ErrorList

ValidateTableOptions returns any invalid flags on TableOptions.

func ValidateUpdateOptions

func ValidateUpdateOptions(options *metav1.UpdateOptions) field.ErrorList

Types

type FieldSelectorValidationOptions

type FieldSelectorValidationOptions struct {
	// Allows an operator that is not interpretable to pass validation.  This is useful for cases where a broader check
	// can be performed, as in a *SubjectAccessReview
	AllowUnknownOperatorInRequirement bool
}

FieldSelectorValidationOptions is a struct that can be passed to ValidateFieldSelectorRequirement to record the validate options

type LabelSelectorValidationOptions

type LabelSelectorValidationOptions struct {
	// Allow invalid label value in selector
	AllowInvalidLabelValueInSelector bool

	// Allows an operator that is not interpretable to pass validation.  This is useful for cases where a broader check
	// can be performed, as in a *SubjectAccessReview
	AllowUnknownOperatorInRequirement bool
}

LabelSelectorValidationOptions is a struct that can be passed to ValidateLabelSelector to record the validate options

Source Files

validation.go

Version
v0.33.0 (latest)
Published
Apr 11, 2025
Platform
linux/amd64
Imports
9 packages
Last checked
21 minutes ago

Tools for package owners.