kubernetes: k8s.io/kubernetes/cmd/kubeadm/app/util Index | Files | Directories

package util

import "k8s.io/kubernetes/cmd/kubeadm/app/util"

Index

Package Files

arguments.go cgroupdriver.go chroot_unix.go copy.go endpoint.go error.go marshal.go net.go template.go version.go

Constants

const (
    // CgroupDriverSystemd holds the systemd driver type
    CgroupDriverSystemd = "systemd"
    // CgroupDriverCgroupfs holds the cgroupfs driver type
    CgroupDriverCgroupfs = "cgroupfs"
)
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
)

func BuildArgumentListFromMap Uses

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. In the return list override arguments will precede base arguments

func CheckErr Uses

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 Chroot Uses

func Chroot(rootfs string) error

Chroot chroot()s to the new path. NB: All file paths after this call are effectively relative to `rootfs`

func CopyDir Uses

func CopyDir(src string, dst string) error

CopyDir copies the content of a folder

func FormatErrMsg Uses

func FormatErrMsg(errs []error) string

FormatErrMsg returns a human-readable string describing the slice of errors passed to the function

func GetCgroupDriverDocker Uses

func GetCgroupDriverDocker(execer utilsexec.Interface) (string, error)

GetCgroupDriverDocker runs 'docker info -f "{{.CgroupDriver}}"' to obtain the docker cgroup driver

func GetControlPlaneEndpoint Uses

func GetControlPlaneEndpoint(controlPlaneEndpoint string, localEndpoint *kubeadmapi.APIEndpoint) (string, error)

GetControlPlaneEndpoint returns a properly formatted endpoint for the control plane built according following rules: - If the controlPlaneEndpoint is defined, use it. - if the controlPlaneEndpoint is defined but without a port number, use the controlPlaneEndpoint + localEndpoint.BindPort is used. - Otherwise, in case the controlPlaneEndpoint is not defined, use the localEndpoint.AdvertiseAddress + the localEndpoint.BindPort.

func GetHostname Uses

func GetHostname(hostnameOverride string) (string, error)

GetHostname returns OS's hostname if 'hostnameOverride' is empty; otherwise, return 'hostnameOverride' NOTE: This function copied from pkg/util/node package to avoid external kubeadm dependency

func GroupVersionKindsFromBytes Uses

func GroupVersionKindsFromBytes(b []byte) ([]schema.GroupVersionKind, error)

GroupVersionKindsFromBytes parses the bytes and returns a gvk slice

func GroupVersionKindsHasClusterConfiguration Uses

func GroupVersionKindsHasClusterConfiguration(gvks ...schema.GroupVersionKind) bool

GroupVersionKindsHasClusterConfiguration returns whether the following gvk slice contains a ClusterConfiguration object

func GroupVersionKindsHasInitConfiguration Uses

func GroupVersionKindsHasInitConfiguration(gvks ...schema.GroupVersionKind) bool

GroupVersionKindsHasInitConfiguration returns whether the following gvk slice contains a InitConfiguration object

func GroupVersionKindsHasJoinConfiguration Uses

func GroupVersionKindsHasJoinConfiguration(gvks ...schema.GroupVersionKind) bool

GroupVersionKindsHasJoinConfiguration returns whether the following gvk slice contains a JoinConfiguration object

func GroupVersionKindsHasKind Uses

func GroupVersionKindsHasKind(gvks []schema.GroupVersionKind, kind string) bool

GroupVersionKindsHasKind returns whether the following gvk slice contains the kind given as a parameter

func KubernetesIsCIVersion Uses

func KubernetesIsCIVersion(version string) bool

KubernetesIsCIVersion checks if user requested CI version

func KubernetesReleaseVersion Uses

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 KubernetesVersionToImageTag Uses

func KubernetesVersionToImageTag(version string) string

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 Uses

func MarshalToYaml(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)

MarshalToYaml marshals an object into yaml.

func MarshalToYamlForCodecs Uses

func MarshalToYamlForCodecs(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) ([]byte, error)

MarshalToYamlForCodecs marshals an object into yaml using the specified codec TODO: Is specifying the gv really needed here? TODO: Can we support json out of the box easily here?

func ParseArgumentListToMap Uses

func ParseArgumentListToMap(arguments []string) map[string]string

ParseArgumentListToMap parses a CLI argument list in the form "--foo=bar" to a string-string map

func ParseHostPort Uses

func ParseHostPort(hostport string) (string, string, error)

ParseHostPort parses a network address of the form "host:port", "ipv4:port", "[ipv6]:port" into host and port; ":port" can be eventually omitted. If the string is not a valid representation of network address, ParseHostPort returns an error.

func ParsePort Uses

func ParsePort(port string) (int, error)

ParsePort parses a string representing a TCP port. If the string is not a valid representation of a TCP port, ParsePort returns an error.

func ParseTemplate Uses

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

ParseTemplate validates and parses passed as argument template

func ReplaceArgument Uses

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

func SplitYAMLDocuments Uses

func SplitYAMLDocuments(yamlBytes []byte) (map[schema.GroupVersionKind][]byte, error)

SplitYAMLDocuments reads the YAML bytes per-document, unmarshals the TypeMeta information from each document and returns a map between the GroupVersionKind of the document and the document bytes

func UnmarshalFromYaml Uses

func UnmarshalFromYaml(buffer []byte, gv schema.GroupVersion) (runtime.Object, error)

UnmarshalFromYaml unmarshals yaml into an object.

func UnmarshalFromYamlForCodecs Uses

func UnmarshalFromYamlForCodecs(buffer []byte, gv schema.GroupVersion, codecs serializer.CodecFactory) (runtime.Object, error)

UnmarshalFromYamlForCodecs unmarshals yaml into an object using the specified codec TODO: Is specifying the gv really needed here? TODO: Can we support json out of the box easily here?

Directories

PathSynopsis
apiclient
audit
certs
config
config/strict
crypto
dryrun
etcd
initsystem
kubeconfig
kustomizePackage kustomize contains helpers for working with embedded kustomize commands
output
pkiutil
pubkeypinPackage pubkeypin provides primitives for x509 public key pinning in the style of RFC7469.
runtime
staticpod
system

Package util imports 35 packages (graph) and is imported by 110 packages. Updated 2019-10-19. Refresh now. Tools for package owners.