From c58a0eb068bcd127e9fbc59d2e09c96ed015d081 Mon Sep 17 00:00:00 2001 From: Kunju Perath Date: Tue, 7 Jan 2025 15:17:28 -0500 Subject: [PATCH 1/4] Update API definitions and responses to reflect cluster_autoscaler_configuration support --- .../resources/kubernetes/models/cluster.yml | 31 ++++++++++--------- .../cluster_autoscaler_configuration.yml | 13 ++++++++ .../kubernetes/models/cluster_update.yml | 15 +++++---- .../kubernetes/responses/examples.yml | 15 +++++++++ 4 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml diff --git a/specification/resources/kubernetes/models/cluster.yml b/specification/resources/kubernetes/models/cluster.yml index 6411eb76..d4302a3a 100644 --- a/specification/resources/kubernetes/models/cluster.yml +++ b/specification/resources/kubernetes/models/cluster.yml @@ -67,10 +67,10 @@ properties: items: type: string example: - - k8s - - k8s:bd5f5959-5e1e-4205-a714-a914373942af - - production - - web-team + - k8s + - k8s:bd5f5959-5e1e-4205-a714-a914373942af + - production + - web-team description: An array of tags applied to the Kubernetes cluster. All clusters are automatically tagged `k8s` and `k8s:$K8S_CLUSTER_ID`. @@ -79,10 +79,10 @@ properties: description: An object specifying the details of the worker nodes available to the Kubernetes cluster. items: - $ref: 'node_pool.yml#/kubernetes_node_pool' + $ref: "node_pool.yml#/kubernetes_node_pool" maintenance_policy: - $ref: 'maintenance_policy.yml' + $ref: "maintenance_policy.yml" auto_upgrade: type: boolean @@ -100,13 +100,13 @@ properties: state: type: string enum: - - running - - provisioning - - degraded - - error - - deleted - - upgrading - - deleting + - running + - provisioning + - degraded + - error + - deleted + - upgrading + - deleting example: provisioning description: A string indicating the current status of the cluster. message: @@ -156,7 +156,10 @@ properties: integrated with the cluster. control_plane_firewall: - $ref: 'control_plane_firewall.yml' + $ref: "control_plane_firewall.yml" + + cluster_autoscaler_configuration: + $ref: "cluster_autoscaler_configuration.yml" required: - name diff --git a/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml b/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml new file mode 100644 index 00000000..095d0608 --- /dev/null +++ b/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml @@ -0,0 +1,13 @@ +type: object +nullable: true +description: An object specifying custom cluster autoscaler configuration. +properties: + scaleDownUtilizationThreshold: + type: float + description: Used to customize when cluster autoscaler scales down non-empty nodes by setting the node utilization threshold. + example: 0.65 + + scaleDownUnneededTime: + type: string + description: Used to customize how long a node is unneeded before being scaled down. + example: "1m0s" diff --git a/specification/resources/kubernetes/models/cluster_update.yml b/specification/resources/kubernetes/models/cluster_update.yml index 5fcc7b02..50eda6c4 100644 --- a/specification/resources/kubernetes/models/cluster_update.yml +++ b/specification/resources/kubernetes/models/cluster_update.yml @@ -11,15 +11,15 @@ properties: items: type: string example: - - k8s - - k8s:bd5f5959-5e1e-4205-a714-a914373942af - - production - - web-team + - k8s + - k8s:bd5f5959-5e1e-4205-a714-a914373942af + - production + - web-team description: An array of tags applied to the Kubernetes cluster. All clusters are automatically tagged `k8s` and `k8s:$K8S_CLUSTER_ID`. maintenance_policy: - $ref: 'maintenance_policy.yml' + $ref: "maintenance_policy.yml" auto_upgrade: type: boolean @@ -46,7 +46,10 @@ properties: control planes incur less downtime. The property cannot be disabled. control_plane_firewall: - $ref: 'control_plane_firewall.yml' + $ref: "control_plane_firewall.yml" + + cluster_autoscaler_configuration: + $ref: "cluster_autoscaler_configuration.yml" required: - name diff --git a/specification/resources/kubernetes/responses/examples.yml b/specification/resources/kubernetes/responses/examples.yml index 05079644..4b88b995 100644 --- a/specification/resources/kubernetes/responses/examples.yml +++ b/specification/resources/kubernetes/responses/examples.yml @@ -103,6 +103,9 @@ kubernetes_clusters_all: allowed_addresses: - "1.2.3.4/32" - "1.1.0.0/16" + cluster_autoscaler_configuration: + scaleDownUtilizationThreshold: 0.65 + scaleDownUnneededTime: "1m" meta: total: 1 @@ -210,6 +213,9 @@ kubernetes_single: allowed_addresses: - "1.2.3.4/32" - "1.1.0.0/16" + cluster_autoscaler_configuration: + scaleDownUtilizationThreshold: 0.65 + scaleDownUnneededTime: "1m" kubernetes_updated: value: @@ -315,6 +321,9 @@ kubernetes_updated: allowed_addresses: - "1.2.3.4/32" - "1.1.0.0/16" + cluster_autoscaler_configuration: + scaleDownUtilizationThreshold: 0.65 + scaleDownUnneededTime: "1m" kubernetes_clusters_create_basic_response: value: @@ -385,6 +394,9 @@ kubernetes_clusters_create_basic_response: allowed_addresses: - "1.2.3.4/32" - "1.1.0.0/16" + cluster_autoscaler_configuration: + scaleDownUtilizationThreshold: 0.65 + scaleDownUnneededTime: "1m" kubernetes_clusters_multi_pool_response: value: @@ -492,6 +504,9 @@ kubernetes_clusters_multi_pool_response: allowed_addresses: - "1.2.3.4/32" - "1.1.0.0/16" + cluster_autoscaler_configuration: + scaleDownUtilizationThreshold: 0.65 + scaleDownUnneededTime: "1m" kubernetes_options: value: From bb95cd47dda5b94d1dcdeb7d3df901a50c8db176 Mon Sep 17 00:00:00 2001 From: Kunju Perath Date: Tue, 7 Jan 2025 15:26:43 -0500 Subject: [PATCH 2/4] Fix type float --- .../kubernetes/models/cluster_autoscaler_configuration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml b/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml index 095d0608..c1fcf9fa 100644 --- a/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml +++ b/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml @@ -3,7 +3,7 @@ nullable: true description: An object specifying custom cluster autoscaler configuration. properties: scaleDownUtilizationThreshold: - type: float + type: number description: Used to customize when cluster autoscaler scales down non-empty nodes by setting the node utilization threshold. example: 0.65 From 008c4e242a32a68ca9c11a8ff1589c2af0e8c431 Mon Sep 17 00:00:00 2001 From: Kunju Perath Date: Tue, 7 Jan 2025 15:30:31 -0500 Subject: [PATCH 3/4] Undo linter --- .../resources/kubernetes/models/cluster_update.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/specification/resources/kubernetes/models/cluster_update.yml b/specification/resources/kubernetes/models/cluster_update.yml index 50eda6c4..33f8fb51 100644 --- a/specification/resources/kubernetes/models/cluster_update.yml +++ b/specification/resources/kubernetes/models/cluster_update.yml @@ -11,15 +11,15 @@ properties: items: type: string example: - - k8s - - k8s:bd5f5959-5e1e-4205-a714-a914373942af - - production - - web-team + - k8s + - k8s:bd5f5959-5e1e-4205-a714-a914373942af + - production + - web-team description: An array of tags applied to the Kubernetes cluster. All clusters are automatically tagged `k8s` and `k8s:$K8S_CLUSTER_ID`. maintenance_policy: - $ref: "maintenance_policy.yml" + $ref: 'maintenance_policy.yml' auto_upgrade: type: boolean @@ -46,10 +46,10 @@ properties: control planes incur less downtime. The property cannot be disabled. control_plane_firewall: - $ref: "control_plane_firewall.yml" + $ref: 'control_plane_firewall.yml' cluster_autoscaler_configuration: - $ref: "cluster_autoscaler_configuration.yml" + $ref: 'cluster_autoscaler_configuration.yml' required: - name From 44a79fdcbb0d23cdc7e9d444c87fabc3c5a2b16b Mon Sep 17 00:00:00 2001 From: Kunju Perath Date: Tue, 7 Jan 2025 18:15:36 -0500 Subject: [PATCH 4/4] Fix casing --- .../cluster_autoscaler_configuration.yml | 4 ++-- .../kubernetes/responses/examples.yml | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml b/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml index c1fcf9fa..420e1aea 100644 --- a/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml +++ b/specification/resources/kubernetes/models/cluster_autoscaler_configuration.yml @@ -2,12 +2,12 @@ type: object nullable: true description: An object specifying custom cluster autoscaler configuration. properties: - scaleDownUtilizationThreshold: + scale_down_utilization_threshold: type: number description: Used to customize when cluster autoscaler scales down non-empty nodes by setting the node utilization threshold. example: 0.65 - scaleDownUnneededTime: + scale_down_unneeded_time: type: string description: Used to customize how long a node is unneeded before being scaled down. example: "1m0s" diff --git a/specification/resources/kubernetes/responses/examples.yml b/specification/resources/kubernetes/responses/examples.yml index 4b88b995..5f989e8c 100644 --- a/specification/resources/kubernetes/responses/examples.yml +++ b/specification/resources/kubernetes/responses/examples.yml @@ -104,8 +104,8 @@ kubernetes_clusters_all: - "1.2.3.4/32" - "1.1.0.0/16" cluster_autoscaler_configuration: - scaleDownUtilizationThreshold: 0.65 - scaleDownUnneededTime: "1m" + scale_down_utilization_threshold: 0.65 + scale_down_unneeded_time: "1m" meta: total: 1 @@ -214,8 +214,8 @@ kubernetes_single: - "1.2.3.4/32" - "1.1.0.0/16" cluster_autoscaler_configuration: - scaleDownUtilizationThreshold: 0.65 - scaleDownUnneededTime: "1m" + scale_down_utilization_threshold: 0.65 + scale_down_unneeded_time: "1m" kubernetes_updated: value: @@ -322,8 +322,8 @@ kubernetes_updated: - "1.2.3.4/32" - "1.1.0.0/16" cluster_autoscaler_configuration: - scaleDownUtilizationThreshold: 0.65 - scaleDownUnneededTime: "1m" + scale_down_utilization_threshold: 0.65 + scale_down_unneeded_time: "1m" kubernetes_clusters_create_basic_response: value: @@ -395,8 +395,8 @@ kubernetes_clusters_create_basic_response: - "1.2.3.4/32" - "1.1.0.0/16" cluster_autoscaler_configuration: - scaleDownUtilizationThreshold: 0.65 - scaleDownUnneededTime: "1m" + scale_down_utilization_threshold: 0.65 + scale_down_unneeded_time: "1m" kubernetes_clusters_multi_pool_response: value: @@ -505,8 +505,8 @@ kubernetes_clusters_multi_pool_response: - "1.2.3.4/32" - "1.1.0.0/16" cluster_autoscaler_configuration: - scaleDownUtilizationThreshold: 0.65 - scaleDownUnneededTime: "1m" + scale_down_utilization_threshold: 0.65 + scale_down_unneeded_time: "1m" kubernetes_options: value: