From 4f232777f58662c2be34f87077c8791572ed48ad Mon Sep 17 00:00:00 2001 From: hugulfma Date: Wed, 11 Sep 2024 14:34:46 +0200 Subject: [PATCH 1/4] AME-3041 Add support for cluster autoscaler settings --- pkg/acloudapi/apitypes.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/acloudapi/apitypes.go b/pkg/acloudapi/apitypes.go index c59dc5e..fc3a4b3 100644 --- a/pkg/acloudapi/apitypes.go +++ b/pkg/acloudapi/apitypes.go @@ -60,6 +60,7 @@ type Cluster struct { ObservabilityTenant *ObservabilityTenant `json:"observabilityTenant,omitempty" yaml:"ObservabilityTenant,omitempty"` EnvironmentPrometheusRules bool `json:"environmentPrometheusRules" yaml:"EnvironmentPrometheusRules"` MaintenanceSchedule *MaintenanceSchedule `json:"maintenanceSchedule,omitempty" yaml:"MaintenanceSchedule,omitempty"` + AutoScalerSettings map[string]string `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } type MaintenanceSchedule struct { @@ -152,6 +153,8 @@ type CreateCluster struct { NodePools []NodePools `json:"nodePools" yaml:"NodePools"` IPWhitelist []IPWhitelistEntry `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` + + AutoScalerSettings map[string]string `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } // IPWhitelistEntry represents an entry in the IP whitelist. @@ -176,6 +179,7 @@ type UpdateCluster struct { DeleteProtection *bool `json:"deleteProtection,omitempty" yaml:"DeleteProtection,omitempty"` IPWhitelist []string `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` + AutoScalerSettings map[string]string `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } // NodePools is used by CreateCluster From c45818a787abc749701b1d40141721750c67dde0 Mon Sep 17 00:00:00 2001 From: hugulfma Date: Mon, 16 Sep 2024 14:03:43 +0200 Subject: [PATCH 2/4] AME-3041 update MR after changes made to platform-api --- pkg/acloudapi/apitypes.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/pkg/acloudapi/apitypes.go b/pkg/acloudapi/apitypes.go index fc3a4b3..10291fd 100644 --- a/pkg/acloudapi/apitypes.go +++ b/pkg/acloudapi/apitypes.go @@ -60,7 +60,7 @@ type Cluster struct { ObservabilityTenant *ObservabilityTenant `json:"observabilityTenant,omitempty" yaml:"ObservabilityTenant,omitempty"` EnvironmentPrometheusRules bool `json:"environmentPrometheusRules" yaml:"EnvironmentPrometheusRules"` MaintenanceSchedule *MaintenanceSchedule `json:"maintenanceSchedule,omitempty" yaml:"MaintenanceSchedule,omitempty"` - AutoScalerSettings map[string]string `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` + AutoScalerSettings AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } type MaintenanceSchedule struct { @@ -154,7 +154,7 @@ type CreateCluster struct { IPWhitelist []IPWhitelistEntry `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` - AutoScalerSettings map[string]string `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` + AutoScalerSettings AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } // IPWhitelistEntry represents an entry in the IP whitelist. @@ -179,7 +179,7 @@ type UpdateCluster struct { DeleteProtection *bool `json:"deleteProtection,omitempty" yaml:"DeleteProtection,omitempty"` IPWhitelist []string `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` - AutoScalerSettings map[string]string `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` + AutoScalerSettings AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } // NodePools is used by CreateCluster @@ -429,3 +429,20 @@ type ListScheduledClusterUpgradesOpts struct { ClusterIdentities []string Statuses []ScheduledClusterUpgradeStatus } + +type AutoscalingSettings struct { + // ScaleDownUtilizationThreshold specifies the scale down utilization threshold + ScaleDownUtilizationThreshold string `json:"scale-down-utilization-threshold"` + // ScaleDownGpuUtilizationThreshold specifies the scale down GPU utilization threshold + ScaleDownGpuUtilizationThreshold string `json:"scale-down-gpu-utilization-threshold"` + // ScaleDownDelayAfterAdd specifies the scale down delay after add + ScaleDownDelayAfterAdd string `json:"scale-down-delay-after-add"` + // ScaleDownUnneededTime specifies the scale down unneeded time + ScaleDownUnneededTime string `json:"scale-down-unneeded-time"` + // ScaleDownUnreadyTime specifies the scale down unready time + ScaleDownUnreadyTime string `json:"scale-down-unready-time"` + // MaxNodeProvisionTime specifies the max node provision time + MaxNodeProvisionTime string `json:"max-node-provision-time"` + // UnremovableNodeRecheckTimeout specifies the unremovable node recheck timeout + UnremovableNodeRecheckTimeout string `json:"unremovable-node-recheck-timeout"` +} From c3850b6dcafd828265f52b077cc7f9a498b60b02 Mon Sep 17 00:00:00 2001 From: hugulfma Date: Thu, 3 Oct 2024 10:35:15 +0200 Subject: [PATCH 3/4] AME-3041 Turn CreateCluster and Cluster autoscaler settings into pointers --- pkg/acloudapi/apitypes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/acloudapi/apitypes.go b/pkg/acloudapi/apitypes.go index 10291fd..7842087 100644 --- a/pkg/acloudapi/apitypes.go +++ b/pkg/acloudapi/apitypes.go @@ -60,7 +60,7 @@ type Cluster struct { ObservabilityTenant *ObservabilityTenant `json:"observabilityTenant,omitempty" yaml:"ObservabilityTenant,omitempty"` EnvironmentPrometheusRules bool `json:"environmentPrometheusRules" yaml:"EnvironmentPrometheusRules"` MaintenanceSchedule *MaintenanceSchedule `json:"maintenanceSchedule,omitempty" yaml:"MaintenanceSchedule,omitempty"` - AutoScalerSettings AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` + AutoScalerSettings *AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } type MaintenanceSchedule struct { @@ -154,7 +154,7 @@ type CreateCluster struct { IPWhitelist []IPWhitelistEntry `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` - AutoScalerSettings AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` + AutoScalerSettings *AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` } // IPWhitelistEntry represents an entry in the IP whitelist. From eb62d493f548d501e65c7e6a791e917de31c4eba Mon Sep 17 00:00:00 2001 From: hugulfma Date: Thu, 3 Oct 2024 13:10:56 +0200 Subject: [PATCH 4/4] AME-3041 Turn autoscaler settings into pointer on UpdateCluster --- pkg/acloudapi/apitypes.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/acloudapi/apitypes.go b/pkg/acloudapi/apitypes.go index 6ccc03b..0c78abb 100644 --- a/pkg/acloudapi/apitypes.go +++ b/pkg/acloudapi/apitypes.go @@ -154,8 +154,8 @@ type CreateCluster struct { IPWhitelist []IPWhitelistEntry `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` - AutoScalerSettings *AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` - MaintenanceScheduleIdentity string `json:"maintenanceScheduleIdentity,omitempty" yaml:"MaintenanceScheduleIdentity,omitempty"` + AutoScalerSettings *AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` + MaintenanceScheduleIdentity string `json:"maintenanceScheduleIdentity,omitempty" yaml:"MaintenanceScheduleIdentity,omitempty"` } // IPWhitelistEntry represents an entry in the IP whitelist. @@ -175,13 +175,13 @@ type UpdateCluster struct { EnableAutoUpgrade *bool `json:"enableAutoUpgrade,omitempty" yaml:"EnableAutoUpgrade,omitempty"` EnableHighAvailability *bool `json:"enableHighAvailability,omitempty" yaml:"EnableHighAvailability,omitempty"` // Deprecated: replaced by PodSecurityStandardsProfile which offers support for selecting a specific default PSS profile. This setting does not do anything since Kubernetes v1.23 - EnablePodSecurityStandards *bool `json:"enablePodSecurityStandards,omitempty" yaml:"EnablePodSecurityStandards,omitempty"` - PodSecurityStandardsProfile *string `json:"podSecurityStandardsProfile,omitempty" yaml:"PodSecurityStandardsProfile,omitempty"` - DeleteProtection *bool `json:"deleteProtection,omitempty" yaml:"DeleteProtection,omitempty"` - IPWhitelist []string `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` - Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` - AutoScalerSettings AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` - MaintenanceScheduleIdentity *string `json:"maintenanceScheduleIdentity,omitempty" yaml:"MaintenanceScheduleIdentity,omitempty"` + EnablePodSecurityStandards *bool `json:"enablePodSecurityStandards,omitempty" yaml:"EnablePodSecurityStandards,omitempty"` + PodSecurityStandardsProfile *string `json:"podSecurityStandardsProfile,omitempty" yaml:"PodSecurityStandardsProfile,omitempty"` + DeleteProtection *bool `json:"deleteProtection,omitempty" yaml:"DeleteProtection,omitempty"` + IPWhitelist []string `json:"ipWhitelist,omitempty" yaml:"IpWhitelist,omitempty"` + Addons map[string]APIAddon `json:"addons,omitempty" yaml:"Addons,omitempty"` + AutoScalerSettings *AutoscalingSettings `json:"clusterAutoscalerSettings,omitempty" yaml:"ClusterAutoScalerSettings,omitempty"` + MaintenanceScheduleIdentity *string `json:"maintenanceScheduleIdentity,omitempty" yaml:"MaintenanceScheduleIdentity,omitempty"` } // NodePools is used by CreateCluster