kubernetes: k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade Index | Files

package upgrade

import "k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade"

Index

Package Files

compute.go health.go policy.go postupgrade.go preflight.go prepull.go staticpods.go versiongetter.go

Constants

const (
    // MaximumAllowedMinorVersionUpgradeSkew describes how many minor versions kubeadm can upgrade the control plane version in one go
    MaximumAllowedMinorVersionUpgradeSkew = 1

    // MaximumAllowedMinorVersionDowngradeSkew describes how many minor versions kubeadm can upgrade the control plane version in one go
    MaximumAllowedMinorVersionDowngradeSkew = 1

    // MaximumAllowedMinorVersionKubeletSkew describes how many minor versions the control plane version and the kubelet can skew in a kubeadm cluster
    MaximumAllowedMinorVersionKubeletSkew = 1
)
const (
    // UpgradeManifestTimeout is timeout of upgrading the static pod manifest
    UpgradeManifestTimeout = 5 * time.Minute
)

func CheckClusterHealth Uses

func CheckClusterHealth(client clientset.Interface, ignoreChecksErrors sets.String) error

CheckClusterHealth makes sure: - the API /healthz endpoint is healthy - all control-plane Nodes are Ready - (if self-hosted) that there are DaemonSets with at least one Pod for all control plane components - (if static pod-hosted) that all required Static Pod manifests exist on disk

func DryRunStaticPodUpgrade Uses

func DryRunStaticPodUpgrade(kustomizeDir string, internalcfg *kubeadmapi.InitConfiguration) error

DryRunStaticPodUpgrade fakes an upgrade of the control plane

func GetKubeletDir Uses

func GetKubeletDir(dryRun bool) (string, error)

GetKubeletDir gets the kubelet directory based on whether the user is dry-running this command or not.

func IsControlPlaneSelfHosted Uses

func IsControlPlaneSelfHosted(client clientset.Interface) bool

IsControlPlaneSelfHosted returns whether the control plane is self hosted or not

func PerformPostUpgradeTasks Uses

func PerformPostUpgradeTasks(client clientset.Interface, cfg *kubeadmapi.InitConfiguration, newK8sVer *version.Version, dryRun bool) error

PerformPostUpgradeTasks runs nearly the same functions as 'kubeadm init' would do Note that the mark-control-plane phase is left out, not needed, and no token is created as that doesn't belong to the upgrade

func PerformStaticPodUpgrade Uses

func PerformStaticPodUpgrade(client clientset.Interface, waiter apiclient.Waiter, internalcfg *kubeadmapi.InitConfiguration, etcdUpgrade, renewCerts bool, kustomizeDir string) error

PerformStaticPodUpgrade performs the upgrade of the control plane components for a static pod hosted cluster

func PrepullImagesInParallel Uses

func PrepullImagesInParallel(kubePrepuller Prepuller, timeout time.Duration, componentsToPrepull []string) error

PrepullImagesInParallel creates DaemonSets synchronously but waits in parallel for the images to pull

func RunCoreDNSMigrationCheck Uses

func RunCoreDNSMigrationCheck(client clientset.Interface, ignorePreflightErrors sets.String, dnsType kubeadmapi.DNSAddOnType) error

RunCoreDNSMigrationCheck initializes checks related to CoreDNS migration.

func StaticPodControlPlane Uses

func StaticPodControlPlane(client clientset.Interface, waiter apiclient.Waiter, pathMgr StaticPodPathManager, cfg *kubeadmapi.InitConfiguration, etcdUpgrade, renewCerts bool, oldEtcdClient, newEtcdClient etcdutil.ClusterInterrogator) error

StaticPodControlPlane upgrades a static pod-hosted control plane

type ClusterState Uses

