clusters

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCRI

func ValidateCRI(c CRI) error

ValidateCRI validates the given cri struct

func ValidateCluster

func ValidateCluster(
	clusterName string,
	clusterConfig Kubernetes,
	nodePools []NodePool,
	maintenance *Maintenance,
	hibernation *Hibernation,
	extensions *Extensions,
) error

ValidateCluster validates the given cluster data (dry validation)

func ValidateClusterName

func ValidateClusterName(name string) error

ValidateClusterName validates a given cluster name

func ValidateExtensions

func ValidateExtensions(e *Extensions) error

ValidateExtensions validates a given cluster extensions

func ValidateHibernation

func ValidateHibernation(h *Hibernation) error

ValidateHibernation validates a given cluster hibernation

func ValidateMaintenance

func ValidateMaintenance(m *Maintenance) error

ValidateMaintenance validates a given cluster maintenance

func ValidateNodePool

func ValidateNodePool(np NodePool) error

ValidateNodePool validates a given node pool

func ValidateTaint

func ValidateTaint(t Taint) error

ValidateTaint validates a given node pool taint

Types

type ArgusExtension

type ArgusExtension struct {
	Enabled         bool   `json:"enabled"`
	ArgusInstanceID string `json:"argusInstanceId"`
}

ArgusExtension is Argus extension

type CRI

type CRI struct {
	Name string `json:"name"`
}

CRI is the container runtime interface of the node pool

type Cluster

type Cluster struct {
	Name        string       `json:"name"` // 11 lowercase letters, numbers, or hyphens
	Kubernetes  Kubernetes   `json:"kubernetes"`
	Nodepools   []NodePool   `json:"nodepools"`
	Maintenance *Maintenance `json:"maintenance,omitempty"`
	Hibernation *Hibernation `json:"hibernation,omitempty"`
	Extensions  *Extensions  `json:"extensions,omitempty"`
	Status      *Status      `json:"status,omitempty"`
}

Cluster is a struct representation of a cluster in STACKIT api

type ClusterList added in v0.1.1

type ClusterList struct {
	Items []Cluster `json:"items"`
}

ClusterList is the response for listing clusters

type Credentials

type Credentials struct {
	Server                   string `json:"server"`
	Kubeconfig               string `json:"kubeconfig"`
	CertificateAuthorityData string `json:"certificateAuthorityData"`
	Token                    string `json:"token"`
}

Credentials is the struct response for cluster credentils

type Extensions

type Extensions struct {
	Argus *ArgusExtension `json:"argus,omitempty"`
}

Extensions represent SKE extensions

type Hibernation

type Hibernation struct {
	Schedules []HibernationScedule `json:"schedules"`
}

Hibernation schedule

type HibernationScedule

type HibernationScedule struct {
	Start    string `json:"start"`
	End      string `json:"end"`
	Timezone string `json:"timezone"`
}

HibernationScedule is the schedule for hibernation

type Kubernetes

type Kubernetes struct {
	Version                   string `json:"version"`
	AllowPrivilegedContainers bool   `json:"allowPrivilegedContainers"`
}

Kubernetes contains the cluster's kubernetes config

type KubernetesClusterService

type KubernetesClusterService common.Service

KubernetesClusterService is the service that handles CRUD functionality for SKE clusters

func New

New returns a new handler for the service

func (*KubernetesClusterService) CreateOrUpdate added in v0.4.0

func (svc *KubernetesClusterService) CreateOrUpdate(
	ctx context.Context,
	projectID string,
	clusterName string,
	clusterConfig Kubernetes,
	nodePools []NodePool,
	maintenance *Maintenance,
	hibernation *Hibernation,
	extensions *Extensions,
) (res Cluster, w *wait.Handler, err error)

CreateOrUpdate creates or updates a SKE cluster See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_CreateOrUpdateCluster The function also returns a wait functionality in case there's no error trigger wait by running `.Wait()` which returns the cluster information (clusters.Cluster struct)

func (*KubernetesClusterService) Delete

func (svc *KubernetesClusterService) Delete(ctx context.Context, projectID, clusterName string) (w *wait.Handler, err error)

Delete deletes a SKE cluster See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_DeleteCluster Wait for deletion to complete by running the returned wait functionality `wait.Wait()`

