package content
import "k8s.io/apimachinery/pkg/api/validate/content"
Index ¶
- Constants
- Variables
- func EmptyError() string
- func IsDNS1123Label(value string) []string
- func IsDNS1123Subdomain(value string) []string
- func IsDNS1123SubdomainCaseless(value string) []string
- func IsLabelKey(value string) []string
- func IsLabelValue(value string) []string
- func MaxLenError(length int) string
- func MinError[T constraints.Integer](min T) string
- func NEQError[T any](disallowed T) string
- func RegexError(msg string, re string, examples ...string) string
Constants ¶
const DNS1123LabelMaxLength int = 63
DNS1123LabelMaxLength is a label's max length in DNS (RFC 1123)
const DNS1123SubdomainMaxLength int = 253
DNS1123SubdomainMaxLength is a subdomain's max length in DNS (RFC 1123)
const LabelValueMaxLength int = 63
LabelValueMaxLength is a label's max length
Variables ¶
var IsQualifiedName = IsLabelKey
IsQualifiedName tests whether the value passed is what Kubernetes calls a "qualified name", which is the same as a label key.
Deprecated: use IsLabelKey instead.
Functions ¶
func EmptyError ¶
func EmptyError() string
EmptyError returns a string explanation of an "empty string" validation.
func IsDNS1123Label ¶
IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).
func IsDNS1123Subdomain ¶
IsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123) lowercase.
func IsDNS1123SubdomainCaseless ¶
IsDNS1123SubdomainCaseless tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).
Deprecated: API validation should never be caseless. Caseless validation is a vector for bugs and failed uniqueness assumptions. For example, names like "foo.com" and "FOO.COM" are both accepted as valid, but they are typically not treated as equal by consumers (e.g. CSI and DRA driver names). This fails the "least surprise" principle and can cause inconsistent behaviors.
Note: This allows uppercase names but is not caseless — uppercase and lowercase are treated as different values. Use IsDNS1123Subdomain for strict, lowercase validation instead.
func IsLabelKey ¶
IsLabelKey tests whether the value passed is a valid label key. This format is used to validate many fields in the Kubernetes API. Label keys consist of an optional prefix and a name, separated by a '/'. If the value is not valid, a list of error strings is returned. Otherwise, an empty list (or nil) is returned.
func IsLabelValue ¶
IsLabelValue tests whether the value passed is a valid label value. If the value is not valid, a list of error strings is returned. Otherwise an empty list (or nil) is returned.
func MaxLenError ¶
MaxLenError returns a string explanation of a "string too long" validation failure.
func MinError ¶
func MinError[T constraints.Integer](min T) string
MinError returns a string explanation of a "must be greater than or equal" validation failure.
func NEQError ¶
NEQError returns a string explanation of a "must not be equal to" validation failure.
func RegexError ¶
RegexError returns a string explanation of a regex validation failure.
Source Files ¶
dns.go errors.go kube.go
- Version
- v0.35.0-alpha.1
- Published
- Oct 4, 2025
- Platform
- windows/amd64
- Imports
- 5 packages
- Last checked
- 27 seconds ago –
Tools for package owners.