upgrade

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ControlPlaneScope      = "control-plane"
	MachineDeploymentScope = "machine-deployment"
)
View Source
const (

	// UpgradeIDAnnotationKey is the annotation key for this tool's upgrade-id
	UpgradeIDAnnotationKey = "upgrade-id"
)

Variables

This section is empty.

Functions

func NewRestConfigFromCAClusterField

func NewRestConfigFromCAClusterField(cluster *clusterv1alpha1.Cluster, fieldPath, apiEndpoint string) (*rest.Config, error)

NewRestConfigFromCAClusterField returns a rest.Config configured with the CA key pair found in the cluster's object in the fieldpath specified. For example, "spec.providerSpec.value.caKeyPair" traverses the cluster object going through each '.' delimited field.

func NewRestConfigFromCASecretRef

func NewRestConfigFromCASecretRef(secretClient secrets, name, clusterName, apiEndpoint string) (*rest.Config, error)

NewRestConfigFromCASecretRef gets the CA key pair from the secret and builds a *rest.Config with them.

func NewRestConfigFromKubeconfigSecretRef

func NewRestConfigFromKubeconfigSecretRef(secrets secrets, name string) (*rest.Config, error)

NewRestConfigFromKubeconfigSecretRef decodes the kubeconfig stored in a secret and builds a *rest.Config with it.

func ValidateArgs

func ValidateArgs(config Config) error

ValidateArgs validates the configuration passed in and returns the first validation error encountered.

Types

type Config

type Config struct {
	ManagementCluster ManagementClusterConfig `json:"managementCluster"`
	TargetCluster     TargetClusterConfig     `json:"targetCluster"`
	MachineUpdates    MachineUpdateConfig     `json:"machineUpdates"`
	KubernetesVersion string                  `json:"kubernetesVersion"`
	UpgradeID         string                  `json:"upgradeID"`
}

Config contains all the configurations necessary to upgrade a Kubernetes cluster.

type ControlPlaneUpgrader

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

func NewControlPlaneUpgrader

func NewControlPlaneUpgrader(log logr.Logger, config Config) (*ControlPlaneUpgrader, error)

func (ControlPlaneUpgrader) GetNodeFromProviderID

func (u ControlPlaneUpgrader) GetNodeFromProviderID(providerID string) *v1.Node

func (ControlPlaneUpgrader) UpdateProviderIDsToNodes

func (u ControlPlaneUpgrader) UpdateProviderIDsToNodes() error

UpdateProviderIDsToNodes retrieves a map that pairs a providerID to the node by listing all Nodes providerID : Node

func (*ControlPlaneUpgrader) Upgrade

func (u *ControlPlaneUpgrader) Upgrade() error

Upgrade does the upgrading of the control plane.

type ImageUpdateConfig

type ImageUpdateConfig struct {
	ID    string `json:"id"`
	Field string `json:"field"`
}

ImageUpdateConfig is something

type KeyPairConfig

type KeyPairConfig struct {
	SecretRef           string `json:"secretRef,omitempty"`
	ClusterField        string `json:"clusterField,omitempty"`
	KubeconfigSecretRef string `json:"kubeconfigSecretRef,omitempty"`

	// APIEndpoint is a URL to a kube-apiserver.
	// This entry is used only if SecretRef or ClusterField is set.
	// APIEndpoint is ignored if KubeconfigSecretRef is set.
	APIEndpoint string `json:"apiEndpoint"`
}

KeyPairConfig is something

type MachineCreator

type MachineCreator struct {
	MachineOptions MachineOptions
	// contains filtered or unexported fields
}

MachineCreator is responsible for creating a new machine. It can optionally wait for the associated node to become ready.

func NewMachineCreator

func NewMachineCreator(options ...MachineCreatorOption) *MachineCreator

NewMachineCreator takes a list of option functions to configure the MachineCreator.

func (*MachineCreator) NewMachine

