validate

package
v0.0.0-...-c53fdc3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

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

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

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

func ClusterNameMaxLength(v string, maxlen int) error

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

func DoCIDRsOverlap

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

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

func Host(v string) error

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

func IP

func IP(ip string) error

IP validates if a string is a valid IP.

func ImagePullSecret

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

func MAC(addr string) error

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

func NoProxyDomainName

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

func OnPremClusterName(v string) error

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

func SSHPublicKey

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

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

func URI(uri string) error

URI validates if the URI is a valid absolute URI.

func URIWithProtocol

func URIWithProtocol(uri string, protocol string) error

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

func UUID

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