func (*KubernetesClusterService) Get

func (svc *KubernetesClusterService) Get(ctx context.Context, projectID, clusterName string) (res Cluster, err error)

Get returns the a cluster by project ID and cluster name See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_ListClusters

func (*KubernetesClusterService) GetCredential

func (svc *KubernetesClusterService) GetCredential(ctx context.Context, projectID, clusterName string) (res Credentials, err error)

GetCredential returns the a credentials for the cluster See also https://api.stackit.schwarz/ske-service/openapi.v1.html#tag/Credentials

func (*KubernetesClusterService) Hibernate

func (svc *KubernetesClusterService) Hibernate(ctx context.Context, projectID, clusterName string) (res Cluster, err error)

Hibernate triggers cluster hibernation See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_TriggerClusterHibernation

func (*KubernetesClusterService) List

func (svc *KubernetesClusterService) List(ctx context.Context, projectID string) (res ClusterList, err error)

List returns the clusters in the project See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_ListClusters

func (*KubernetesClusterService) Maintenance

func (svc *KubernetesClusterService) Maintenance(ctx context.Context, projectID, clusterName string) (res Cluster, err error)

Maintenance triggers cluster maintenance See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_TriggerClusterMaintenance

func (*KubernetesClusterService) Reconcile

func (svc *KubernetesClusterService) Reconcile(ctx context.Context, projectID, clusterName string) (res Cluster, err error)

Reconcile triggers cluster reconciliation See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_TriggerClusterReconciliation

func (*KubernetesClusterService) RotateCredentials

func (svc *KubernetesClusterService) RotateCredentials(ctx context.Context, projectID, clusterName string) (err error)

RotateCredentials triggers cluster credentials rotation See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_TriggerClusterCredentialRotation

func (*KubernetesClusterService) Wakeup

func (svc *KubernetesClusterService) Wakeup(ctx context.Context, projectID, clusterName string) (res Cluster, err error)

Wakeup triggers cluster wakeup See also https://api.stackit.schwarz/ske-service/openapi.v1.html#operation/SkeService_TriggerClusterWakeup

type Machine

type Machine struct {
	Type  string       `json:"type"`
	Image MachineImage `json:"image"`
}

Machine contains information of the machine in the node pool

type MachineImage

type MachineImage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

MachineImage contains information of the machine's image

type Maintenance

type Maintenance struct {
	AutoUpdate MaintenanceAutoUpdate `json:"autoUpdate"`
	TimeWindow MaintenanceTimeWindow `json:"timeWindow"`
}

Maintenance is the node pool's maintenance window

type MaintenanceAutoUpdate

type MaintenanceAutoUpdate struct {
	KubernetesVersion   bool `json:"kubernetesVersion"`
	MachineImageVersion bool `json:"machineImageVersion"`
}

MaintenanceAutoUpdate is the auto update confguration

type MaintenanceTimeWindow

type MaintenanceTimeWindow struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

MaintenanceTimeWindow is when the maintenance window should happen

type NodePool

type NodePool struct {
	Name              string            `json:"name,omitempty"`
	Machine           Machine           `json:"machine"`
	Minimum           int               `json:"minimum"`
	Maximum           int               `json:"maximum"`
	MaxSurge          int               `json:"maxSurge"`
	MaxUnavailable    int               `json:"maxUnavailable"`
	Volume            Volume            `json:"volume"`
	Labels            map[string]string `json:"labels"`
	Taints            []Taint           `json:"taints"`
	CRI               CRI               `json:"cri"`
	AvailabilityZones []string          `json:"availabilityZones"`
}

NodePool is a struct representing a node pool in the cluster

type Status

type Status struct {
	Hibernated bool   `json:"hibernated"`
	Aggregated string `json:"aggregated"`
	Error      struct {
		Code    string `json:"code"`
		Message string `json:"message"`
		Details string `json:"details"`
	} `json:"error,omitempty"`
}

Status is the cluster status

type Taint

type Taint struct {
	Effect string `json:"effect"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

Taint is a taint of the node pool

type Volume

type Volume struct {
	Type string `json:"type"`
	Size int    `json:"size"`
}

Volume is the node pool volume information

Jump to

Keyboard shortcuts

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