config

package
v0.0.0-...-35c3564 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PlaceholderToken is only set statically to make kubeadm not randomize the token on every run
	PlaceholderToken = bootstraptokenv1.BootstrapToken{
		Token: &bootstraptokenv1.BootstrapTokenString{
			ID:     "abcdef",
			Secret: "0123456789abcdef",
		},
	}
)

Functions

func BytesToInitConfiguration

func BytesToInitConfiguration(b []byte) (*kubeadmapi.InitConfiguration, error)

BytesToInitConfiguration converts a byte slice to an internal, defaulted and validated InitConfiguration object. The map may contain many different YAML documents. These YAML documents are parsed one-by-one and well-known ComponentConfig GroupVersionKinds are stored inside of the internal InitConfiguration struct. The resulting InitConfiguration is then dynamically defaulted and validated prior to return.

func ChooseAPIServerBindAddress

func ChooseAPIServerBindAddress(bindAddress net.IP) (net.IP, error)

ChooseAPIServerBindAddress is a wrapper for netutil.ResolveBindAddress that also handles the case where no default routes were found and an IP for the API server could not be obtained.

func DefaultedInitConfiguration

func DefaultedInitConfiguration(versionedInitCfg *kubeadmapiv1.InitConfiguration, versionedClusterCfg *kubeadmapiv1.ClusterConfiguration) (*kubeadmapi.InitConfiguration, error)

DefaultedInitConfiguration takes a versioned init config (often populated by flags), defaults it and converts it into internal InitConfiguration

func DefaultedJoinConfiguration

func DefaultedJoinConfiguration(defaultversionedcfg *kubeadmapiv1.JoinConfiguration) (*kubeadmapi.JoinConfiguration, error)

DefaultedJoinConfiguration takes a versioned JoinConfiguration (usually filled in by command line parameters), defaults it, converts it to internal and validates it

func DefaultedStaticInitConfiguration

func DefaultedStaticInitConfiguration() (*kubeadmapi.InitConfiguration, error)

DefaultedStaticInitConfiguration returns the internal InitConfiguration with static defaults.

func LoadInitConfigurationFromFile

func LoadInitConfigurationFromFile(cfgPath string) (*kubeadmapi.InitConfiguration, error)

LoadInitConfigurationFromFile loads a supported versioned InitConfiguration from a file, converts it into internal config, defaults it and verifies it.

func LoadJoinConfigurationFromFile

func LoadJoinConfigurationFromFile(cfgPath string) (*kubeadmapi.JoinConfiguration, error)

LoadJoinConfigurationFromFile loads versioned JoinConfiguration from file, converts it to internal, defaults and validates it

func LoadOrDefaultInitConfiguration

func LoadOrDefaultInitConfiguration(cfgPath string, versionedInitCfg *kubeadmapiv1.InitConfiguration, versionedClusterCfg *kubeadmapiv1.ClusterConfiguration) (*kubeadmapi.InitConfiguration, error)

LoadOrDefaultInitConfiguration takes a path to a config file and a versioned configuration that can serve as the default config If cfgPath is specified, the versioned configs will always get overridden with the one in the file (specified by cfgPath). The external, versioned configuration is defaulted and converted to the internal type. Right thereafter, the configuration is defaulted again with dynamic values (like IP addresses of a machine, etc) Lastly, the internal config is validated and returned.

func LoadOrDefaultJoinConfiguration

func LoadOrDefaultJoinConfiguration(cfgPath string, defaultversionedcfg *kubeadmapiv1.JoinConfiguration) (*kubeadmapi.JoinConfiguration, error)

LoadOrDefaultJoinConfiguration takes a path to a config file and a versioned configuration that can serve as the default config If cfgPath is specified, defaultversionedcfg will always get overridden. Otherwise, the default config (often populated by flags) will be used. Then the external, versioned configuration is defaulted and converted to the internal type. Right thereafter, the configuration is defaulted again with dynamic values (like IP addresses of a machine, etc) Lastly, the internal config is validated and returned.

func LowercaseSANs

func LowercaseSANs(sans []string)

LowercaseSANs can be used to force all SANs to be lowercase so it passes IsDNS1123Subdomain

func MarshalInitConfigurationToBytes

func MarshalInitConfigurationToBytes(cfg *kubeadmapi.InitConfiguration, gv schema.GroupVersion) ([]byte, error)

MarshalInitConfigurationToBytes marshals the internal InitConfiguration object to bytes. It writes the embedded ClusterConfiguration object with ComponentConfigs out as separate YAML documents

func MarshalKubeadmConfigObject

func MarshalKubeadmConfigObject(obj runtime.Object) ([]byte, error)

MarshalKubeadmConfigObject marshals an Object registered in the kubeadm scheme. If the object is a InitConfiguration or ClusterConfiguration, some extra logic is run

func MigrateOldConfig

func MigrateOldConfig(oldConfig []byte) ([]byte, error)

MigrateOldConfig migrates an old configuration from a byte slice into a new one (returned again as a byte slice). Only kubeadm kinds are migrated. Others are silently ignored.

func NormalizeKubernetesVersion

func NormalizeKubernetesVersion(cfg *kubeadmapi.ClusterConfiguration) error

NormalizeKubernetesVersion resolves version labels, sets alternative image registry if requested for CI builds, and validates minimal version that kubeadm SetInitDynamicDefaultssupports.

func SetAPIEndpointDynamicDefaults

func SetAPIEndpointDynamicDefaults(cfg *kubeadmapi.APIEndpoint) error

SetAPIEndpointDynamicDefaults checks and sets configuration values for the APIEndpoint object

func SetBootstrapTokensDynamicDefaults

func SetBootstrapTokensDynamicDefaults(cfg *[]bootstraptokenv1.BootstrapToken) error

SetBootstrapTokensDynamicDefaults checks and sets configuration values for the BootstrapTokens object

func SetClusterDynamicDefaults

func SetClusterDynamicDefaults(cfg *kubeadmapi.ClusterConfiguration) error

SetClusterDynamicDefaults checks and sets values for the ClusterConfiguration object

func SetInitDynamicDefaults

func SetInitDynamicDefaults(cfg *kubeadmapi.InitConfiguration) error

SetInitDynamicDefaults checks and sets configuration values for the InitConfiguration object

func SetJoinControlPlaneDefaults

func SetJoinControlPlaneDefaults(cfg *kubeadmapi.JoinControlPlane) error

SetJoinControlPlaneDefaults checks and sets configuration values for the JoinControlPlane object

func SetJoinDynamicDefaults

func SetJoinDynamicDefaults(cfg *kubeadmapi.JoinConfiguration) error

SetJoinDynamicDefaults checks and sets configuration values for the JoinConfiguration object

func VerifyAPIServerBindAddress

func VerifyAPIServerBindAddress(address string) error

VerifyAPIServerBindAddress can be used to verify if a bind address for the API Server is 0.0.0.0, in which case this address is not valid and should not be used.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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