Documentation ¶
Overview ¶
Package validate contains validation utilities for installer types.
Index ¶
- Variables
- func CABundle(v string) error
- func ClusterName(v string) error
- func ClusterName1035(v string) error
- func ClusterNameMaxLength(v string, maxlen int) error
- func DoCIDRsOverlap(acidr, bcidr *net.IPNet) bool
- func DomainName(v string, acceptTrailingDot bool) error
- func GCPClusterName(v string) error
- func Host(v string) error
- func IP(ip string) error
- func ImagePullSecret(secret string) error
- func MAC(addr string) error
- func NoProxyDomainName(v string) error
- func OnPremClusterName(v string) error
- func SSHPublicKey(v string) error
- func ServiceSubnetCIDR(cidr *net.IPNet) error
- func SubnetCIDR(cidr *net.IPNet) error
- func URI(uri string) error
- func URIWithProtocol(uri string, protocol string) error
- func UUID(val string) error
Constants ¶
This section is empty.
Variables ¶
var ( // DockerBridgeCIDR is the network range that is used by default network for docker. DockerBridgeCIDR = func() *net.IPNet { _, cidr, _ := net.ParseCIDR("172.17.0.0/16") return cidr }() )
Functions ¶
func CABundle ¶ added in v0.9.2
CABundle checks if the given string contains valid certificate(s) and returns an error if not.
func ClusterName ¶
ClusterName checks if the given string is a valid name for a cluster and returns an error if not. The max length of the DNS label is `DNS1123LabelMaxLength + 9` because the public DNS zones have records `api.clustername`, `*.apps.clustername`, and *.apps is rendered as the nine-character \052.apps in DNS records.
func ClusterName1035 ¶ added in v0.9.2
ClusterName1035 checks the provided cluster name matches RFC1035 naming requirements. Some platform resource names must comply with RFC1035 "[a-z]([-a-z0-9]*[a-z0-9])?". They are based on the InfraID, which is a truncated version of the cluster name where all non- alphanumeric characters "[^A-Za-z0-9-]" have been replaced with dashes "-". As a result, if we first verify the name starts with a lower-case letter "^[a-z]" then we can rely on the ClusterName function to confirm compliance with the rest. The resulting name will therefore match RFC1035 with the exception of possible periods ".", which will be translated into dashes "-" in the InfraID before being used to create cloud resources.
func ClusterNameMaxLength ¶ added in v0.9.2
ClusterNameMaxLength validates if the string provided length is greater than maxlen argument.
func DoCIDRsOverlap ¶ added in v0.7.0
DoCIDRsOverlap returns true if one of the CIDRs is a subset of the other.
func DomainName ¶
DomainName checks if the given string is a valid domain name and returns an error if not.
func GCPClusterName ¶ added in v0.9.2
GCPClusterName checks if the provided cluster name has words similar to the word 'google' since resources with that name are not allowed in GCP.
func ImagePullSecret ¶ added in v0.7.0
ImagePullSecret checks if the given string is a valid image pull secret and returns an error if not.
func NoProxyDomainName ¶ added in v0.9.2
NoProxyDomainName checks if the given string is a valid proxy noProxy domain name and returns an error if not. Example valid noProxy domains are ".foo.com", "bar.com", "bar.com." but not "*.foo.com".
func OnPremClusterName ¶ added in v0.9.2
OnPremClusterName verifies if the cluster name contains a '.' and returns an error if it does.
func SSHPublicKey ¶ added in v0.4.0
SSHPublicKey checks if the given string is a valid SSH public key and returns an error if not.
func ServiceSubnetCIDR ¶ added in v0.9.2
ServiceSubnetCIDR checks if the given IP net is a valid CIDR for the Kubernetes service network
func SubnetCIDR ¶
SubnetCIDR checks if the given IP net is a valid CIDR.
func URIWithProtocol ¶ added in v0.9.2
URIWithProtocol validates that the URI specifies a certain protocol scheme (e.g. "https")
Types ¶
This section is empty.