Documentation ¶
Index ¶
- Constants
- Variables
- func AsIntOrString(val any) (target intstr.IntOrString, err error)
- func AsQuantity(str string) (norm resource.Quantity, err error)
- func BoolToBytes(b bool) []byte
- func CmpNodeInfoDescending(a, b NodeInfo) int
- func CompareEventsByEventTime(a, b EventInfo) int
- func ContainsPod(podUID string, podInfos []PodInfo) bool
- func CumulatePodRequests(pod *corev1.Pod) corev1.ResourceList
- func GetInnerMap(parentMap map[string]any, keys ...string) (map[string]any, error)
- func GetInnerMapValue(parentMap map[string]any, keys ...string) (any, error)
- func GetLabelValue(labelMap map[string]string, labelNames []string) (labelValue string, ok bool)
- func GetPoolName(labels map[string]string) (label string, ok bool)
- func GetZone(labels map[string]string) (label string, ok bool)
- func GetZoneAnyMap(labelsMap map[string]any) string
- func HashBool(hasher hash.Hash, val bool)
- func HashDuration(hasher hash.Hash, d time.Duration)
- func HashInt(hasher hash.Hash, val int)
- func HashInt64(hasher hash.Hash, val int64)
- func HashLabels(hasher hash.Hash, labels map[string]string)
- func HashResource(hasher hash.Hash, name corev1.ResourceName, quantity resource.Quantity)
- func HashResources(hasher hash.Hash, resources corev1.ResourceList)
- func HashSlice[T ~string](hasher hash.Hash, strSlice []T)
- func HashTaints(hasher hash.Hash, taints []corev1.Taint)
- func IsEqualNodeInfo(a, b NodeInfo) bool
- func IsEqualPodInfo(a, b PodInfo) bool
- func IsEqualQuantity(a, b resource.Quantity) bool
- func IsEqualTaint(a, b corev1.Taint) bool
- func IsResourceListEqual(r1 corev1.ResourceList, r2 corev1.ResourceList) bool
- func MustParseQuantity(str string) (norm resource.Quantity)
- func NormalizeQuantity(q resource.Quantity) (norm resource.Quantity, err error)
- func ResourcesAsString(resources corev1.ResourceList) string
- func SumResources(resources []corev1.ResourceList) corev1.ResourceList
- type AutoscalerConfig
- type AutoscalerMode
- type CASettingsInfo
- type ClusterSnapshot
- func (c ClusterSnapshot) GetHash() string
- func (c ClusterSnapshot) GetPodNamspaces() sets.Set[string]
- func (c ClusterSnapshot) GetPodUIDs() sets.Set[string]
- func (c ClusterSnapshot) GetPodsWithScheduleStatus(status PodScheduleStatus) []PodInfo
- func (c ClusterSnapshot) GetPriorityClassUIDs() sets.Set[string]
- func (c ClusterSnapshot) HasSameUnscheduledPods(other ClusterSnapshot) bool
- type EventInfo
- type MachineDeploymentInfo
- type MinMax
- type NodeGroupInfo
- type NodeInfo
- type NodeTemplate
- type PodInfo
- type PodScheduleStatus
- type PriorityClassInfo
- type SnapshotMeta
- type WorkerPoolInfo
Constants ¶
const LabelVirtualScaled = "virtual-scaled"
const PodScheduleCommited = 1
const PodScheduleNominated = -1
const PodSchedulePending = -2
const PodUnscheduled = 0
const PoolLabel = "worker.gardener.cloud/pool"
const PoolLabelAlt = "worker_gardener_cloud_pool"
const PoolLabelAlt1 = "worker.gardener.cloud_pool"
Variables ¶
var ErrKeyNotFound = errors.New("key not found")
var PoolLabels = []string{ PoolLabel, PoolLabelAlt, PoolLabelAlt1, }
var ZoneLabels = []string{"topology.kubernetes.io/zone", "topology.gke.io/zone", "topology.ebs.csi.aws.com/zone", "topology.disk.csi.azure.com/zone", "failure-domain.beta.kubernetes.io/zone"}
Functions ¶
func AsIntOrString ¶
func AsIntOrString(val any) (target intstr.IntOrString, err error)
func BoolToBytes ¶
func CmpNodeInfoDescending ¶
func ContainsPod ¶
func CumulatePodRequests ¶
func CumulatePodRequests(pod *corev1.Pod) corev1.ResourceList
func GetInnerMap ¶
func GetInnerMapValue ¶
func GetLabelValue ¶
func GetZoneAnyMap ¶
func HashResource ¶
func HashResources ¶
func HashResources(hasher hash.Hash, resources corev1.ResourceList)
func IsEqualNodeInfo ¶
func IsEqualPodInfo ¶
func IsEqualQuantity ¶
func IsEqualTaint ¶
func IsResourceListEqual ¶
func IsResourceListEqual(r1 corev1.ResourceList, r2 corev1.ResourceList) bool
func MustParseQuantity ¶
MustParseQuantity parses given str as normalized quantity or panics. NOTE: ONLY USE FOR UNIT TESTS OR LITERALS
func NormalizeQuantity ¶
func ResourcesAsString ¶
func ResourcesAsString(resources corev1.ResourceList) string
func SumResources ¶
func SumResources(resources []corev1.ResourceList) corev1.ResourceList
Types ¶
type AutoscalerConfig ¶
type AutoscalerConfig struct { NodeTemplates map[string]NodeTemplate NodeGroups map[string]NodeGroupInfo ExistingNodes []NodeInfo CASettings CASettingsInfo Mode AutoscalerMode SuccessSignalPath string ErrorSignalPath string Hash string }
func (AutoscalerConfig) GetHash ¶
func (a AutoscalerConfig) GetHash() string
func (*AutoscalerConfig) Init ¶
func (c *AutoscalerConfig) Init() error
type AutoscalerMode ¶
type AutoscalerMode string
const AutoscalerReplayerPauseMode AutoscalerMode = "replay-mode-pause"
const AutoscalerReplayerRunMode AutoscalerMode = "replay-mode-run"
const AutoscalerStandaloneMode AutoscalerMode = "standalone-mode"
type CASettingsInfo ¶
type CASettingsInfo struct { SnapshotTimestamp time.Time Expander string NodeGroupsMinMax map[string]MinMax MaxNodeProvisionTime time.Duration ScanInterval time.Duration MaxGracefulTerminationSeconds int NewPodScaleUpDelay time.Duration MaxEmptyBulkDelete int IgnoreDaemonSetUtilization bool MaxNodesTotal int `db:"MaxNodesTotal"` // Priorities is the value of the `priorities` key in the `cluster-autoscaler-priority-expander` config map. // See https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md#configuration Priorities string Hash string //primary key }
CASettingsInfo represents configuration settings of the k8s cluster-autoscaler. This is currently a very minimal struct only capturing those options that can be configured in a gardener shoot spec. TODO Also add scale down properties
func (CASettingsInfo) GetHash ¶
func (cas CASettingsInfo) GetHash() string
func (CASettingsInfo) String ¶
func (cas CASettingsInfo) String() string
type ClusterSnapshot ¶
type ClusterSnapshot struct { ID string Number int SnapshotTime time.Time AutoscalerConfig AutoscalerConfig WorkerPools []WorkerPoolInfo PriorityClasses []PriorityClassInfo Pods []PodInfo Nodes []NodeInfo Hash string }
ClusterSnapshot represents captured snapshot information about a gardener cluster that is useful for auto-scaling state.
func (ClusterSnapshot) GetHash ¶
func (c ClusterSnapshot) GetHash() string
func (ClusterSnapshot) GetPodNamspaces ¶
func (c ClusterSnapshot) GetPodNamspaces() sets.Set[string]
func (ClusterSnapshot) GetPodUIDs ¶
func (c ClusterSnapshot) GetPodUIDs() sets.Set[string]
func (ClusterSnapshot) GetPodsWithScheduleStatus ¶
func (c ClusterSnapshot) GetPodsWithScheduleStatus(status PodScheduleStatus) []PodInfo
func (ClusterSnapshot) GetPriorityClassUIDs ¶
func (c ClusterSnapshot) GetPriorityClassUIDs() sets.Set[string]
func (ClusterSnapshot) HasSameUnscheduledPods ¶
func (c ClusterSnapshot) HasSameUnscheduledPods(other ClusterSnapshot) bool
type EventInfo ¶
type EventInfo struct { UID string `db:"UID"` EventTime time.Time `db:"EventTime"` ReportingController string `db:"ReportingController"` Reason string `db:"Reason"` Message string `db:"Message"` InvolvedObjectKind string `db:"InvolvedObjectKind"` InvolvedObjectName string `db:"InvolvedObjectName"` InvolvedObjectNamespace string `db:"InvolvedObjectNamespace"` InvolvedObjectUID string `db:"InvolvedObjectUID"` }
EventInfo represents information about an event emitted in the k8s cluster.
type MachineDeploymentInfo ¶
type MachineDeploymentInfo struct { SnapshotMeta Replicas int PoolName string Zone string MaxSurge intstr.IntOrString MachineClassName string DeletionTimestamp time.Time Labels map[string]string Taints []corev1.Taint Hash string }
MachineDeploymentInfo represents snapshot information captured about the MCM MachineDeployment object present in the control plane of a gardener shoot cluster.
func (MachineDeploymentInfo) GetHash ¶
func (m MachineDeploymentInfo) GetHash() string
func (MachineDeploymentInfo) String ¶
func (m MachineDeploymentInfo) String() string
type NodeGroupInfo ¶
type NodeGroupInfo struct { Name string PoolName string Zone string TargetSize int MinSize int MaxSize int Hash string }
func (NodeGroupInfo) GetHash ¶
func (ng NodeGroupInfo) GetHash() string
func (NodeGroupInfo) String ¶
func (ng NodeGroupInfo) String() string
type NodeInfo ¶
type NodeInfo struct { SnapshotMeta ProviderID string AllocatableVolumes int Labels map[string]string Taints []corev1.Taint Allocatable corev1.ResourceList Capacity corev1.ResourceList DeletionTimestamp time.Time Hash string }
NodeInfo represents snapshot information captured about an active k8s Node in the cluster at a particular moment in time. . A NodeInfo snapshot is only captured if there is a change in the properties excepting for DeletionTimestamp, in which case the DeletionTimestamp is only updated.
type NodeTemplate ¶
type NodeTemplate struct { Name string //CPU resource.Quantity //GPU resource.Quantity //Memory resource.Quantity //EphemeralStorage resource.Quantity InstanceType string Region string Zone string Capacity corev1.ResourceList Allocatable corev1.ResourceList Labels map[string]string Taints []corev1.Taint Hash string }
func (NodeTemplate) GetHash ¶
func (t NodeTemplate) GetHash() string
type PodInfo ¶
type PodInfo struct { SnapshotMeta UID string NodeName string NominatedNodeName string Labels map[string]string Requests corev1.ResourceList Spec corev1.PodSpec PodScheduleStatus PodScheduleStatus DeletionTimestamp time.Time Hash string }
PodInfo represents snapshot information captured about a k8s Pod deployed into the cluster at a particular moment in time. When the `Pod` is deleted its `DeletionTimestamp` is updated.
type PodScheduleStatus ¶
type PodScheduleStatus int
type PriorityClassInfo ¶
type PriorityClassInfo struct { RowID int64 SnapshotTimestamp time.Time Hash string schedulingv1.PriorityClass }
func (PriorityClassInfo) GetHash ¶
func (p PriorityClassInfo) GetHash() string
func (PriorityClassInfo) String ¶
func (p PriorityClassInfo) String() string
type SnapshotMeta ¶
type WorkerPoolInfo ¶
type WorkerPoolInfo struct { SnapshotMeta MachineType string Architecture string Minimum int Maximum int MaxSurge intstr.IntOrString Zones []string Labels map[string]string Taints []corev1.Taint DeletionTimestamp time.Time Hash string }
WorkerPoolInfo represents snapshot information corresponding to the gardener shoot worker pool.
func (WorkerPoolInfo) GetHash ¶
func (w WorkerPoolInfo) GetHash() string
func (WorkerPoolInfo) String ¶
func (w WorkerPoolInfo) String() string