Documentation
¶
Index ¶
- Constants
- func BuildArgumentListFromMap(baseArguments map[string]string, overrideArguments map[string]string) []string
- func CheckErr(err error)
- func CopyDir(src string, dst string) error
- func FormatErrMsg(errs []error) string
- func GetMasterEndpoint(cfg *kubeadmapi.MasterConfiguration) (string, error)
- func GetMasterHostPort(cfg *kubeadmapi.MasterConfiguration) (string, error)
- func KubernetesIsCIVersion(version string) bool
- func KubernetesReleaseVersion(version string) (string, error)
- func KubernetesVersionToImageTag(version string) string
- func MarshalToYaml(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)
- func MarshalToYamlForCodecs(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) ([]byte, error)
- func MarshalToYamlForCodecsWithShift(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) (string, error)
- func ParseArgumentListToMap(arguments []string) map[string]string
- func ParseTemplate(strtmpl string, obj interface{}) ([]byte, error)
- func ReplaceArgument(command []string, argMutateFunc func(map[string]string) map[string]string) []string
- type EtcdCluster
- type LocalEtcdCluster
Constants ¶
const ( // DefaultErrorExitCode defines exit the code for failed action generally DefaultErrorExitCode = 1 // PreFlightExitCode defines exit the code for preflight checks PreFlightExitCode = 2 // ValidationExitCode defines the exit code validation checks ValidationExitCode = 3 )
Variables ¶
This section is empty.
Functions ¶
func BuildArgumentListFromMap ¶ added in v1.8.8
func BuildArgumentListFromMap(baseArguments map[string]string, overrideArguments map[string]string) []string
BuildArgumentListFromMap takes two string-string maps, one with the base arguments and one with optional override arguments
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 FormatErrMsg ¶ added in v1.9.0
FormatErrMsg returns a human-readable string describing the slice of errors passed to the function
func GetMasterEndpoint ¶ added in v1.8.8
func GetMasterEndpoint(cfg *kubeadmapi.MasterConfiguration) (string, error)
GetMasterEndpoint returns a properly formatted Master Endpoint or passes the error from GetMasterHostPort.
func GetMasterHostPort ¶ added in v1.8.8
func GetMasterHostPort(cfg *kubeadmapi.MasterConfiguration) (string, error)
GetMasterHostPort returns a properly formatted Master IP/port pair or error if the IP address can not be parsed or port is outside the valid TCP range.
func KubernetesIsCIVersion ¶ added in v1.8.8
KubernetesIsCIVersion checks if user requested CI version
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 KubernetesVersionToImageTag ¶ added in v1.8.8
KubernetesVersionToImageTag is helper function that replaces all non-allowed symbols in tag strings with underscores. Image tag can only contain lowercase and uppercase letters, digits, underscores, periods and dashes. Current usage is for CI images where all of symbols except '+' are valid, but function is for generic usage where input can't be always pre-validated.
func MarshalToYaml ¶ added in v1.9.0
MarshalToYaml marshals an object into yaml.
func MarshalToYamlForCodecs ¶ added in v1.9.0
func MarshalToYamlForCodecs(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) ([]byte, error)
MarshalToYamlForCodecs marshals an object into yaml using the specified codec
func MarshalToYamlForCodecsWithShift ¶ added in v1.9.0
func MarshalToYamlForCodecsWithShift(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) (string, error)
MarshalToYamlForCodecsWithShift adds spaces in front of each line so the indents line up correctly in the manifest
func ParseArgumentListToMap ¶ added in v1.8.8
ParseArgumentListToMap parses a CLI argument list in the form "--foo=bar" to a string-string map
func ParseTemplate ¶
ParseTemplate validates and parses passed as argument template
func ReplaceArgument ¶ added in v1.8.8
func ReplaceArgument(command []string, argMutateFunc func(map[string]string) map[string]string) []string
ReplaceArgument gets a command list; converts it to a map for easier modification, runs the provided function that returns a new modified map, and then converts the map back to a command string slice
Types ¶
type EtcdCluster ¶ added in v1.9.0
type EtcdCluster interface {
GetEtcdClusterStatus() (*clientv3.StatusResponse, error)
}
EtcdCluster is an interface to get etcd cluster related information
type LocalEtcdCluster ¶ added in v1.9.0
type LocalEtcdCluster struct{}
LocalEtcdCluster represents an instance of a local etcd cluster
func (LocalEtcdCluster) GetEtcdClusterStatus ¶ added in v1.9.0
func (cluster LocalEtcdCluster) GetEtcdClusterStatus() (*clientv3.StatusResponse, error)
GetEtcdClusterStatus returns nil for status Up or error for status Down