Documentation ¶
Overview ¶
Package kubernetes provides functions to interact with a live cluster to the CLI.
Currently it is used to implement the status and upgrade commands.
Index ¶
- Variables
- func ClusterStatus(ctx context.Context, kubeclient kubeClient) (map[string]NodeStatus, error)
- func GetConstellationVersion(ctx context.Context, client DynamicInterface) (updatev1alpha1.NodeVersion, error)
- type DynamicInterface
- type NodeStatus
- type NodeVersionClient
- type TargetVersions
- type Upgrader
- func (u *Upgrader) CurrentImage(ctx context.Context) (string, error)
- func (u *Upgrader) CurrentKubernetesVersion(ctx context.Context) (string, error)
- func (u *Upgrader) GetClusterMeasurements(ctx context.Context) (measurements.M, *corev1.ConfigMap, error)
- func (u *Upgrader) KubernetesVersion() (string, error)
- func (u *Upgrader) UpdateMeasurements(ctx context.Context, newMeasurements measurements.M) error
- func (u *Upgrader) UpgradeHelmServices(ctx context.Context, config *config.Config, timeout time.Duration, ...) error
- func (u *Upgrader) UpgradeNodeVersion(ctx context.Context, conf *config.Config) error
Constants ¶
This section is empty.
Variables ¶
var ErrInProgress = errors.New("upgrade in progress")
ErrInProgress signals that an upgrade is in progress inside the cluster.
Functions ¶
func ClusterStatus ¶
func ClusterStatus(ctx context.Context, kubeclient kubeClient) (map[string]NodeStatus, error)
ClusterStatus returns a map from node name to NodeStatus.
func GetConstellationVersion ¶
func GetConstellationVersion(ctx context.Context, client DynamicInterface) (updatev1alpha1.NodeVersion, error)
GetConstellationVersion queries the constellation-version object for a given field.
Types ¶
type DynamicInterface ¶
type DynamicInterface interface { GetCurrent(ctx context.Context, name string) (*unstructured.Unstructured, error) Update(ctx context.Context, obj *unstructured.Unstructured) (*unstructured.Unstructured, error) }
DynamicInterface is a general interface to query custom resources.
type NodeStatus ¶
type NodeStatus struct {
// contains filtered or unexported fields
}
NodeStatus bundles status information about a node.
func NewNodeStatus ¶
func NewNodeStatus(node corev1.Node) NodeStatus
NewNodeStatus returns a new NodeStatus.
func (*NodeStatus) ImageVersion ¶
func (n *NodeStatus) ImageVersion() string
ImageVersion returns the node image of the node.
func (*NodeStatus) KubeletVersion ¶
func (n *NodeStatus) KubeletVersion() string
KubeletVersion returns the kubelet version of the node.
type NodeVersionClient ¶
type NodeVersionClient struct {
// contains filtered or unexported fields
}
NodeVersionClient implements the DynamicInterface interface to interact with NodeVersion objects.
func NewNodeVersionClient ¶
func NewNodeVersionClient(client dynamic.Interface) *NodeVersionClient
NewNodeVersionClient returns a new NodeVersionClient.
func (*NodeVersionClient) GetCurrent ¶
func (u *NodeVersionClient) GetCurrent(ctx context.Context, name string) (*unstructured.Unstructured, error)
GetCurrent returns the current NodeVersion object.
func (*NodeVersionClient) Update ¶
func (u *NodeVersionClient) Update(ctx context.Context, obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
Update updates the NodeVersion object.
type TargetVersions ¶
type TargetVersions struct {
// contains filtered or unexported fields
}
TargetVersions bundles version information about the target versions of a cluster.
func NewTargetVersions ¶
func NewTargetVersions(nodeVersion updatev1alpha1.NodeVersion) (TargetVersions, error)
NewTargetVersions returns the target versions for the cluster.
func (*TargetVersions) Image ¶
func (c *TargetVersions) Image() string
Image return the image version.
func (*TargetVersions) ImagePath ¶
func (c *TargetVersions) ImagePath() string
ImagePath return the image path.
func (*TargetVersions) Kubernetes ¶
func (c *TargetVersions) Kubernetes() string
Kubernetes return the Kubernetes version.
type Upgrader ¶
type Upgrader struct {
// contains filtered or unexported fields
}
Upgrader handles upgrading the cluster's components using the CLI.
func NewUpgrader ¶
NewUpgrader returns a new Upgrader.
func (*Upgrader) CurrentImage ¶
CurrentImage returns the currently used image version of the cluster.
func (*Upgrader) CurrentKubernetesVersion ¶
CurrentKubernetesVersion returns the currently used Kubernetes version.
func (*Upgrader) GetClusterMeasurements ¶
func (u *Upgrader) GetClusterMeasurements(ctx context.Context) (measurements.M, *corev1.ConfigMap, error)
GetClusterMeasurements fetches the join-config configmap from the cluster, extracts the measurements and returns both the full configmap and the measurements.
func (*Upgrader) KubernetesVersion ¶
KubernetesVersion returns the version of Kubernetes the Constellation is currently running on.
func (*Upgrader) UpdateMeasurements ¶
UpdateMeasurements fetches the cluster's measurements, compares them to a set of new measurements and updates the cluster's measurements if they are different from the new ones.
func (*Upgrader) UpgradeHelmServices ¶
func (u *Upgrader) UpgradeHelmServices(ctx context.Context, config *config.Config, timeout time.Duration, allowDestructive bool) error
UpgradeHelmServices upgrade helm services.
func (*Upgrader) UpgradeNodeVersion ¶
UpgradeNodeVersion upgrades the cluster's NodeVersion object and in turn triggers image & k8s version upgrades. The versions set in the config are validated against the versions running in the cluster.