type ClusterState struct {
    // KubeVersion describes the version of the Kubernetes API Server, Controller Manager, Scheduler and Proxy.
    KubeVersion string
    // DNSType describes the type of DNS add-on used in the cluster.
    DNSType kubeadmapi.DNSAddOnType
    // DNSVersion describes the version of the DNS add-on.
    DNSVersion string
    // KubeadmVersion describes the version of the kubeadm CLI
    KubeadmVersion string
    // KubeletVersions is a map with a version number linked to the amount of kubelets running that version in the cluster
    KubeletVersions map[string]uint16
    // EtcdVersion represents the version of etcd used in the cluster
    EtcdVersion string
}

ClusterState describes the state of certain versions for a cluster

type CoreDNSCheck Uses

type CoreDNSCheck struct {
    // contains filtered or unexported fields
}

CoreDNSCheck validates installed kubelet version

func (CoreDNSCheck) Check Uses

func (c CoreDNSCheck) Check() (warnings, errors []error)

Check is part of the preflight.Checker interface

func (CoreDNSCheck) Name Uses

func (c CoreDNSCheck) Name() string

Name is part of the preflight.Checker interface

type DaemonSetPrepuller Uses

type DaemonSetPrepuller struct {
    // contains filtered or unexported fields
}

DaemonSetPrepuller makes sure the control-plane images are available on all control-planes

func NewDaemonSetPrepuller Uses

func NewDaemonSetPrepuller(client clientset.Interface, waiter apiclient.Waiter, cfg *kubeadmapi.ClusterConfiguration) *DaemonSetPrepuller

NewDaemonSetPrepuller creates a new instance of the DaemonSetPrepuller struct

func (*DaemonSetPrepuller) CreateFunc Uses

func (d *DaemonSetPrepuller) CreateFunc(component string) error

CreateFunc creates a DaemonSet for making the image available on every relevant node

func (*DaemonSetPrepuller) DeleteFunc Uses

func (d *DaemonSetPrepuller) DeleteFunc(component string) error

DeleteFunc deletes the DaemonSet used for making the image available on every relevant node

func (*DaemonSetPrepuller) WaitFunc Uses

func (d *DaemonSetPrepuller) WaitFunc(component string)

WaitFunc waits for all Pods in the specified DaemonSet to be in the Running state

type KubeStaticPodPathManager Uses

type KubeStaticPodPathManager struct {
    // contains filtered or unexported fields
}

KubeStaticPodPathManager is a real implementation of StaticPodPathManager that is used when upgrading a static pod cluster

func (*KubeStaticPodPathManager) BackupEtcdDir Uses

func (spm *KubeStaticPodPathManager) BackupEtcdDir() string

BackupEtcdDir should point to the backup directory used for backuping manifests during the transition

func (*KubeStaticPodPathManager) BackupManifestDir Uses

func (spm *KubeStaticPodPathManager) BackupManifestDir() string

BackupManifestDir should point to the backup directory used for backuping manifests during the transition

func (*KubeStaticPodPathManager) BackupManifestPath Uses

func (spm *KubeStaticPodPathManager) BackupManifestPath(component string) string

BackupManifestPath gets the file path for the component in the backup directory used for backuping manifests during the transition

func (*KubeStaticPodPathManager) CleanupDirs Uses

func (spm *KubeStaticPodPathManager) CleanupDirs() error

CleanupDirs cleans up all temporary directories except those the user has requested to keep around

func (*KubeStaticPodPathManager) KubernetesDir Uses

func (spm *KubeStaticPodPathManager) KubernetesDir() string

KubernetesDir should point to the directory Kubernetes owns for storing various configuration files

func (*KubeStaticPodPathManager) KustomizeDir Uses

func (spm *KubeStaticPodPathManager) KustomizeDir() string

KustomizeDir should point to the folder where kustomize patches for static pod manifest are stored

func (*KubeStaticPodPathManager) MoveFile Uses

func (spm *KubeStaticPodPathManager) MoveFile(oldPath, newPath string) error

MoveFile should move a file from oldPath to newPath

func (*KubeStaticPodPathManager) RealManifestDir Uses

func (spm *KubeStaticPodPathManager) RealManifestDir() string

RealManifestDir should point to the static pod manifest directory used by the kubelet

