k8s

package
v0.20.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 59 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// SchedName is the name of the kubernetes scheduler driver implementation
	SchedName = "k8s"
	// SnapshotParent is the parameter key for the parent of a snapshot
	SnapshotParent = "snapshot_parent"

	// DeploymentSuffix is the suffix for deployment names stored as keys in maps
	DeploymentSuffix = "-dep"
	// StatefulSetSuffix is the suffix for statefulset names stored as keys in maps
	StatefulSetSuffix = "-ss"
	// SystemdSchedServiceName is the name of the system service responsible for scheduling
	SystemdSchedServiceName = "kubelet"
	// ZoneK8SNodeLabel is label describing zone of the k8s node
	ZoneK8SNodeLabel = "failure-domain.beta.kubernetes.io/zone"
	// RegionK8SNodeLabel is node label describing region of the k8s node
	RegionK8SNodeLabel = "failure-domain.beta.kubernetes.io/region"
)
View Source
const (

	// FindFilesOnWorkerTimeout timeout for find files on worker
	FindFilesOnWorkerTimeout = 1 * time.Minute

	// DefaultRetryInterval  Default retry interval
	DefaultRetryInterval = 10 * time.Second
	// DefaultTimeout default timeout
	DefaultTimeout = 2 * time.Minute
)
View Source
const (

	// CsiProvisionerSecretName is required for CSI with Auth enabled
	CsiProvisionerSecretName = "csi.storage.k8s.io/provisioner-secret-name"
	// CsiProvisionerSecretNamespace is required for CSI with Auth enabled
	CsiProvisionerSecretNamespace = "csi.storage.k8s.io/provisioner-secret-namespace"
	// CsiNodePublishSecretName is required for CSI with Auth enabled
	CsiNodePublishSecretName = "csi.storage.k8s.io/node-publish-secret-name"
	// CsiNodePublishSecretNamespace is required for CSI with Auth enabled
	CsiNodePublishSecretNamespace = "csi.storage.k8s.io/node-publish-secret-namespace"
	// CsiControllerExpandSecretName is required for CSI with Auth enabled
	CsiControllerExpandSecretName = "csi.storage.k8s.io/controller-expand-secret-name"
	// CsiControllerExpandSecretNamespace is required for CSI with Auth enabled
	CsiControllerExpandSecretNamespace = "csi.storage.k8s.io/controller-expand-secret-namespace"

	// PvcNameKey key used in volume param map to store PVC name
	PvcNameKey = "pvc_name"
	// PvcNamespaceKey key used in volume param map to store PVC namespace
	PvcNamespaceKey = "pvc_namespace"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type K8s

type K8s struct {
	SpecFactory    *spec.Factory
	NodeDriverName string
	VolDriverName  string

	SecretType   string
	VaultAddress string
	VaultToken   string
	// contains filtered or unexported fields
}

K8s The kubernetes structure

func (*K8s) AddLabelOnNode

func (k *K8s) AddLabelOnNode(n node.Node, lKey string, lValue string) error

AddLabelOnNode adds label for a given node

func (*K8s) AddTasks

func (k *K8s) AddTasks(ctx *scheduler.Context, options scheduler.ScheduleOptions) error

AddTasks adds tasks to an existing context

func (*K8s) CreateAutopilotRule

func (k *K8s) CreateAutopilotRule(apRule apapi.AutopilotRule) (*apapi.AutopilotRule, error)

CreateAutopilotRule creates the AutopilotRule object

func (*K8s) CreateSpecObjects

func (k *K8s) CreateSpecObjects(app *spec.AppSpec, namespace string, options scheduler.ScheduleOptions) ([]interface{}, error)

CreateSpecObjects Create application

func (*K8s) DeleteTasks

func (k *K8s) DeleteTasks(ctx *scheduler.Context, opts *scheduler.DeleteTasksOptions) error

DeleteTasks delete the task

func (*K8s) DeleteVolumes

func (k *K8s) DeleteVolumes(ctx *scheduler.Context, options *scheduler.VolumeOptions) ([]*volume.Volume, error)

DeleteVolumes delete the volumes

func (*K8s) Describe

func (k *K8s) Describe(ctx *scheduler.Context) (string, error)

Describe describe the test case

func (*K8s) Destroy

func (k *K8s) Destroy(ctx *scheduler.Context, opts map[string]bool) error

Destroy destroy

func (*K8s) DisableSchedulingOnNode

func (k *K8s) DisableSchedulingOnNode(n node.Node) error

DisableSchedulingOnNode disable apps to be scheduled to a given k8s worker node

func (*K8s) EnableSchedulingOnNode

func (k *K8s) EnableSchedulingOnNode(n node.Node) error

EnableSchedulingOnNode enable apps to be scheduled to a given k8s worker node

func (*K8s) EstimatePVCExpansion

func (k *K8s) EstimatePVCExpansion(pvc *corev1.PersistentVolumeClaim, apRule apapi.AutopilotRule, wSize uint64) (uint64, int, error)

EstimatePVCExpansion calculates expected size of PVC based on autopilot rule and workload

func (*K8s) GetEvents

func (k *K8s) GetEvents() map[string][]scheduler.Event

GetEvents dumps events from event storage

func (*K8s) GetNodesForApp

func (k *K8s) GetNodesForApp(ctx *scheduler.Context) ([]node.Node, error)

GetNodesForApp get the node for the app

func (*K8s) GetScaleFactorMap

func (k *K8s) GetScaleFactorMap(ctx *scheduler.Context) (map[string]int32, error)

GetScaleFactorMap Get scale Factory map

func (*K8s) GetSnapshots

func (k *K8s) GetSnapshots(ctx *scheduler.Context) ([]*volume.Snapshot, error)

GetSnapshots Get the snapshots

func (*K8s) GetTokenFromConfigMap

func (k *K8s) GetTokenFromConfigMap(configMapName string) (string, error)

GetTokenFromConfigMap - Retrieve the config map object and get auth-token

func (*K8s) GetVolumeDriverVolumeName

func (k *K8s) GetVolumeDriverVolumeName(name string, namespace string) (string, error)

GetVolumeDriverVolumeName returns name of volume which is refered by volume driver

func (*K8s) GetVolumeParameters

func (k *K8s) GetVolumeParameters(ctx *scheduler.Context) (map[string]map[string]string, error)

GetVolumeParameters Get the volume parameters

func (*K8s) GetVolumes

func (k *K8s) GetVolumes(ctx *scheduler.Context) ([]*volume.Volume, error)

GetVolumes Get the volumes

func (*K8s) GetWorkloadSizeFromAppSpec

func (k *K8s) GetWorkloadSizeFromAppSpec(context *scheduler.Context) (uint64, error)

GetWorkloadSizeFromAppSpec gets workload size from an application spec

func (*K8s) Init

func (k *K8s) Init(schedOpts scheduler.InitOptions) error

Init Initialize the driver

func (*K8s) IsAutopilotEnabledForVolume

func (k *K8s) IsAutopilotEnabledForVolume(vol *volume.Volume) bool

IsAutopilotEnabledForVolume checks if autopilot enabled for a given volume

func (*K8s) IsNodeReady

func (k *K8s) IsNodeReady(n node.Node) error

IsNodeReady Check whether the cluster node is ready

func (*K8s) IsScalable

func (k *K8s) IsScalable(spec interface{}) bool

IsScalable check whether scalable

func (*K8s) ListAutopilotRules

func (k *K8s) ListAutopilotRules() (*apapi.AutopilotRuleList, error)

ListAutopilotRules lists AutopilotRules

func (*K8s) ParseSpecs

func (k *K8s) ParseSpecs(specDir, storageProvisioner string) ([]interface{}, error)

ParseSpecs parses the application spec file

func (*K8s) PrepareNodeToDecommission

func (k *K8s) PrepareNodeToDecommission(n node.Node, provisioner string) error

PrepareNodeToDecommission Prepare the Node for decommission

func (*K8s) RefreshNodeRegistry

func (k *K8s) RefreshNodeRegistry() error

RefreshNodeRegistry update the k8 node list registry

func (*K8s) RescanSpecs

func (k *K8s) RescanSpecs(specDir, storageDriver string) error

RescanSpecs Rescan the application spec file for spei

func (*K8s) ResizeVolume

func (k *K8s) ResizeVolume(ctx *scheduler.Context, configMapName string) ([]*volume.Volume, error)

ResizeVolume Resize the volume

func (*K8s) SaveSchedulerLogsToFile

func (k *K8s) SaveSchedulerLogsToFile(n node.Node, location string) error

SaveSchedulerLogsToFile gathers all scheduler logs into a file

func (*K8s) ScaleApplication

func (k *K8s) ScaleApplication(ctx *scheduler.Context, scaleFactorMap map[string]int32) error

ScaleApplication Scale the application

func (*K8s) Schedule

func (k *K8s) Schedule(instanceID string, options scheduler.ScheduleOptions) ([]*scheduler.Context, error)

Schedule Schedule the application

func (*K8s) SetConfig

func (k *K8s) SetConfig(kubeconfigPath string) error

SetConfig sets kubeconfig. If kubeconfigPath == "" then sets it to inClusterConfig

func (*K8s) StartSchedOnNode

func (k *K8s) StartSchedOnNode(n node.Node) error

StartSchedOnNode start schedule on node

func (*K8s) StopSchedOnNode

func (k *K8s) StopSchedOnNode(n node.Node) error

StopSchedOnNode stop schedule on node

func (*K8s) String

func (k *K8s) String() string

String returns the string name of this driver.

func (*K8s) UpdateAutopilotRule

func (k *K8s) UpdateAutopilotRule(apRule apapi.AutopilotRule) (*apapi.AutopilotRule, error)

UpdateAutopilotRule updates the AutopilotRule

func (*K8s) UpdateTasksID

func (k *K8s) UpdateTasksID(ctx *scheduler.Context, id string) error

UpdateTasksID updates task IDs in the given context

func (*K8s) ValidateAutopilotEvents

func (k *K8s) ValidateAutopilotEvents(ctx *scheduler.Context) error

ValidateAutopilotEvents verifies proper alerts and events on resize completion

func (*K8s) ValidateVolumeSnapshotRestore

func (k *K8s) ValidateVolumeSnapshotRestore(ctx *scheduler.Context, timeStart time.Time) error

ValidateVolumeSnapshotRestore return nil if snapshot is restored successuflly to parent volumes

func (*K8s) ValidateVolumes

func (k *K8s) ValidateVolumes(ctx *scheduler.Context, timeout, retryInterval time.Duration,
	options *scheduler.VolumeOptions) error

ValidateVolumes Validates the volumes

func (*K8s) WaitForDestroy

func (k *K8s) WaitForDestroy(ctx *scheduler.Context, timeout time.Duration) error

WaitForDestroy wait for schedule context destroy

func (*K8s) WaitForRunning

func (k *K8s) WaitForRunning(ctx *scheduler.Context, timeout, retryInterval time.Duration) error

WaitForRunning wait for running

Jump to

Keyboard shortcuts

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