Documentation ¶
Index ¶
- Constants
- func BearerToken(d *kubeadmapi.TokenDiscovery) string
- func CheckErr(err error)
- func DiscoveryPort(d *kubeadmapi.TokenDiscovery) int32
- func GenerateToken(d *kubeadmapi.TokenDiscovery) error
- func KubernetesReleaseVersion(version string) (string, error)
- func ParseTemplate(strtmpl string, obj interface{}) ([]byte, error)
- func ParseToken(s string) (string, string, error)
- func ParseTokenID(s string) error
- func UpdateOrCreateToken(client *clientset.Clientset, d *kubeadmapi.TokenDiscovery, ...) error
- func ValidateToken(d *kubeadmapi.TokenDiscovery) (bool, error)
Constants ¶
const ( DefaultErrorExitCode = 1 PreFlightExitCode = 2 )
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 ¶
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 ¶
func ParseToken ¶
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 ¶
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.