kubernetes

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KubeletCertAndKeyDir defines kubelet's CA certificate and key directory
	KubeletCertAndKeyDir = "/var/lib/kubelet/pki"

	// KubeletCACertAndKeyBaseName defines kubelet's CA certificate and key base name
	KubeletCACertAndKeyBaseName = "kubelet-ca"
	// KubeletCACertName defines kubelet's CA certificate name
	KubeletCACertName = "kubelet-ca.crt"
	// KubeletCAKeyName defines kubelet's CA key name
	KubeletCAKeyName = "kubelet-ca.key"

	// KubeletServerCertAndKeyBaseName defines kubelet server certificate and key base name
	KubeletServerCertAndKeyBaseName = "kubelet"
	// KubeletServerCertName defines kubelet server certificate name
	KubeletServerCertName = "kubelet.crt"
	// KubeletServerKeyName defines kubelet server key name
	KubeletServerKeyName = "kubelet.key"
)
View Source
const (
	Cilium  Addon = "cilium"
	Kured   Addon = "kured"
	Dex     Addon = "dex"
	Gangway Addon = "gangway"
	PSP     Addon = "psp"

	Kubelet          Component = "kubelet"
	ContainerRuntime Component = "cri-o"

	Hyperkube Component = "hyperkube"
	Etcd      Component = "etcd"
	CoreDNS   Component = "coredns"
	Pause     Component = "pause"

	Tooling Component = "tooling"
)
View Source
const (
	// TimeoutWaitForJob is the default seconds to wait for a new job to reach state succeeded
	TimeoutWaitForJob int = 300
)

Variables

This section is empty.

Functions

func AllControlPlanesMatchVersion added in v0.7.0

func AllControlPlanesMatchVersion(client clientset.Interface, clusterVersion *version.Version) (bool, error)

AllControlPlanesMatchVersion checks that all control planes are on the same version, and that they match a cluster version

func AllControlPlanesMatchVersionWithVersioningInfo added in v0.7.0

func AllControlPlanesMatchVersionWithVersioningInfo(allNodesVersioningInfo NodeVersionInfoMap, clusterVersion *version.Version) bool

AllControlPlanesMatchVersionWithVersioningInfo checks that all control planes are on the same version, and that they match a cluster version With the addition of passing in a NodeVersionInfoMap to make it easily testable

func AllNodesMatchClusterVersionWithVersioningInfo added in v1.0.0

func AllNodesMatchClusterVersionWithVersioningInfo(allNodesVersioningInfo NodeVersionInfoMap, clusterVersion *version.Version) bool

AllNodesMatchVersionWithVersioningInfo returns if all nodes match a specific kubernetes version This can be used to determine e.g. if an upgrade is ongoing

func AllWorkerNodesTolerateVersion added in v0.7.0

func AllWorkerNodesTolerateVersion(client clientset.Interface, clusterVersion *version.Version) (bool, error)

AllWorkerNodesTolerateVersion checks that all schedulable worker nodes tolerate the given cluster version

func AvailableVersions added in v0.7.0

func AvailableVersions() []*version.Version

AvailableVersions return the list of platform versions known to skuba

func AvailableVersionsForMap added in v0.7.0

func AvailableVersionsForMap(versions KubernetesVersions) []*version.Version

func ComponentContainerImageForClusterVersion added in v1.1.1

func ComponentContainerImageForClusterVersion(component Component, clusterVersion *version.Version) string

func ComponentContainerImageWithAvailableVersions added in v1.1.1

func ComponentContainerImageWithAvailableVersions(component Component, clusterVersion *version.Version, availableVersions KubernetesVersions) string

func ComponentVersionForClusterVersion added in v0.7.0

func ComponentVersionForClusterVersion(component Component, clusterVersion *version.Version) string

func ComponentVersionWithAvailableVersions added in v0.7.0

func ComponentVersionWithAvailableVersions(component Component, clusterVersion *version.Version, availableVersions KubernetesVersions) string

func CreateAndWaitForJob

func CreateAndWaitForJob(client clientset.Interface, name string, spec batchv1.JobSpec, timeout int) error

CreateAndWaitForJob creates job and wait until discover job status active, succeeded or timeout

func CreateJob

func CreateJob(client clientset.Interface, name string, spec batchv1.JobSpec) (*batchv1.Job, error)

CreateJob creates job in namespace kube-system. Returns job and error

func DeleteJob

func DeleteJob(client clientset.Interface, name string) error

DeleteJob deletes job with given name. Returns error

func DisarmKubelet

func DisarmKubelet(client clientset.Interface, node *v1.Node, clusterVersion *version.Version) error

func DoesResourceExistWithError added in v1.1.0

func DoesResourceExistWithError(err error) (bool, error)

DoesResourceExistWithError check the given error from a client-go API call and returns whether the resource exists. If no error was given, it will return true, if the given error was a `IsNotFound` it will return false; otherwise it will return an error

func DrainNode

func DrainNode(client clientset.Interface, node *corev1.Node, drainTimeout time.Duration) error

DrainNode cordons, drains and evict given node.

func GenerateKubeletRootCert added in v1.2.2

func GenerateKubeletRootCert() error

GenerateKubeletRootCert generates kubelet root CA certificate and key and save the generated file locally.

func GetAdminClientSet

func GetAdminClientSet() (clientset.Interface, error)

func GetAllNodes added in v1.2.2

func GetAllNodes(client clientset.Interface) (*corev1.NodeList, error)

GetAllNodes returns the list of nodes

func GetControlPlaneNodes added in v0.7.0

func GetControlPlaneNodes(client clientset.Interface) (*corev1.NodeList, error)

GetControlPlaneNodes returns the list of master nodes by matching "node-role.kubernetes.io/master" label.

