common

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package common contains common code for implementing providers

Index

Constants

View Source
const (
	// HTTPProxy is the HTTP_PROXY environment variable key
	HTTPProxy = "HTTP_PROXY"
	// HTTPSProxy is the HTTPS_PROXY environment variable key
	HTTPSProxy = "HTTPS_PROXY"
	// NOProxy is the NO_PROXY environment variable key
	NOProxy = "NO_PROXY"
)
View Source
const APIServerInternalPort = 6443

APIServerInternalPort defines the port where the control plane is listening _inside_ the node network

Variables

This section is empty.

Functions

func CollectLogs

func CollectLogs(n nodes.Node, dir string) error

CollectLogs provides the common functionality to get various debug info from the node

func FileOnHost

func FileOnHost(path string) (*os.File, error)

FileOnHost is a helper to create a file at path even if the parent directory doesn't exist in which case it will be created with ModePerm

func GetFreePort

func GetFreePort(listenAddr string) (int32, error)

GetFreePort is a helper used to get a free TCP port on the host

func GetProxyEnvs

func GetProxyEnvs(cfg *config.Cluster) map[string]string

GetProxyEnvs returns a map of proxy environment variables to their values If proxy settings are set, NO_PROXY is modified to include the cluster subnets

func MakeNodeNamer

func MakeNodeNamer(clusterName string) func(string) string

MakeNodeNamer returns a func(role string)(nodeName string) used to name nodes based on their role and the clusterName

func NodeReachedCgroupsReadyRegexp added in v0.12.0

func NodeReachedCgroupsReadyRegexp() *regexp.Regexp

NodeReachedCgroupsReadyRegexp returns a regexp for use with WaitUntilLogRegexpMatches

This is used to avoid "ERROR: this script needs /sys/fs/cgroup/cgroup.procs to be empty (for writing the top-level cgroup.subtree_control)" See https://github.com/kubernetes-sigs/kind/issues/2409

This pattern matches either "detected cgroupv1" from the kind node image's entrypoint logs or "Multi-User System" target if is using cgroups v2, so that `docker exec` can be executed safely without breaking cgroup v2 hierarchy.

func PortOrGetFreePort

func PortOrGetFreePort(port int32, listenAddr string) (int32, error)

PortOrGetFreePort is a helper that either returns the provided port if valid or returns a new free port on listenAddr

func RequiredNodeImages

func RequiredNodeImages(cfg *config.Cluster) sets.String

RequiredNodeImages returns the set of _node_ images specified by the config This does not include the loadbalancer image, and is only used to improve the UX by explicit pulling the node images prior to running

func WaitUntilLogRegexpMatches added in v0.12.0

func WaitUntilLogRegexpMatches(logCtx context.Context, logCmd exec.Cmd, re *regexp.Regexp) error

WaitUntilLogRegexpMatches waits until logCmd output produces a line matching re. It will use logCtx to determine if the logCmd deadline was exceeded for producing the most useful error message in failure cases, logCtx should be the context supplied to create logCmd with CommandContext

Types

This section is empty.

Jump to

Keyboard shortcuts

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