Skip to content

Commit

Permalink
Merge pull request #747 from osherdp/feature/configuring-cluster-auto…
Browse files Browse the repository at this point in the history
…scaler

OCM-209 | feat: Add cluster autoscaler structs to cluster model
  • Loading branch information
zgalor authored Jun 20, 2023
2 parents 88638fe + daebc5f commit 081b2bf
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 0 deletions.
29 changes: 29 additions & 0 deletions model/clusters_mgmt/v1/autoscaler_resource_limits_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright (c) 2023 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

struct AutoscalerResourceLimits {
// Maximum number of nodes in all node groups.
// Cluster autoscaler will not grow the cluster beyond this number.
MaxNodesTotal Integer

// Minimum and maximum number of cores in cluster, in the format <min>:<max>.
// Cluster autoscaler will not scale the cluster beyond these numbers.
Cores ResourceRange

// Minimum and maximum number of gigabytes of memory in cluster, in the format <min>:<max>.
// Cluster autoscaler will not scale the cluster beyond these numbers.
Memory ResourceRange
}
35 changes: 35 additions & 0 deletions model/clusters_mgmt/v1/autoscaler_scale_down_config_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
Copyright (c) 2023 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

struct AutoscalerScaleDownConfig {
// Should cluster-autoscaler scale down the cluster.
Enabled Boolean

// How long a node should be unneeded before it is eligible for scale down.
UnneededTime String

// Node utilization level, defined as sum of requested resources divided by capacity, below which a node can be considered for scale down.
UtilizationThreshold String

// How long after scale up that scale down evaluation resumes.
DelayAfterAdd String

// How long after node deletion that scale down evaluation resumes, defaults to scan-interval.
DelayAfterDelete String

// How long after scale down failure that scale down evaluation resumes.
DelayAfterFailure String
}
41 changes: 41 additions & 0 deletions model/clusters_mgmt/v1/cluster_autoscaler_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright (c) 2023 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Cluster-wide autoscaling configuration.
struct ClusterAutoscaler {
// BalanceSimilarNodeGroups enables/disables the
// `--balance-similar-node-groups` cluster-autocaler feature.
// This feature will automatically identify node groups with
// the same instance type and the same set of labels and try
// to keep the respective sizes of those node groups balanced.
BalanceSimilarNodeGroups Boolean

// Enables/Disables `--skip-nodes-with-local-storage` CA feature flag. If true cluster autoscaler will never delete nodes with pods with local storage, e.g. EmptyDir or HostPath. true by default at autoscaler.
SkipNodesWithLocalStorage Boolean

// Sets the autoscaler log level.
// Default value is 1, level 4 is recommended for DEBUGGING and level 6 will enable almost everything.
LogVerbosity Integer

// Gives pods graceful termination time before scaling down.
MaxPodGracePeriod Integer

// Constraints of autoscaling resources.
ResourceLimits AutoscalerResourceLimits

// Configuration of scale down operation.
ScaleDown AutoscalerScaleDownConfig
}
3 changes: 3 additions & 0 deletions model/clusters_mgmt/v1/cluster_type.model
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class Cluster {
// Proxy.
Proxy Proxy

// Autoscaler.
Autoscaler ClusterAutoscaler

// Additional trust bundle.
AdditionalTrustBundle String

Expand Down
20 changes: 20 additions & 0 deletions model/clusters_mgmt/v1/resource_range_type.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Copyright (c) 2023 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

struct ResourceRange {
Min Integer
Max Integer
}

0 comments on commit 081b2bf

Please sign in to comment.