NewMachine is the main interface to MachineCreator. It creates a machine object on the management cluster and optionally waits for the backing node to become ready.

type MachineCreatorOption

type MachineCreatorOption func(*MachineCreator)

MachineCreatorOptions are the functional options for the MachineCreator.

func ShouldWaitForMatchingNode

func ShouldWaitForMatchingNode(should bool) MachineCreatorOption

ShouldWaitForMatchingNode allows the MachineCreator to skip waiting for the backing node to a machine to appearn

func ShouldWaitForNodeReady

func ShouldWaitForNodeReady(should bool) MachineCreatorOption

ShouldWaitForNodeReady allows the MachineCreator to skip waiting for the backing node to become ready.

func ShouldWaitForProviderID

func ShouldWaitForProviderID(should bool) MachineCreatorOption

ShouldWaitForProviderID allows the MachineCreator to skip waiting for the ProviderID to appear on the Machine.

func WithLogger

func WithLogger(l logr.Logger) MachineCreatorOption

func WithMachineCreator

func WithMachineCreator(mc machineCreator) MachineCreatorOption

func WithMachineGetter

func WithMachineGetter(mg machineGetter) MachineCreatorOption

func WithMachineOptions

func WithMachineOptions(mo MachineOptions) MachineCreatorOption

func WithMatchingNodeTimeout

func WithMatchingNodeTimeout(timeout time.Duration) MachineCreatorOption

func WithNodeLister

func WithNodeLister(nl nodeLister) MachineCreatorOption

func WithNodeReadyTimeout

func WithNodeReadyTimeout(timeout time.Duration) MachineCreatorOption

func WithPodGetter

func WithPodGetter(pg podGetter) MachineCreatorOption

func WithProviderIDTimeout

func WithProviderIDTimeout(timeout time.Duration) MachineCreatorOption

type MachineDeploymentUpgrader

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

func NewMachineDeploymentUpgrader

func NewMachineDeploymentUpgrader(log logr.Logger, config Config) (*MachineDeploymentUpgrader, error)

func (MachineDeploymentUpgrader) GetNodeFromProviderID

func (u MachineDeploymentUpgrader) GetNodeFromProviderID(providerID string) *v1.Node

func (MachineDeploymentUpgrader) UpdateProviderIDsToNodes

func (u MachineDeploymentUpgrader) UpdateProviderIDsToNodes() error

UpdateProviderIDsToNodes retrieves a map that pairs a providerID to the node by listing all Nodes providerID : Node

func (*MachineDeploymentUpgrader) Upgrade

func (u *MachineDeploymentUpgrader) Upgrade() error

type MachineOptions

type MachineOptions struct {
	ImageID        string
	ImageField     string
	DesiredVersion semver.Version
}

MachineOptions are the values that can change on a machine upgrade

type MachineUpdateConfig

type MachineUpdateConfig struct {
	Image        ImageUpdateConfig `json:"image,omitempty"`
	MachineClass string            `json:"machineClass,omitempty"`
}

MachineUpdateConfig contains the configuration of the machine desired.

type ManagementClusterConfig

type ManagementClusterConfig struct {
	// Kubeconfig is a path to a kubeconfig
	Kubeconfig string `json:"kubeconfig"`
	Context    string `json:"context"`
}

ManagementClusterConfig is the Kubeconfig and relevant information to connect to the management cluster of the worker cluster being upgraded.

type TargetClusterConfig

type TargetClusterConfig struct {
	Namespace    string        `json:"namespace"`
	Name         string        `json:"name"`
	CAKeyPair    KeyPairConfig `json:"caKeyPair"`
	UpgradeScope string        `json:"scope"`
}

TargetClusterConfig are all the necessary configs of the Kubernetes cluster being upgraded.

func (*TargetClusterConfig) UpgradeScopes

func (t *TargetClusterConfig) UpgradeScopes() []string

Jump to

Keyboard shortcuts

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