func GetNodeWithMachineID added in v1.2.2

func GetNodeWithMachineID(client clientset.Interface, machineID string) (*corev1.Node, error)

GetNodeWithMachineID returns the node matching machine ID.

func HostMount

func HostMount(name, mount string) v1.Volume

func IsControlPlane added in v0.7.0

func IsControlPlane(node *corev1.Node) bool

IsControlPlane check if given node is master node.

func IsVersionAvailable added in v0.8.0

func IsVersionAvailable(kubernetesVersion *version.Version) bool

IsVersionAvailable returns if a specific kubernetes version is available

func LatestVersion added in v0.7.0

func LatestVersion() *version.Version

LatestVersion return the latest Kubernetes supported version

func MajorMinorVersion added in v0.8.0

func MajorMinorVersion(kubernetesVersion *version.Version) string

MajorMinorVersion returns a KubernetesVersion without the patch level

func VolumeMount

func VolumeMount(name, mount string, mode VolumeMountMode) v1.VolumeMount

Types

type Addon

type Addon string

type AddonVersion added in v1.1.0

type AddonVersion struct {
	Version         string
	ManifestVersion uint
}

func AddonVersionForClusterVersion added in v1.1.0

func AddonVersionForClusterVersion(addon Addon, clusterVersion *version.Version) *AddonVersion

func AddonVersionWithAvailableVersions added in v1.1.0

func AddonVersionWithAvailableVersions(addon Addon, clusterVersion *version.Version, availableVersions KubernetesVersions) *AddonVersion

type AddonsVersion

type AddonsVersion map[Addon]*AddonVersion

func AllAddonVersionsForClusterVersion added in v1.1.1

func AllAddonVersionsForClusterVersion(clusterVersion *version.Version) AddonsVersion

type ClusterAddonsKnownVersions added in v1.3.1

type ClusterAddonsKnownVersions = func(clusterVersion *version.Version) AddonsVersion

type Component

type Component string

func AllComponentContainerImagesForClusterVersion added in v1.1.1

func AllComponentContainerImagesForClusterVersion(clusterVersion *version.Version) []Component

func AllComponentContainerImagesWithAvailableVersions added in v1.1.1

func AllComponentContainerImagesWithAvailableVersions(clusterVersion *version.Version, availableVersions KubernetesVersions) []Component

type ComponentContainerVersion added in v1.1.1

type ComponentContainerVersion map[Component]*ContainerImageTag

type ComponentHostVersion added in v1.1.1

type ComponentHostVersion struct {
	KubeletVersion          string
	ContainerRuntimeVersion string
}

type ContainerImageTag added in v1.1.1

type ContainerImageTag struct {
	Name string
	Tag  string
}

type KubernetesVersion

type KubernetesVersion struct {
	ComponentHostVersion      ComponentHostVersion
	ComponentContainerVersion ComponentContainerVersion
	AddonsVersion             AddonsVersion
}

type KubernetesVersions added in v0.7.0

type KubernetesVersions map[string]KubernetesVersion

type NodeVersionInfo added in v0.7.0

type NodeVersionInfo struct {
	Node                     *v1.Node
	ContainerRuntimeVersion  *version.Version
	KubeletVersion           *version.Version
	APIServerVersion         *version.Version
	ControllerManagerVersion *version.Version
	SchedulerVersion         *version.Version
	EtcdVersion              *version.Version
}

func (NodeVersionInfo) DriftsFromClusterVersion added in v0.7.0

func (nvi NodeVersionInfo) DriftsFromClusterVersion(clusterVersion *version.Version) bool

func (NodeVersionInfo) EqualsClusterVersion added in v0.7.0

func (nvi NodeVersionInfo) EqualsClusterVersion(clusterVersion *version.Version) bool

func (NodeVersionInfo) IsControlPlane added in v0.7.0

func (nvi NodeVersionInfo) IsControlPlane() bool

func (NodeVersionInfo) LessThanClusterVersion added in v0.7.0

func (nvi NodeVersionInfo) LessThanClusterVersion(clusterVersion *version.Version) bool

func (NodeVersionInfo) String added in v0.7.0

func (nvi NodeVersionInfo) String() string

func (NodeVersionInfo) ToleratesClusterVersion added in v0.7.0

func (nvi NodeVersionInfo) ToleratesClusterVersion(clusterVersion *version.Version) bool

func (NodeVersionInfo) Unschedulable added in v0.7.0

func (nvi NodeVersionInfo) Unschedulable() bool

type NodeVersionInfoMap added in v0.7.0

type NodeVersionInfoMap map[string]NodeVersionInfo

func AllNodesVersioningInfo added in v0.7.0

func AllNodesVersioningInfo(client clientset.Interface) (NodeVersionInfoMap, error)

AllNodesVersioningInfo returns the version info for all nodes in the cluster

type StaticVersionInquirer added in v0.7.0

type StaticVersionInquirer struct{}

func (StaticVersionInquirer) AvailablePlatformVersions added in v0.7.0

func (si StaticVersionInquirer) AvailablePlatformVersions() []*version.Version

func (StaticVersionInquirer) NodeVersionInfoForClusterVersion added in v0.7.0

func (si StaticVersionInquirer) NodeVersionInfoForClusterVersion(node *v1.Node, clusterVersion *version.Version) NodeVersionInfo

type VersionInquirer added in v0.7.0

type VersionInquirer interface {
	AvailablePlatformVersions() []*version.Version
	NodeVersionInfoForClusterVersion(node *v1.Node, version *version.Version) NodeVersionInfo
}

type VolumeMountMode

type VolumeMountMode uint
const (
	VolumeMountReadOnly  VolumeMountMode = iota
	VolumeMountReadWrite VolumeMountMode = iota
)

Jump to

Keyboard shortcuts

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