Documentation ¶
Overview ¶
Package norm provides normalization routines for making arbitrary text compatible with Kubernetes's field requirements.
Index ¶
- func AnyDNSLabelName(raw string, opts ...AnyDNSLabelNameOption) string
- func AnyDNSLabelNameSuffixed(prefix, suffix string) string
- func AnyDNSSubdomainName(raw string) string
- func AnyQualifiedName(raw string) string
- func MetaGenerateName(raw string) string
- func MetaName(raw string) string
- func MetaNameSuffixed(prefix, suffix string) string
- type AnyDNSLabelNameOption
- type AnyDNSLabelNameOptions
- type DNSNameRFC
- type WithDNSNameRFC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyDNSLabelName ¶
func AnyDNSLabelName(raw string, opts ...AnyDNSLabelNameOption) string
AnyDNSLabelName normalizes a raw string so that it conforms to the structure of a DNS label: it must be all lowercase, contain only alphanumeric characters and dashes; and the last character must be alphanumeric. In the case of RFC 1035, the first character must be alphabetical, while in the case of RFC 1123, the first character must be alphanumeric.
func AnyDNSLabelNameSuffixed ¶ added in v0.2.0
AnyDNSLabelNameSuffixed calls AnyDNSLabelName ensuring that the entirety of the given suffix is retained if possible.
func AnyDNSSubdomainName ¶
AnyDNSSubdomainName normalizes a raw string so that it conforms to the structure of a DNS domain (RFC 1123): it must be all lowercase; contain only alphanumeric characters and dashes; and the first and last characters must be alphanumeric.
func AnyQualifiedName ¶ added in v0.6.0
AnyQualifiedName normalizes a raw string so that it conforms to the structure of a Kubernetes qualified name.
Qualified names optionally start with a DNS subdomain followed by a slash. They always begin and end with an alphanumeric character, and internally may contain alphanumeric characters, dashes, underscores, and dots up to 63 characters.
func MetaGenerateName ¶
MetaGenerateName normalizes a Kubernetes metadata generateName field. It is opinionated in that it also forces a dash before the five characters generated by the Kubernetes API.
func MetaNameSuffixed ¶ added in v0.2.0
MetaNameSuffixed normalizes a Kubernetes metadata name field ensuring that the entirety of the given suffix is retained if possible.
Types ¶
type AnyDNSLabelNameOption ¶ added in v0.6.0
type AnyDNSLabelNameOption interface {
ApplyToAnyDNSLabelNameOptions(target *AnyDNSLabelNameOptions)
}
type AnyDNSLabelNameOptions ¶ added in v0.6.0
type AnyDNSLabelNameOptions struct {
DNSNameRFC DNSNameRFC
}
func (*AnyDNSLabelNameOptions) ApplyOptions ¶ added in v0.6.0
func (o *AnyDNSLabelNameOptions) ApplyOptions(opts []AnyDNSLabelNameOption)
type DNSNameRFC ¶ added in v0.6.0
type DNSNameRFC string
const ( DNSNameRFC1035 DNSNameRFC = "1035" DNSNameRFC1123 DNSNameRFC = "1123" )
type WithDNSNameRFC ¶ added in v0.6.0
type WithDNSNameRFC DNSNameRFC
func (WithDNSNameRFC) ApplyToAnyDNSLabelNameOptions ¶ added in v0.6.0
func (wdnr WithDNSNameRFC) ApplyToAnyDNSLabelNameOptions(target *AnyDNSLabelNameOptions)