validate

package
v1.14.16-dcf8320c8c4e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 145

Documentation

Overview

Package validate contains validation utilities for installer types.

Index

Constants

This section is empty.

Variables

View Source
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

func CABundle(v string) error

CABundle checks if the given string contains valid certificate(s) and returns an error if not.

func ClusterName

func ClusterName(v string) error

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

func ClusterName1035(v string) error

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

func ClusterNameMaxLength(v string, maxlen int) error

ClusterNameMaxLength validates if the string provided length is greater than maxlen argument.

func DoCIDRsOverlap added in v0.7.0

func DoCIDRsOverlap(acidr, bcidr *net.IPNet) bool

DoCIDRsOverlap returns true if one of the CIDRs is a subset of the other.

func DomainName

func DomainName(v string, acceptTrailingDot bool) error

DomainName checks if the given string is a valid domain name and returns an error if not.

func GCPClusterName added in v0.9.2

func GCPClusterName(v string) error

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 Host added in v0.9.2

func Host(v string) error

Host validates that a given string is a valid URI host.

func IP added in v0.9.2

func IP(ip string) error

IP validates if a string is a valid IP.

func ImagePullSecret added in v0.7.0

func ImagePullSecret(secret string) error

ImagePullSecret checks if the given string is a valid image pull secret and returns an error if not.

func MAC added in v0.9.2

func MAC(addr string) error

MAC validates that a value is a valid unicast EUI-48 MAC address

func NoProxyDomainName added in v0.9.2

func NoProxyDomainName(v string) error

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

func OnPremClusterName(v string) error

OnPremClusterName verifies if the cluster name contains a '.' and returns an error if it does.

func SSHPublicKey added in v0.4.0

func SSHPublicKey(v string) error

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

func ServiceSubnetCIDR(cidr *net.IPNet) error

ServiceSubnetCIDR checks if the given IP net is a valid CIDR for the Kubernetes service network

func SubnetCIDR

func SubnetCIDR(cidr *net.IPNet) error

SubnetCIDR checks if the given IP net is a valid CIDR.

func URI added in v0.7.0

func URI(uri string) error

URI validates if the URI is a valid absolute URI.

func URIWithProtocol added in v0.9.2

func URIWithProtocol(uri string, protocol string) error

URIWithProtocol validates that the URI specifies a certain protocol scheme (e.g. "https")

func UUID added in v0.9.2

func UUID(val string) error

UUID validates that a uuid is non-empty and a valid uuid.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL