util

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BootstrapTokenRegexp is a compiled regular expression of TokenRegexpString
	BootstrapTokenRegexp = regexp.MustCompile(api.BootstrapTokenPattern)
	// BootstrapTokenIDRegexp is a compiled regular expression of TokenIDRegexpString
	BootstrapTokenIDRegexp = regexp.MustCompile(api.BootstrapTokenIDPattern)
	// BootstrapGroupRegexp is a compiled regular expression of BootstrapGroupPattern
	BootstrapGroupRegexp = regexp.MustCompile(api.BootstrapGroupPattern)
)

Functions

func BootstrapTokenSecretName

func BootstrapTokenSecretName(tokenID string) string

BootstrapTokenSecretName returns the expected name for the Secret storing the Bootstrap Token in the Kubernetes API.

func GenerateBootstrapToken

func GenerateBootstrapToken() (string, error)

GenerateBootstrapToken generates a new, random Bootstrap Token.

func IsValidBootstrapToken

func IsValidBootstrapToken(token string) bool

IsValidBootstrapToken returns whether the given string is valid as a Bootstrap Token and in other words satisfies the BootstrapTokenRegexp

func IsValidBootstrapTokenID

func IsValidBootstrapTokenID(tokenID string) bool

IsValidBootstrapTokenID returns whether the given string is valid as a Bootstrap Token ID and in other words satisfies the BootstrapTokenIDRegexp

func TokenFromIDAndSecret

func TokenFromIDAndSecret(id, secret string) string

TokenFromIDAndSecret returns the full token which is of the form "{id}.{secret}"

func ValidateBootstrapGroupName

func ValidateBootstrapGroupName(name string) error

ValidateBootstrapGroupName checks if the provided group name is a valid bootstrap group name. Returns nil if valid or a validation error if invalid. TODO(dixudx): should be moved to util/secrets

func ValidateUsages

func ValidateUsages(usages []string) error

ValidateUsages validates that the passed in string are valid usage strings for bootstrap tokens.

Types

This section is empty.

Jump to

Keyboard shortcuts

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