func (*KubeStaticPodPathManager) RealManifestPath Uses

func (spm *KubeStaticPodPathManager) RealManifestPath(component string) string

RealManifestPath gets the file path for the component in the "real" static pod manifest directory used by the kubelet

func (*KubeStaticPodPathManager) TempManifestDir Uses

func (spm *KubeStaticPodPathManager) TempManifestDir() string

TempManifestDir should point to the temporary directory created for generating new manifests for the upgrade

func (*KubeStaticPodPathManager) TempManifestPath Uses

func (spm *KubeStaticPodPathManager) TempManifestPath(component string) string

TempManifestPath gets the file path for the component in the temporary directory created for generating new manifests for the upgrade

type KubeVersionGetter Uses

type KubeVersionGetter struct {
    // contains filtered or unexported fields
}

KubeVersionGetter handles the version-fetching mechanism from external sources

func (*KubeVersionGetter) ClusterVersion Uses

func (g *KubeVersionGetter) ClusterVersion() (string, *versionutil.Version, error)

ClusterVersion gets API server version

func (*KubeVersionGetter) KubeadmVersion Uses

func (g *KubeVersionGetter) KubeadmVersion() (string, *versionutil.Version, error)

KubeadmVersion gets kubeadm version

func (*KubeVersionGetter) KubeletVersions Uses

func (g *KubeVersionGetter) KubeletVersions() (map[string]uint16, error)

KubeletVersions gets the versions of the kubelets in the cluster

func (*KubeVersionGetter) VersionFromCILabel Uses

func (g *KubeVersionGetter) VersionFromCILabel(ciVersionLabel, description string) (string, *versionutil.Version, error)

VersionFromCILabel resolves a version label like "latest" or "stable" to an actual version using the public Kubernetes CI uploads

type OfflineVersionGetter Uses

type OfflineVersionGetter struct {
    VersionGetter
    // contains filtered or unexported fields
}

OfflineVersionGetter will use the version provided or

func (*OfflineVersionGetter) VersionFromCILabel Uses

func (o *OfflineVersionGetter) VersionFromCILabel(ciVersionLabel, description string) (string, *versionutil.Version, error)

VersionFromCILabel will return the version that was passed into the struct

type Prepuller Uses

type Prepuller interface {
    CreateFunc(string) error
    WaitFunc(string)
    DeleteFunc(string) error
}

Prepuller defines an interface for performing a prepull operation in a create-wait-delete fashion in parallel

type StaticPodPathManager Uses

type StaticPodPathManager interface {
    // MoveFile should move a file from oldPath to newPath
    MoveFile(oldPath, newPath string) error
    // KubernetesDir is the directory Kubernetes owns for storing various configuration files
    KubernetesDir() string
    // KustomizeDir should point to the folder where kustomize patches for static pod manifest are stored
    KustomizeDir() string
    // RealManifestPath gets the file path for the component in the "real" static pod manifest directory used by the kubelet
    RealManifestPath(component string) string
    // RealManifestDir should point to the static pod manifest directory used by the kubelet
    RealManifestDir() string
    // TempManifestPath gets the file path for the component in the temporary directory created for generating new manifests for the upgrade
    TempManifestPath(component string) string
    // TempManifestDir should point to the temporary directory created for generating new manifests for the upgrade
    TempManifestDir() string
    // BackupManifestPath gets the file path for the component in the backup directory used for backuping manifests during the transition
    BackupManifestPath(component string) string
    // BackupManifestDir should point to the backup directory used for backuping manifests during the transition
    BackupManifestDir() string
    // BackupEtcdDir should point to the backup directory used for backuping manifests during the transition
    BackupEtcdDir() string
    // CleanupDirs cleans up all temporary directories
    CleanupDirs() error
}

StaticPodPathManager is responsible for tracking the directories used in the static pod upgrade transition

func GetPathManagerForUpgrade Uses

