util

package
v1.6.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultErrorExitCode = 1
	PreFlightExitCode    = 2
)
View Source
const (
	TokenIDBytes               = 3
	TokenSecretBytes           = 8
	BootstrapTokenSecretPrefix = "bootstrap-token-"
	DefaultTokenDuration       = time.Duration(8) * time.Hour
)

Variables

This section is empty.

Functions

func BearerToken

func BearerToken(d *kubeadmapi.TokenDiscovery) string

BearerToken returns a string representation of the passed token.

func CheckErr

func CheckErr(err error)

CheckErr prints a user friendly error to STDERR and exits with a non-zero exit code. Unrecognized errors will be printed with an "error: " prefix.

This method is generic to the command in use and may be used by non-Kubectl commands.

func DiscoveryPort

func DiscoveryPort(d *kubeadmapi.TokenDiscovery) int32

func GenerateToken

func GenerateToken(d *kubeadmapi.TokenDiscovery) error

GenerateToken generates a new token with a token ID that is valid as a Kubernetes DNS label. For more info, see kubernetes/pkg/util/validation/validation.go.

func KubernetesReleaseVersion added in v1.6.0

func KubernetesReleaseVersion(version string) (string, error)

KubernetesReleaseVersion is helper function that can fetch available version information from release servers based on label names, like "stable" or "latest".

If argument is already semantic version string, it will return same string.

In case of labels, it tries to fetch from release servers and then return actual semantic version.

Available names on release servers:

stable      (latest stable release)
stable-1    (latest stable release in 1.x)
stable-1.0  (and similarly 1.1, 1.2, 1.3, ...)
latest      (latest release, including alpha/beta)
latest-1    (latest release in 1.x, including alpha/beta)
latest-1.0  (and similarly 1.1, 1.2, 1.3, ...)

func ParseTemplate added in v1.6.0

func ParseTemplate(strtmpl string, obj interface{}) ([]byte, error)

func ParseToken

func ParseToken(s string) (string, string, error)

ParseToken tries and parse a valid token from a string. A token ID and token secret are returned in case of success, an error otherwise.

func ParseTokenID

func ParseTokenID(s string) error

ParseTokenID tries and parse a valid token ID from a string. An error is returned in case of failure.

func UpdateOrCreateToken

func UpdateOrCreateToken(client *clientset.Clientset, d *kubeadmapi.TokenDiscovery, tokenDuration time.Duration) error

UpdateOrCreateToken attempts to update a token with the given ID, or create if it does not already exist.

func ValidateToken

func ValidateToken(d *kubeadmapi.TokenDiscovery) (bool, error)

ValidateToken validates whether a token is well-formed. In case it's not, the corresponding error is returned as well.

Types

This section is empty.

Jump to

Keyboard shortcuts

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