componentconfigs

package
v1.16.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Codecs provides access to encoding and decoding for the scheme.

View Source
var Scheme = runtime.NewScheme()

Scheme is the runtime.Scheme to which all supported kubeadm ComponentConfig API types are registered.

Functions

func AddToScheme

func AddToScheme(scheme *runtime.Scheme)

AddToScheme builds the kubeadm ComponentConfig scheme using all known ComponentConfig versions.

func DefaultKubeProxyConfiguration

func DefaultKubeProxyConfiguration(internalcfg *kubeadmapi.ClusterConfiguration)

DefaultKubeProxyConfiguration assigns default values for the kube-proxy ComponentConfig

func DefaultKubeletConfiguration

func DefaultKubeletConfiguration(internalcfg *kubeadmapi.ClusterConfiguration)

DefaultKubeletConfiguration assigns default values for the kubelet ComponentConfig

func GetFromKubeProxyConfigMap

func GetFromKubeProxyConfigMap(client clientset.Interface, version *version.Version) (runtime.Object, error)

GetFromKubeProxyConfigMap returns the pointer to the ComponentConfig API object read from the kube-proxy ConfigMap map stored in the cluster

func GetFromKubeletConfigMap

func GetFromKubeletConfigMap(client clientset.Interface, version *version.Version) (runtime.Object, error)

GetFromKubeletConfigMap returns the pointer to the ComponentConfig API object read from the kubelet-config-version ConfigMap map stored in the cluster

func ValidateKubeProxyConfiguration

func ValidateKubeProxyConfiguration(internalcfg *kubeadmapi.ClusterConfiguration, _ *field.Path) field.ErrorList

ValidateKubeProxyConfiguration validates proxy configuration and collects all encountered errors

func ValidateKubeletConfiguration

func ValidateKubeletConfiguration(internalcfg *kubeadmapi.ClusterConfiguration, fldPath *field.Path) field.ErrorList

ValidateKubeletConfiguration validates kubelet configuration and collects all encountered errors

Types

type AddToSchemeFunc

type AddToSchemeFunc func(*runtime.Scheme) error

AddToSchemeFunc is a function that adds known types and API GroupVersions to a scheme

type Registration

type Registration struct {
	// MarshalGroupVersion is the preferred external API version to use when marshalling the ComponentConfig
	MarshalGroupVersion schema.GroupVersion
	// AddToSchemeFuncs are a set of functions that register APIs to the scheme
	AddToSchemeFuncs []AddToSchemeFunc
	// DefaulterFunc is a function that based on the internal kubeadm configuration defaults the ComponentConfig struct
	DefaulterFunc func(*kubeadmapi.ClusterConfiguration)
	// ValidateFunc is a function that should validate the ComponentConfig type embedded in the internal kubeadm config struct
	ValidateFunc func(*kubeadmapi.ClusterConfiguration, *field.Path) field.ErrorList
	// EmptyValue holds a pointer to an empty struct of the internal ComponentConfig type
	EmptyValue runtime.Object
	// GetFromInternalConfig returns the pointer to the ComponentConfig API object from the internal kubeadm config struct
	GetFromInternalConfig func(*kubeadmapi.ClusterConfiguration) (runtime.Object, bool)
	// SetToInternalConfig sets the pointer to a ComponentConfig API object embedded in the internal kubeadm config struct
	SetToInternalConfig func(runtime.Object, *kubeadmapi.ClusterConfiguration) bool
	// GetFromConfigMap returns the pointer to the ComponentConfig API object read from the config map stored in the cluster
	GetFromConfigMap func(clientset.Interface, *version.Version) (runtime.Object, error)
}

Registration is an object for registering a Kubernetes ComponentConfig type to be recognized and handled by kubeadm

func (Registration) Marshal

func (r Registration) Marshal(obj runtime.Object) ([]byte, error)

Marshal marshals obj to bytes for the current Registration

func (Registration) Unmarshal

