workerscale

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const AutoScalerBuffer = 10
View Source
const DefaultClusterAutoScaler = "default"
View Source
const DefaultNamespace = "default"
View Source
const JobName = "workers-scale"

Resource constants

View Source
const MachineNamespace = "openshift-machine-api"
View Source
const TenMinutes = 600

Variables

This section is empty.

Functions

func DiscardPreviousMachines

func DiscardPreviousMachines(prevMachineDetails map[string]MachineInfo, currentMachineDetails map[string]MachineInfo)

DiscardPreviousMachines updates the current machines details discarding the previous ones

func EditMachineSets

func EditMachineSets(machineClient *machinev1beta1.MachineV1beta1Client, clientSet kubernetes.Interface, machineSetsToEdit *sync.Map, isScaleUp bool)

EditMachineSets edits machinesets parallelly

func FinalizeMetrics

func FinalizeMetrics(machineSetsToEdit *sync.Map, scaledMachineDetails map[string]MachineInfo, metadata map[string]interface{}, indexerValue indexers.Indexer, amiID string, scaleEventEpoch int64)

FinalizeMetrics performs and indexes required metrics

func GetCAPIClient

func GetCAPIClient(restConfig *rest.Config) client.Client

GetCAPIClient create a cluster api client

func GetCapiMachines

func GetCapiMachines(capiClient client.Client, scaleEventEpoch int64, clusterID string, namespace string) (map[string]MachineInfo, string)

GetCapiMachines to fetch cluster api kind machines

func GetHCNamespace

func GetHCNamespace(clientset kubernetes.Interface, clusterID string) string

GetHCNamespace gets the longest hosted cluster namespace from management cluster

func GetMachineClient

func GetMachineClient(restConfig *rest.Config) *machinev1beta1.MachineV1beta1Client

GetMachineClient creates a reusable machine client

func GetMachines

func GetMachines(machineClient *machinev1beta1.MachineV1beta1Client, scaleEventEpoch int64) (map[string]MachineInfo, string)

GetMachines lists all worker machines in the cluster

func GetMachinesets

func GetMachinesets(machineClient *machinev1beta1.MachineV1beta1Client) map[int][]string

GetMachinesets lists all machinesets

func Int32Ptr

func Int32Ptr(i int32) *int32

helper function to create a pointer to an int32

func SetupMetrics

func SetupMetrics(uuid string, metadata map[string]interface{}, kubeClientProvider *config.KubeClientProvider)

SetupMetrics sets up the measurment factory for us

func WaitForCAPIMachineSets

func WaitForCAPIMachineSets(capiClient client.Client, clusterID string, namespace string) error

WaitForWorkerMachineSets waits for all the cluster-api type worker machinesets in specific to be ready

func WaitForMachineSet

func WaitForMachineSet(machineClient *machinev1beta1.MachineV1beta1Client, name string, newReplicaCount int32) error

WaitForMachineSet waits for machinesets to be ready with new replica count

func WaitForNodes

func WaitForNodes(clientset kubernetes.Interface) error

WaitForNodes waits for all the nodes to be ready

func WaitForWorkerMachineSets

func WaitForWorkerMachineSets(machineClient *machinev1beta1.MachineV1beta1Client) error

WaitForWorkerMachineSets waits for all the worker machinesets in specific to be ready

Types

type AWSProviderSpec

type AWSProviderSpec struct {
	AMI struct {
		ID string `json:"id"`
	} `json:"ami"`
}

Struct to extract AMIID from aws provider spec

type MachineInfo

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

MachineInfo provides information about a machine resource

type MachineSetInfo

type MachineSetInfo struct {
	LastUpdatedTime time.Time
	PrevReplicas    int
	CurrentReplicas int
}

MachineSetInfo provides information about a machineset resource

type NodeReadyMetric

type NodeReadyMetric struct {
	Timestamp                time.Time         `json:"timestamp"`
	ScaleEventTimestamp      time.Time         `json:"scaleEventTimestamp"`
	MachineCreationTimestamp time.Time         `json:"-"`
	MachineCreationLatency   int               `json:"machineCreationLatency"`
	MachineReadyTimestamp    time.Time         `json:"-"`
	MachineReadyLatency      int               `json:"machineReadyLatency"`
	NodeCreationTimestamp    time.Time         `json:"-"`
	NodeCreationLatency      int               `json:"nodeCreationLatency"`
	NodeReadyTimestamp       time.Time         `json:"-"`
	NodeReadyLatency         int               `json:"nodeReadyLatency"`
	MetricName               string            `json:"metricName"`
	AMIID                    string            `json:"amiID"`
	UUID                     string            `json:"uuid"`
	JobName                  string            `json:"jobName,omitempty"`
	Name                     string            `json:"nodeName"`
	Labels                   map[string]string `json:"labels"`
	Metadata                 interface{}       `json:"metadata,omitempty"`
}

NodeReadyMetric to capture details on node bootup

type ProviderStatus

type ProviderStatus struct {
	Conditions []ProviderStatusCondition `json:"conditions"`
}

ProviderStatus of a machine

type ProviderStatusCondition

type ProviderStatusCondition struct {
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`
	Message            string      `json:"message"`
	Reason             string      `json:"reason"`
	Status             string      `json:"status"`
	Type               string      `json:"type"`
}

ProviderStatusCondition of a machine

type ScaleConfig

type ScaleConfig struct {
	UUID                  string
	AdditionalWorkerNodes int
	Metadata              map[string]interface{}
	Indexer               indexers.Indexer
	GC                    bool
	ScaleEventEpoch       int64
	AutoScalerEnabled     bool
	MCKubeConfig          string
	IsHCP                 bool
}

ScaleConfig contains configuration for scaling

type Scenario

type Scenario interface {
	OrchestrateWorkload(ScaleConfig) string
}

Interface for our scenarios

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