func GetPathManagerForUpgrade(kubernetesDir, kustomizeDir string, internalcfg *kubeadmapi.InitConfiguration, etcdUpgrade bool) (StaticPodPathManager, error)

GetPathManagerForUpgrade returns a path manager properly configured for the given InitConfiguration.

func NewKubeStaticPodPathManager Uses

func NewKubeStaticPodPathManager(kubernetesDir, kustomizeDir, tempDir, backupDir, backupEtcdDir string, keepManifestDir, keepEtcdDir bool) StaticPodPathManager

NewKubeStaticPodPathManager creates a new instance of KubeStaticPodPathManager

func NewKubeStaticPodPathManagerUsingTempDirs Uses

func NewKubeStaticPodPathManagerUsingTempDirs(kubernetesDir, kustomizeDir string, saveManifestsDir, saveEtcdDir bool) (StaticPodPathManager, error)

NewKubeStaticPodPathManagerUsingTempDirs creates a new instance of KubeStaticPodPathManager with temporary directories backing it

type Upgrade Uses

type Upgrade struct {
    Description string
    Before      ClusterState
    After       ClusterState
}

Upgrade defines an upgrade possibility to upgrade from a current version to a new one

func GetAvailableUpgrades Uses

func GetAvailableUpgrades(versionGetterImpl VersionGetter, experimentalUpgradesAllowed, rcUpgradesAllowed bool, etcdClient etcdutil.ClusterInterrogator, dnsType kubeadmapi.DNSAddOnType, client clientset.Interface) ([]Upgrade, error)

GetAvailableUpgrades fetches all versions from the specified VersionGetter and computes which kinds of upgrades can be performed

func (*Upgrade) CanUpgradeEtcd Uses

func (u *Upgrade) CanUpgradeEtcd() bool

CanUpgradeEtcd returns whether an upgrade of etcd is possible

func (*Upgrade) CanUpgradeKubelets Uses

func (u *Upgrade) CanUpgradeKubelets() bool

CanUpgradeKubelets returns whether an upgrade of any kubelet in the cluster is possible

type VersionGetter Uses

type VersionGetter interface {
    // ClusterVersion should return the version of the cluster i.e. the API Server version
    ClusterVersion() (string, *versionutil.Version, error)
    // KubeadmVersion should return the version of the kubeadm CLI
    KubeadmVersion() (string, *versionutil.Version, error)
    // VersionFromCILabel should resolve CI labels like `latest`, `stable`, `stable-1.8`, etc. to real versions
    VersionFromCILabel(string, string) (string, *versionutil.Version, error)
    // KubeletVersions should return a map with a version and a number that describes how many kubelets there are for that version
    KubeletVersions() (map[string]uint16, error)
}

VersionGetter defines an interface for fetching different versions. Easy to implement a fake variant of this interface for unit testing

func NewKubeVersionGetter Uses

func NewKubeVersionGetter(client clientset.Interface, writer io.Writer) VersionGetter

NewKubeVersionGetter returns a new instance of KubeVersionGetter

func NewOfflineVersionGetter Uses

func NewOfflineVersionGetter(versionGetter VersionGetter, version string) VersionGetter

NewOfflineVersionGetter wraps a VersionGetter and skips online communication if default information is supplied. Version can be "" and the behavior will be identical to the versionGetter passed in.

type VersionSkewPolicyErrors Uses

type VersionSkewPolicyErrors struct {
    Mandatory []error
    Skippable []error
}

VersionSkewPolicyErrors describes version skew errors that might be seen during the validation process in EnforceVersionPolicies

func EnforceVersionPolicies Uses

func EnforceVersionPolicies(versionGetter VersionGetter, newK8sVersionStr string, newK8sVersion *version.Version, allowExperimentalUpgrades, allowRCUpgrades bool) *VersionSkewPolicyErrors

EnforceVersionPolicies enforces that the proposed new version is compatible with all the different version skew policies

Package upgrade imports 41 packages (graph) and is imported by 7 packages. Updated 2019-10-05. Refresh now. Tools for package owners.