Documentation
¶
Overview ¶
Package validate holds the field-level validators kubeaid-cli's interactive prompt runs at input time, exported so a consumer that isn't a terminal (the Obmondo add-cluster web form) can enforce the same rules — e.g. the Hetzner vSwitch VLAN ID range, the cluster name shape — before submitting.
Every function here is pure (string in, error out) and free of pkg/config/prompt's charmbracelet/huh dependency, so importing this package does not pull a terminal-UI library into a server binary. pkg/config/prompt's own huh forms delegate to these exact functions.
Index ¶
Constants ¶
const ( MinHetznerVLANID = 4000 MaxHetznerVLANID = 4091 )
MinHetznerVLANID / MaxHetznerVLANID bound the VLAN IDs Hetzner's vSwitch webservice accepts (inclusive).
Variables ¶
var ErrRequired = errors.New("value is required")
ErrRequired is returned by NonEmpty when the input is empty.
Functions ¶
func ClusterName ¶
ClusterName validates a cluster.name value: non-empty, no dots (the name is spliced into DNS labels — the NetBird peer FQDN k8s-<name>, HCloud/Robot resource names), at most 63 characters, and RFC-1123 label shaped (CAPI's Cluster object name rule). Mirrors pkg/config/parser's validateClusterName.
func HetznerVLANID ¶
HetznerVLANID validates a Hetzner vSwitch VLAN ID: numeric and within MinHetznerVLANID-MaxHetznerVLANID — the range Hetzner's webservice accepts.
func IPv4InSubnet ¶
IPv4InSubnet returns a validator requiring its input to be a valid IPv4 address inside cidr. An empty cidr disables the containment check, falling back to a plain IPv4 validation.
Types ¶
This section is empty.