func (r Registration) Unmarshal(fileContent []byte) (runtime.Object, error)

Unmarshal unmarshals the bytes to a runtime.Object using the Codecs registered in this Scheme

type RegistrationKind

type RegistrationKind string

RegistrationKind is a string type to ensure not any string can be a key in the Registrations map

const (
	// KubeletConfigurationKind is the kind for the kubelet ComponentConfig
	KubeletConfigurationKind RegistrationKind = "KubeletConfiguration"
	// KubeProxyConfigurationKind is the kind for the kubelet ComponentConfig
	KubeProxyConfigurationKind RegistrationKind = "KubeProxyConfiguration"
)

type Registrations

type Registrations map[RegistrationKind]Registration

Registrations holds a set of ComponentConfig Registration objects, where the map key is the kind

var Known Registrations = map[RegistrationKind]Registration{
	KubeProxyConfigurationKind: {

		MarshalGroupVersion: kubeproxyconfigv1alpha1.SchemeGroupVersion,

		AddToSchemeFuncs: []AddToSchemeFunc{kubeproxyconfig.AddToScheme, kubeproxyconfigv1alpha1scheme.AddToScheme},
		DefaulterFunc:    DefaultKubeProxyConfiguration,
		ValidateFunc:     ValidateKubeProxyConfiguration,
		EmptyValue:       &kubeproxyconfig.KubeProxyConfiguration{},
		GetFromInternalConfig: func(cfg *kubeadmapi.ClusterConfiguration) (runtime.Object, bool) {
			return cfg.ComponentConfigs.KubeProxy, cfg.ComponentConfigs.KubeProxy != nil
		},
		SetToInternalConfig: func(obj runtime.Object, cfg *kubeadmapi.ClusterConfiguration) bool {
			kubeproxyConfig, ok := obj.(*kubeproxyconfig.KubeProxyConfiguration)
			if ok {
				cfg.ComponentConfigs.KubeProxy = kubeproxyConfig
			}
			return ok
		},
		GetFromConfigMap: GetFromKubeProxyConfigMap,
	},
	KubeletConfigurationKind: {
		MarshalGroupVersion: kubeletconfigv1beta1.SchemeGroupVersion,

		AddToSchemeFuncs: []AddToSchemeFunc{kubeletconfig.AddToScheme, kubeletconfigv1beta1scheme.AddToScheme},
		DefaulterFunc:    DefaultKubeletConfiguration,
		ValidateFunc:     ValidateKubeletConfiguration,
		EmptyValue:       &kubeletconfig.KubeletConfiguration{},
		GetFromInternalConfig: func(cfg *kubeadmapi.ClusterConfiguration) (runtime.Object, bool) {
			return cfg.ComponentConfigs.Kubelet, cfg.ComponentConfigs.Kubelet != nil
		},
		SetToInternalConfig: func(obj runtime.Object, cfg *kubeadmapi.ClusterConfiguration) bool {
			kubeletConfig, ok := obj.(*kubeletconfig.KubeletConfiguration)
			if ok {
				cfg.ComponentConfigs.Kubelet = kubeletConfig
			}
			return ok
		},
		GetFromConfigMap: GetFromKubeletConfigMap,
	},
}

Known contains the known ComponentConfig registrations to kubeadm

func (*Registrations) AddToScheme

func (rs *Registrations) AddToScheme(scheme *runtime.Scheme) error

AddToScheme adds all the known ComponentConfig API types referenced in the Registrations object to the scheme

func (*Registrations) Default

func (rs *Registrations) Default(internalcfg *kubeadmapi.ClusterConfiguration)

Default applies to the ComponentConfig defaults to the internal kubeadm API type

func (*Registrations) Validate

func (rs *Registrations) Validate(internalcfg *kubeadmapi.ClusterConfiguration) field.ErrorList

Validate validates the ComponentConfig parts of the internal kubeadm API type

Jump to

Keyboard shortcuts

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