Documentation ¶
Index ¶
- Variables
- func BootstrapTokenSecretName(tokenID string) string
- func GenerateBootstrapToken() (string, error)
- func IsValidBootstrapToken(token string) bool
- func IsValidBootstrapTokenID(tokenID string) bool
- func TokenFromIDAndSecret(id, secret string) string
- func ValidateBootstrapGroupName(name string) error
- func ValidateUsages(usages []string) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
BootstrapTokenSecretName returns the expected name for the Secret storing the Bootstrap Token in the Kubernetes API.
func GenerateBootstrapToken ¶
GenerateBootstrapToken generates a new, random Bootstrap Token.
func IsValidBootstrapToken ¶
IsValidBootstrapToken returns whether the given string is valid as a Bootstrap Token. Avoid using BootstrapTokenRegexp.MatchString(token) and instead perform constant-time comparisons on the secret.
func IsValidBootstrapTokenID ¶
IsValidBootstrapTokenID returns whether the given string is valid as a Bootstrap Token ID and in other words satisfies the BootstrapTokenIDRegexp
func TokenFromIDAndSecret ¶
TokenFromIDAndSecret returns the full token which is of the form "{id}.{secret}"
func ValidateBootstrapGroupName ¶
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 ¶
ValidateUsages validates that the passed in string are valid usage strings for bootstrap tokens.
Types ¶
This section is empty.