Documentation ¶
Index ¶
- Constants
- type K8s
- func (k *K8s) AddLabelOnNode(n node.Node, lKey string, lValue string) error
- func (k *K8s) AddTasks(ctx *scheduler.Context, options scheduler.ScheduleOptions) error
- func (k *K8s) CreateAutopilotRule(apRule apapi.AutopilotRule) (*apapi.AutopilotRule, error)
- func (k *K8s) CreateSpecObjects(app *spec.AppSpec, namespace string, options scheduler.ScheduleOptions) ([]interface{}, error)
- func (k *K8s) DeleteTasks(ctx *scheduler.Context, opts *scheduler.DeleteTasksOptions) error
- func (k *K8s) DeleteVolumes(ctx *scheduler.Context, options *scheduler.VolumeOptions) ([]*volume.Volume, error)
- func (k *K8s) Describe(ctx *scheduler.Context) (string, error)
- func (k *K8s) Destroy(ctx *scheduler.Context, opts map[string]bool) error
- func (k *K8s) DisableSchedulingOnNode(n node.Node) error
- func (k *K8s) EnableSchedulingOnNode(n node.Node) error
- func (k *K8s) EstimatePVCExpansion(pvc *corev1.PersistentVolumeClaim, apRule apapi.AutopilotRule, wSize uint64) (uint64, int, error)
- func (k *K8s) GetEvents() map[string][]scheduler.Event
- func (k *K8s) GetNodesForApp(ctx *scheduler.Context) ([]node.Node, error)
- func (k *K8s) GetScaleFactorMap(ctx *scheduler.Context) (map[string]int32, error)
- func (k *K8s) GetSnapshots(ctx *scheduler.Context) ([]*volume.Snapshot, error)
- func (k *K8s) GetTokenFromConfigMap(configMapName string) (string, error)
- func (k *K8s) GetVolumeDriverVolumeName(name string, namespace string) (string, error)
- func (k *K8s) GetVolumeParameters(ctx *scheduler.Context) (map[string]map[string]string, error)
- func (k *K8s) GetVolumes(ctx *scheduler.Context) ([]*volume.Volume, error)
- func (k *K8s) GetWorkloadSizeFromAppSpec(context *scheduler.Context) (uint64, error)
- func (k *K8s) Init(schedOpts scheduler.InitOptions) error
- func (k *K8s) IsAutopilotEnabledForVolume(vol *volume.Volume) bool
- func (k *K8s) IsNodeReady(n node.Node) error
- func (k *K8s) IsScalable(spec interface{}) bool
- func (k *K8s) ListAutopilotRules() (*apapi.AutopilotRuleList, error)
- func (k *K8s) ParseSpecs(specDir, storageProvisioner string) ([]interface{}, error)
- func (k *K8s) PrepareNodeToDecommission(n node.Node, provisioner string) error
- func (k *K8s) RefreshNodeRegistry() error
- func (k *K8s) RescanSpecs(specDir, storageDriver string) error
- func (k *K8s) ResizeVolume(ctx *scheduler.Context, configMapName string) ([]*volume.Volume, error)
- func (k *K8s) SaveSchedulerLogsToFile(n node.Node, location string) error
- func (k *K8s) ScaleApplication(ctx *scheduler.Context, scaleFactorMap map[string]int32) error
- func (k *K8s) Schedule(instanceID string, options scheduler.ScheduleOptions) ([]*scheduler.Context, error)
- func (k *K8s) SetConfig(kubeconfigPath string) error
- func (k *K8s) StartSchedOnNode(n node.Node) error
- func (k *K8s) StopSchedOnNode(n node.Node) error
- func (k *K8s) String() string
- func (k *K8s) UpdateAutopilotRule(apRule apapi.AutopilotRule) (*apapi.AutopilotRule, error)
- func (k *K8s) UpdateTasksID(ctx *scheduler.Context, id string) error
- func (k *K8s) ValidateAutopilotEvents(ctx *scheduler.Context) error
- func (k *K8s) ValidateVolumeSnapshotRestore(ctx *scheduler.Context, timeStart time.Time) error
- func (k *K8s) ValidateVolumes(ctx *scheduler.Context, timeout, retryInterval time.Duration, ...) error
- func (k *K8s) WaitForDestroy(ctx *scheduler.Context, timeout time.Duration) error
- func (k *K8s) WaitForRunning(ctx *scheduler.Context, timeout, retryInterval time.Duration) error
Constants ¶
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" )
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 )
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 ¶
AddLabelOnNode adds label for a given node
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 ¶
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) DisableSchedulingOnNode ¶
DisableSchedulingOnNode disable apps to be scheduled to a given k8s worker node
func (*K8s) EnableSchedulingOnNode ¶
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) GetNodesForApp ¶
GetNodesForApp get the node for the app
func (*K8s) GetScaleFactorMap ¶
GetScaleFactorMap Get scale Factory map
func (*K8s) GetSnapshots ¶
GetSnapshots Get the snapshots
func (*K8s) GetTokenFromConfigMap ¶
GetTokenFromConfigMap - Retrieve the config map object and get auth-token
func (*K8s) GetVolumeDriverVolumeName ¶
GetVolumeDriverVolumeName returns name of volume which is refered by volume driver
func (*K8s) GetVolumeParameters ¶
GetVolumeParameters Get the volume parameters
func (*K8s) GetVolumes ¶
GetVolumes Get the volumes
func (*K8s) GetWorkloadSizeFromAppSpec ¶
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 ¶
IsAutopilotEnabledForVolume checks if autopilot enabled for a given volume
func (*K8s) IsNodeReady ¶
IsNodeReady Check whether the cluster node is ready
func (*K8s) IsScalable ¶
IsScalable check whether scalable
func (*K8s) ListAutopilotRules ¶
func (k *K8s) ListAutopilotRules() (*apapi.AutopilotRuleList, error)
ListAutopilotRules lists AutopilotRules
func (*K8s) ParseSpecs ¶
ParseSpecs parses the application spec file
func (*K8s) PrepareNodeToDecommission ¶
PrepareNodeToDecommission Prepare the Node for decommission
func (*K8s) RefreshNodeRegistry ¶
RefreshNodeRegistry update the k8 node list registry
func (*K8s) RescanSpecs ¶
RescanSpecs Rescan the application spec file for spei
func (*K8s) ResizeVolume ¶
ResizeVolume Resize the volume
func (*K8s) SaveSchedulerLogsToFile ¶
SaveSchedulerLogsToFile gathers all scheduler logs into a file
func (*K8s) ScaleApplication ¶
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 ¶
SetConfig sets kubeconfig. If kubeconfigPath == "" then sets it to inClusterConfig
func (*K8s) StartSchedOnNode ¶
StartSchedOnNode start schedule on node
func (*K8s) StopSchedOnNode ¶
StopSchedOnNode stop schedule on node
func (*K8s) UpdateAutopilotRule ¶
func (k *K8s) UpdateAutopilotRule(apRule apapi.AutopilotRule) (*apapi.AutopilotRule, error)
UpdateAutopilotRule updates the AutopilotRule
func (*K8s) UpdateTasksID ¶
UpdateTasksID updates task IDs in the given context
func (*K8s) ValidateAutopilotEvents ¶
ValidateAutopilotEvents verifies proper alerts and events on resize completion
func (*K8s) ValidateVolumeSnapshotRestore ¶
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 ¶
WaitForDestroy wait for schedule context destroy