Merge pull request #24827 from mclarke47/move-to-hpa-v2
fix: move kubernetes autoscaling to v2
This commit is contained in:
@@ -33,10 +33,10 @@ import { ProfileInfoApi } from '@backstage/core-plugin-api';
|
||||
import { default as React_2 } from 'react';
|
||||
import * as React_3 from 'react';
|
||||
import { TypeMeta } from '@kubernetes-models/base';
|
||||
import { V1HorizontalPodAutoscaler } from '@kubernetes/client-node';
|
||||
import { V1Job } from '@kubernetes/client-node';
|
||||
import { V1ObjectMeta } from '@kubernetes/client-node';
|
||||
import { V1Pod } from '@kubernetes/client-node';
|
||||
import { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';
|
||||
import { WorkloadsByEntityRequest } from '@backstage/plugin-kubernetes-common';
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -285,7 +285,7 @@ export const GroupedResponsesContext: React_2.Context<GroupedResponses>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const HorizontalPodAutoscalerDrawer: (props: {
|
||||
hpa: V1HorizontalPodAutoscaler;
|
||||
hpa: V2HorizontalPodAutoscaler;
|
||||
expanded?: boolean;
|
||||
children?: React_2.ReactNode;
|
||||
}) => React_2.JSX.Element;
|
||||
|
||||
@@ -2826,85 +2826,80 @@
|
||||
],
|
||||
"horizontalPodAutoscalers": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"apiVersion": "autoscaling/v2",
|
||||
"kind": "HorizontalPodAutoscaler",
|
||||
"metadata": {
|
||||
"annotations": {
|
||||
"autoscaling.alpha.kubernetes.io/conditions": "[{\"type\":\"AbleToScale\",\"status\":\"True\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"SucceededGetScale\",\"message\":\"the HPA controller was able to get the target's current scale\"},{\"type\":\"ScalingActive\",\"status\":\"False\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"FailedGetResourceMetric\",\"message\":\"the HPA was unable to compute the replica count: unable to get metrics for resource cpu: no metrics returned from resource metrics API\"}]",
|
||||
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"autoscaling/v1\",\"kind\":\"HorizontalPodAutoscaler\",\"metadata\":{\"annotations\":{},\"labels\":{\"backstage.io/kubernetes-id\":\"dice-roller\"},\"name\":\"dice-roller\",\"namespace\":\"default\"},\"spec\":{\"maxReplicas\":15,\"minReplicas\":10,\"scaleTargetRef\":{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"name\":\"dice-roller\"},\"targetCPUUtilizationPercentage\":50}}\n"
|
||||
},
|
||||
"creationTimestamp": "2021-01-05T10:25:48Z",
|
||||
"annotations": {},
|
||||
"creationTimestamp": "2024-02-13T20:13:52Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"managedFields": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
".": {},
|
||||
"f:kubectl.kubernetes.io/last-applied-configuration": {}
|
||||
},
|
||||
"f:labels": {
|
||||
".": {},
|
||||
"f:backstage.io/kubernetes-id": {}
|
||||
}
|
||||
},
|
||||
"f:spec": {
|
||||
"f:maxReplicas": {},
|
||||
"f:minReplicas": {},
|
||||
"f:scaleTargetRef": {
|
||||
"f:apiVersion": {},
|
||||
"f:kind": {},
|
||||
"f:name": {}
|
||||
},
|
||||
"f:targetCPUUtilizationPercentage": {}
|
||||
}
|
||||
},
|
||||
"manager": "kubectl-client-side-apply",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:25:48Z"
|
||||
},
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
"f:autoscaling.alpha.kubernetes.io/conditions": {}
|
||||
}
|
||||
},
|
||||
"f:status": {
|
||||
"f:currentReplicas": {}
|
||||
}
|
||||
},
|
||||
"manager": "kube-controller-manager",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:26:04Z"
|
||||
}
|
||||
],
|
||||
"name": "dice-roller",
|
||||
"namespace": "default",
|
||||
"resourceVersion": "598",
|
||||
"selfLink": "/apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers/dice-roller",
|
||||
"uid": "dd7c5329-567c-43c2-b159-756808d90a8e"
|
||||
"resourceVersion": "6717s736",
|
||||
"uid": "a34c90e1-8e8f-407f-b4c5-b4543bd56c1b"
|
||||
},
|
||||
"spec": {
|
||||
"maxReplicas": 15,
|
||||
"minReplicas": 10,
|
||||
"maxReplicas": 2,
|
||||
"metrics": [
|
||||
{
|
||||
"resource": {
|
||||
"name": "cpu",
|
||||
"target": {
|
||||
"averageUtilization": 50,
|
||||
"type": "Utilization"
|
||||
}
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"minReplicas": 1,
|
||||
"scaleTargetRef": {
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"name": "dice-roller"
|
||||
},
|
||||
"targetCPUUtilizationPercentage": 50
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"currentReplicas": 10,
|
||||
"desiredReplicas": 0,
|
||||
"currentCPUUtilizationPercentage": 30
|
||||
"conditions": [
|
||||
{
|
||||
"lastTransitionTime": "2024-05-17T19:50:35Z",
|
||||
"message": "recent recommendations were higher than current one, applying the highest recent recommendation",
|
||||
"reason": "ScaleDownStabilized",
|
||||
"status": "True",
|
||||
"type": "AbleToScale"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)",
|
||||
"reason": "ValidMetricFound",
|
||||
"status": "True",
|
||||
"type": "ScalingActive"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the desired replica count is more than the maximum replica count",
|
||||
"reason": "TooManyReplicas",
|
||||
"status": "True",
|
||||
"type": "ScalingLimited"
|
||||
}
|
||||
],
|
||||
"currentMetrics": [
|
||||
{
|
||||
"resource": {
|
||||
"current": {
|
||||
"averageUtilization": 100,
|
||||
"averageValue": "50m",
|
||||
"value": "100m"
|
||||
},
|
||||
"name": "cpu"
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"currentReplicas": 2,
|
||||
"desiredReplicas": 2,
|
||||
"lastScaleTime": "2024-02-13T20:14:23Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -2827,85 +2827,80 @@
|
||||
],
|
||||
"horizontalPodAutoscalers": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"apiVersion": "autoscaling/v2",
|
||||
"kind": "HorizontalPodAutoscaler",
|
||||
"metadata": {
|
||||
"annotations": {
|
||||
"autoscaling.alpha.kubernetes.io/conditions": "[{\"type\":\"AbleToScale\",\"status\":\"True\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"SucceededGetScale\",\"message\":\"the HPA controller was able to get the target's current scale\"},{\"type\":\"ScalingActive\",\"status\":\"False\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"FailedGetResourceMetric\",\"message\":\"the HPA was unable to compute the replica count: unable to get metrics for resource cpu: no metrics returned from resource metrics API\"}]",
|
||||
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"autoscaling/v1\",\"kind\":\"HorizontalPodAutoscaler\",\"metadata\":{\"annotations\":{},\"labels\":{\"backstage.io/kubernetes-id\":\"dice-roller\"},\"name\":\"dice-roller\",\"namespace\":\"default\"},\"spec\":{\"maxReplicas\":15,\"minReplicas\":10,\"scaleTargetRef\":{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"name\":\"dice-roller\"},\"targetCPUUtilizationPercentage\":50}}\n"
|
||||
},
|
||||
"creationTimestamp": "2021-01-05T10:25:48Z",
|
||||
"annotations": {},
|
||||
"creationTimestamp": "2024-02-13T20:13:52Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"managedFields": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
".": {},
|
||||
"f:kubectl.kubernetes.io/last-applied-configuration": {}
|
||||
},
|
||||
"f:labels": {
|
||||
".": {},
|
||||
"f:backstage.io/kubernetes-id": {}
|
||||
}
|
||||
},
|
||||
"f:spec": {
|
||||
"f:maxReplicas": {},
|
||||
"f:minReplicas": {},
|
||||
"f:scaleTargetRef": {
|
||||
"f:apiVersion": {},
|
||||
"f:kind": {},
|
||||
"f:name": {}
|
||||
},
|
||||
"f:targetCPUUtilizationPercentage": {}
|
||||
}
|
||||
},
|
||||
"manager": "kubectl-client-side-apply",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:25:48Z"
|
||||
},
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
"f:autoscaling.alpha.kubernetes.io/conditions": {}
|
||||
}
|
||||
},
|
||||
"f:status": {
|
||||
"f:currentReplicas": {}
|
||||
}
|
||||
},
|
||||
"manager": "kube-controller-manager",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:26:04Z"
|
||||
}
|
||||
],
|
||||
"name": "dice-roller",
|
||||
"namespace": "default",
|
||||
"resourceVersion": "598",
|
||||
"selfLink": "/apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers/dice-roller",
|
||||
"uid": "dd7c5329-567c-43c2-b159-756808d90a8e"
|
||||
"resourceVersion": "6717s736",
|
||||
"uid": "a34c90e1-8e8f-407f-b4c5-b4543bd56c1b"
|
||||
},
|
||||
"spec": {
|
||||
"maxReplicas": 15,
|
||||
"minReplicas": 10,
|
||||
"maxReplicas": 2,
|
||||
"metrics": [
|
||||
{
|
||||
"resource": {
|
||||
"name": "cpu",
|
||||
"target": {
|
||||
"averageUtilization": 50,
|
||||
"type": "Utilization"
|
||||
}
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"minReplicas": 1,
|
||||
"scaleTargetRef": {
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"name": "dice-roller"
|
||||
},
|
||||
"targetCPUUtilizationPercentage": 50
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"currentReplicas": 10,
|
||||
"desiredReplicas": 0,
|
||||
"currentCPUUtilizationPercentage": 30
|
||||
"conditions": [
|
||||
{
|
||||
"lastTransitionTime": "2024-05-17T19:50:35Z",
|
||||
"message": "recent recommendations were higher than current one, applying the highest recent recommendation",
|
||||
"reason": "ScaleDownStabilized",
|
||||
"status": "True",
|
||||
"type": "AbleToScale"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)",
|
||||
"reason": "ValidMetricFound",
|
||||
"status": "True",
|
||||
"type": "ScalingActive"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the desired replica count is more than the maximum replica count",
|
||||
"reason": "TooManyReplicas",
|
||||
"status": "True",
|
||||
"type": "ScalingLimited"
|
||||
}
|
||||
],
|
||||
"currentMetrics": [
|
||||
{
|
||||
"resource": {
|
||||
"current": {
|
||||
"averageUtilization": 100,
|
||||
"averageValue": "50m",
|
||||
"value": "100m"
|
||||
},
|
||||
"name": "cpu"
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"currentReplicas": 2,
|
||||
"desiredReplicas": 2,
|
||||
"lastScaleTime": "2024-02-13T20:14:23Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -4434,85 +4434,80 @@
|
||||
],
|
||||
"horizontalPodAutoscalers": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"apiVersion": "autoscaling/v2",
|
||||
"kind": "HorizontalPodAutoscaler",
|
||||
"metadata": {
|
||||
"annotations": {
|
||||
"autoscaling.alpha.kubernetes.io/conditions": "[{\"type\":\"AbleToScale\",\"status\":\"True\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"SucceededGetScale\",\"message\":\"the HPA controller was able to get the target's current scale\"},{\"type\":\"ScalingActive\",\"status\":\"False\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"FailedGetResourceMetric\",\"message\":\"the HPA was unable to compute the replica count: unable to get metrics for resource cpu: no metrics returned from resource metrics API\"}]",
|
||||
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"autoscaling/v1\",\"kind\":\"HorizontalPodAutoscaler\",\"metadata\":{\"annotations\":{},\"labels\":{\"backstage.io/kubernetes-id\":\"dice-roller\"},\"name\":\"dice-roller\",\"namespace\":\"default\"},\"spec\":{\"maxReplicas\":15,\"minReplicas\":10,\"scaleTargetRef\":{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"name\":\"dice-roller\"},\"targetCPUUtilizationPercentage\":50}}\n"
|
||||
},
|
||||
"creationTimestamp": "2021-01-05T10:25:48Z",
|
||||
"annotations": {},
|
||||
"creationTimestamp": "2024-02-13T20:13:52Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"managedFields": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
".": {},
|
||||
"f:kubectl.kubernetes.io/last-applied-configuration": {}
|
||||
},
|
||||
"f:labels": {
|
||||
".": {},
|
||||
"f:backstage.io/kubernetes-id": {}
|
||||
}
|
||||
},
|
||||
"f:spec": {
|
||||
"f:maxReplicas": {},
|
||||
"f:minReplicas": {},
|
||||
"f:scaleTargetRef": {
|
||||
"f:apiVersion": {},
|
||||
"f:kind": {},
|
||||
"f:name": {}
|
||||
},
|
||||
"f:targetCPUUtilizationPercentage": {}
|
||||
}
|
||||
},
|
||||
"manager": "kubectl-client-side-apply",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:25:48Z"
|
||||
},
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
"f:autoscaling.alpha.kubernetes.io/conditions": {}
|
||||
}
|
||||
},
|
||||
"f:status": {
|
||||
"f:currentReplicas": {}
|
||||
}
|
||||
},
|
||||
"manager": "kube-controller-manager",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:26:04Z"
|
||||
}
|
||||
],
|
||||
"name": "dice-roller",
|
||||
"namespace": "default",
|
||||
"resourceVersion": "598",
|
||||
"selfLink": "/apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers/dice-roller",
|
||||
"uid": "dd7c5329-567c-43c2-b159-756808d90a8e"
|
||||
"resourceVersion": "6717s736",
|
||||
"uid": "a34c90e1-8e8f-407f-b4c5-b4543bd56c1b"
|
||||
},
|
||||
"spec": {
|
||||
"maxReplicas": 15,
|
||||
"metrics": [
|
||||
{
|
||||
"resource": {
|
||||
"name": "cpu",
|
||||
"target": {
|
||||
"averageUtilization": 50,
|
||||
"type": "Utilization"
|
||||
}
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"minReplicas": 10,
|
||||
"scaleTargetRef": {
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"name": "dice-roller"
|
||||
},
|
||||
"targetCPUUtilizationPercentage": 50
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"currentReplicas": 10,
|
||||
"desiredReplicas": 0,
|
||||
"currentCPUUtilizationPercentage": 30
|
||||
"conditions": [
|
||||
{
|
||||
"lastTransitionTime": "2024-05-17T19:50:35Z",
|
||||
"message": "recent recommendations were higher than current one, applying the highest recent recommendation",
|
||||
"reason": "ScaleDownStabilized",
|
||||
"status": "True",
|
||||
"type": "AbleToScale"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)",
|
||||
"reason": "ValidMetricFound",
|
||||
"status": "True",
|
||||
"type": "ScalingActive"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the desired replica count is more than the maximum replica count",
|
||||
"reason": "TooManyReplicas",
|
||||
"status": "True",
|
||||
"type": "ScalingLimited"
|
||||
}
|
||||
],
|
||||
"currentMetrics": [
|
||||
{
|
||||
"resource": {
|
||||
"current": {
|
||||
"averageUtilization": 30,
|
||||
"averageValue": "50m",
|
||||
"value": "100m"
|
||||
},
|
||||
"name": "cpu"
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"currentReplicas": 2,
|
||||
"desiredReplicas": 2,
|
||||
"lastScaleTime": "2024-02-13T20:14:23Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -4436,85 +4436,80 @@
|
||||
],
|
||||
"horizontalPodAutoscalers": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"apiVersion": "autoscaling/v2",
|
||||
"kind": "HorizontalPodAutoscaler",
|
||||
"metadata": {
|
||||
"annotations": {
|
||||
"autoscaling.alpha.kubernetes.io/conditions": "[{\"type\":\"AbleToScale\",\"status\":\"True\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"SucceededGetScale\",\"message\":\"the HPA controller was able to get the target's current scale\"},{\"type\":\"ScalingActive\",\"status\":\"False\",\"lastTransitionTime\":\"2021-01-05T10:26:04Z\",\"reason\":\"FailedGetResourceMetric\",\"message\":\"the HPA was unable to compute the replica count: unable to get metrics for resource cpu: no metrics returned from resource metrics API\"}]",
|
||||
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"autoscaling/v1\",\"kind\":\"HorizontalPodAutoscaler\",\"metadata\":{\"annotations\":{},\"labels\":{\"backstage.io/kubernetes-id\":\"dice-roller\"},\"name\":\"dice-roller\",\"namespace\":\"default\"},\"spec\":{\"maxReplicas\":15,\"minReplicas\":10,\"scaleTargetRef\":{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"name\":\"dice-roller\"},\"targetCPUUtilizationPercentage\":50}}\n"
|
||||
},
|
||||
"creationTimestamp": "2021-01-05T10:25:48Z",
|
||||
"annotations": {},
|
||||
"creationTimestamp": "2024-02-13T20:13:52Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"managedFields": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
".": {},
|
||||
"f:kubectl.kubernetes.io/last-applied-configuration": {}
|
||||
},
|
||||
"f:labels": {
|
||||
".": {},
|
||||
"f:backstage.io/kubernetes-id": {}
|
||||
}
|
||||
},
|
||||
"f:spec": {
|
||||
"f:maxReplicas": {},
|
||||
"f:minReplicas": {},
|
||||
"f:scaleTargetRef": {
|
||||
"f:apiVersion": {},
|
||||
"f:kind": {},
|
||||
"f:name": {}
|
||||
},
|
||||
"f:targetCPUUtilizationPercentage": {}
|
||||
}
|
||||
},
|
||||
"manager": "kubectl-client-side-apply",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:25:48Z"
|
||||
},
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
"f:autoscaling.alpha.kubernetes.io/conditions": {}
|
||||
}
|
||||
},
|
||||
"f:status": {
|
||||
"f:currentReplicas": {}
|
||||
}
|
||||
},
|
||||
"manager": "kube-controller-manager",
|
||||
"operation": "Update",
|
||||
"time": "2021-01-05T10:26:04Z"
|
||||
}
|
||||
],
|
||||
"name": "dice-roller",
|
||||
"namespace": "default",
|
||||
"resourceVersion": "598",
|
||||
"selfLink": "/apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers/dice-roller",
|
||||
"uid": "dd7c5329-567c-43c2-b159-756808d90a8e"
|
||||
"resourceVersion": "6717s736",
|
||||
"uid": "a34c90e1-8e8f-407f-b4c5-b4543bd56c1b"
|
||||
},
|
||||
"spec": {
|
||||
"maxReplicas": 15,
|
||||
"minReplicas": 10,
|
||||
"maxReplicas": 2,
|
||||
"metrics": [
|
||||
{
|
||||
"resource": {
|
||||
"name": "cpu",
|
||||
"target": {
|
||||
"averageUtilization": 50,
|
||||
"type": "Utilization"
|
||||
}
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"minReplicas": 1,
|
||||
"scaleTargetRef": {
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"name": "dice-roller"
|
||||
},
|
||||
"targetCPUUtilizationPercentage": 50
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"currentReplicas": 10,
|
||||
"desiredReplicas": 0,
|
||||
"currentCPUUtilizationPercentage": 30
|
||||
"conditions": [
|
||||
{
|
||||
"lastTransitionTime": "2024-05-17T19:50:35Z",
|
||||
"message": "recent recommendations were higher than current one, applying the highest recent recommendation",
|
||||
"reason": "ScaleDownStabilized",
|
||||
"status": "True",
|
||||
"type": "AbleToScale"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)",
|
||||
"reason": "ValidMetricFound",
|
||||
"status": "True",
|
||||
"type": "ScalingActive"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the desired replica count is more than the maximum replica count",
|
||||
"reason": "TooManyReplicas",
|
||||
"status": "True",
|
||||
"type": "ScalingLimited"
|
||||
}
|
||||
],
|
||||
"currentMetrics": [
|
||||
{
|
||||
"resource": {
|
||||
"current": {
|
||||
"averageUtilization": 100,
|
||||
"averageValue": "50m",
|
||||
"value": "100m"
|
||||
},
|
||||
"name": "cpu"
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"currentReplicas": 2,
|
||||
"desiredReplicas": 2,
|
||||
"lastScaleTime": "2024-02-13T20:14:23Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ import AccordionSummary from '@material-ui/core/AccordionSummary';
|
||||
import Grid from '@material-ui/core/Grid';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import { V1Pod, V1HorizontalPodAutoscaler } from '@kubernetes/client-node';
|
||||
import { V1Pod, V2HorizontalPodAutoscaler } from '@kubernetes/client-node';
|
||||
import { PodsTable } from '../../Pods';
|
||||
import { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';
|
||||
import { RolloutDrawer } from './RolloutDrawer';
|
||||
@@ -50,7 +50,7 @@ type RolloutAccordionProps = {
|
||||
rollout: any;
|
||||
ownedPods: V1Pod[];
|
||||
defaultExpanded?: boolean;
|
||||
matchingHpa?: V1HorizontalPodAutoscaler;
|
||||
matchingHpa?: V2HorizontalPodAutoscaler;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ type RolloutSummaryProps = {
|
||||
rollout: any;
|
||||
numberOfCurrentPods: number;
|
||||
numberOfPodsWithErrors: number;
|
||||
hpa?: V1HorizontalPodAutoscaler;
|
||||
hpa?: V2HorizontalPodAutoscaler;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -93,6 +93,13 @@ const RolloutSummary = ({
|
||||
(p: any) => p.reason === 'CanaryPauseStep',
|
||||
)?.startTime;
|
||||
const abortedMessage = findAbortedMessage(rollout);
|
||||
const specCpuUtil = hpa?.spec?.metrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.target.averageUtilization;
|
||||
|
||||
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.current.averageUtilization;
|
||||
|
||||
return (
|
||||
<Grid
|
||||
@@ -124,14 +131,12 @@ const RolloutSummary = ({
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="subtitle2">
|
||||
current CPU usage:{' '}
|
||||
{hpa.status?.currentCPUUtilizationPercentage ?? '?'}%
|
||||
current CPU usage: {cpuUtil ?? '?'}%
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="subtitle2">
|
||||
target CPU usage:{' '}
|
||||
{hpa.spec?.targetCPUUtilizationPercentage ?? '?'}%
|
||||
target CPU usage: {specCpuUtil ?? '?'}%
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
+13
-7
@@ -24,7 +24,7 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import {
|
||||
V1Deployment,
|
||||
V1Pod,
|
||||
V1HorizontalPodAutoscaler,
|
||||
V2HorizontalPodAutoscaler,
|
||||
} from '@kubernetes/client-node';
|
||||
import { PodsTable } from '../Pods';
|
||||
import { DeploymentDrawer } from './DeploymentDrawer';
|
||||
@@ -47,7 +47,7 @@ type DeploymentsAccordionsProps = {
|
||||
type DeploymentAccordionProps = {
|
||||
deployment: V1Deployment;
|
||||
ownedPods: V1Pod[];
|
||||
matchingHpa?: V1HorizontalPodAutoscaler;
|
||||
matchingHpa?: V2HorizontalPodAutoscaler;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ type DeploymentSummaryProps = {
|
||||
deployment: V1Deployment;
|
||||
numberOfCurrentPods: number;
|
||||
numberOfPodsWithErrors: number;
|
||||
hpa?: V1HorizontalPodAutoscaler;
|
||||
hpa?: V2HorizontalPodAutoscaler;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -65,6 +65,14 @@ const DeploymentSummary = ({
|
||||
numberOfPodsWithErrors,
|
||||
hpa,
|
||||
}: DeploymentSummaryProps) => {
|
||||
const specCpuUtil = hpa?.spec?.metrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.target.averageUtilization;
|
||||
|
||||
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.current.averageUtilization;
|
||||
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
@@ -95,14 +103,12 @@ const DeploymentSummary = ({
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="subtitle2">
|
||||
current CPU usage:{' '}
|
||||
{hpa.status?.currentCPUUtilizationPercentage ?? '?'}%
|
||||
current CPU usage: {cpuUtil ?? '?'}%
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="subtitle2">
|
||||
target CPU usage:{' '}
|
||||
{hpa.spec?.targetCPUUtilizationPercentage ?? '?'}%
|
||||
target CPU usage: {specCpuUtil ?? '?'}%
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
+14
-7
@@ -15,32 +15,39 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { V1HorizontalPodAutoscaler } from '@kubernetes/client-node';
|
||||
import { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';
|
||||
import { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';
|
||||
|
||||
/** @public */
|
||||
export const HorizontalPodAutoscalerDrawer = (props: {
|
||||
hpa: V1HorizontalPodAutoscaler;
|
||||
hpa: V2HorizontalPodAutoscaler;
|
||||
expanded?: boolean;
|
||||
children?: React.ReactNode;
|
||||
}) => {
|
||||
const { hpa, expanded, children } = props;
|
||||
|
||||
const specCpuUtil = hpa?.spec?.metrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.target.averageUtilization;
|
||||
|
||||
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.current.averageUtilization;
|
||||
|
||||
return (
|
||||
<KubernetesStructuredMetadataTableDrawer
|
||||
kind="HorizontalPodAutoscaler"
|
||||
object={hpa}
|
||||
expanded={expanded}
|
||||
renderObject={(hpaObject: V1HorizontalPodAutoscaler) => {
|
||||
renderObject={(hpaObject: V2HorizontalPodAutoscaler) => {
|
||||
return {
|
||||
targetCPUUtilizationPercentage:
|
||||
hpaObject.spec?.targetCPUUtilizationPercentage,
|
||||
currentCPUUtilizationPercentage:
|
||||
hpaObject.status?.currentCPUUtilizationPercentage,
|
||||
targetCPUUtilizationPercentage: specCpuUtil,
|
||||
currentCPUUtilizationPercentage: cpuUtil,
|
||||
minReplicas: hpaObject.spec?.minReplicas,
|
||||
maxReplicas: hpaObject.spec?.maxReplicas,
|
||||
currentReplicas: hpaObject.status?.currentReplicas,
|
||||
desiredReplicas: hpaObject.status?.desiredReplicas,
|
||||
lastScaleTime: hpa?.status?.lastScaleTime,
|
||||
};
|
||||
}}
|
||||
>
|
||||
|
||||
+56
-59
@@ -1,82 +1,79 @@
|
||||
[
|
||||
{
|
||||
"apiVersion": "autoscaling/v2",
|
||||
"kind": "HorizontalPodAutoscaler",
|
||||
"metadata": {
|
||||
"annotations": {
|
||||
"autoscaling.alpha.kubernetes.io/conditions": "[{\"type\":\"AbleToScale\",\"status\":\"True\",\"lastTransitionTime\":\"2020-09-28T13:28:15Z\",\"reason\":\"SucceededGetScale\",\"message\":\"the HPA controller was able to get the target's current scale\"},{\"type\":\"ScalingActive\",\"status\":\"False\",\"lastTransitionTime\":\"2020-09-28T13:28:15Z\",\"reason\":\"FailedGetResourceMetric\",\"message\":\"the HPA was unable to compute the replica count: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)\"}]",
|
||||
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"autoscaling/v1\",\"kind\":\"HorizontalPodAutoscaler\",\"metadata\":{\"annotations\":{},\"labels\":{\"backstage.io/kubernetes-id\":\"dice-roller\"},\"name\":\"dice-roller\",\"namespace\":\"default\"},\"spec\":{\"maxReplicas\":15,\"minReplicas\":10,\"scaleTargetRef\":{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"name\":\"dice-roller\"},\"targetCPUUtilizationPercentage\":50}}\n"
|
||||
},
|
||||
"creationTimestamp": "2020-09-28T13:28:00.000Z",
|
||||
"annotations": {},
|
||||
"creationTimestamp": "2024-02-13T20:13:52Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"managedFields": [
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
"f:autoscaling.alpha.kubernetes.io/conditions": {}
|
||||
}
|
||||
},
|
||||
"f:status": {
|
||||
"f:currentReplicas": {}
|
||||
}
|
||||
},
|
||||
"manager": "kube-controller-manager",
|
||||
"operation": "Update",
|
||||
"time": "2020-09-28T13:28:15.000Z"
|
||||
},
|
||||
{
|
||||
"apiVersion": "autoscaling/v1",
|
||||
"fieldsType": "FieldsV1",
|
||||
"fieldsV1": {
|
||||
"f:metadata": {
|
||||
"f:annotations": {
|
||||
".": {},
|
||||
"f:kubectl.kubernetes.io/last-applied-configuration": {}
|
||||
},
|
||||
"f:labels": {
|
||||
".": {},
|
||||
"f:backstage.io/kubernetes-id": {}
|
||||
}
|
||||
},
|
||||
"f:spec": {
|
||||
"f:maxReplicas": {},
|
||||
"f:minReplicas": {},
|
||||
"f:scaleTargetRef": {
|
||||
"f:apiVersion": {},
|
||||
"f:kind": {},
|
||||
"f:name": {}
|
||||
},
|
||||
"f:targetCPUUtilizationPercentage": {}
|
||||
}
|
||||
},
|
||||
"manager": "kubectl",
|
||||
"operation": "Update",
|
||||
"time": "2020-09-28T13:28:21.000Z"
|
||||
}
|
||||
],
|
||||
"name": "dice-roller",
|
||||
"namespace": "default",
|
||||
"resourceVersion": "698957",
|
||||
"selfLink": "/apis/autoscaling/v1/namespaces/default/horizontalpodautoscalers/dice-roller",
|
||||
"uid": "a70c8a90-5605-4d7d-adea-05cfb8d9d446"
|
||||
"resourceVersion": "6717s736",
|
||||
"uid": "a34c90e1-8e8f-407f-b4c5-b4543bd56c1b"
|
||||
},
|
||||
"spec": {
|
||||
"maxReplicas": 15,
|
||||
"metrics": [
|
||||
{
|
||||
"resource": {
|
||||
"name": "cpu",
|
||||
"target": {
|
||||
"averageUtilization": 30,
|
||||
"type": "Utilization"
|
||||
}
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"minReplicas": 10,
|
||||
"scaleTargetRef": {
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"name": "dice-roller"
|
||||
},
|
||||
"targetCPUUtilizationPercentage": 50
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"conditions": [
|
||||
{
|
||||
"lastTransitionTime": "2024-05-17T19:50:35Z",
|
||||
"message": "recent recommendations were higher than current one, applying the highest recent recommendation",
|
||||
"reason": "ScaleDownStabilized",
|
||||
"status": "True",
|
||||
"type": "AbleToScale"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)",
|
||||
"reason": "ValidMetricFound",
|
||||
"status": "True",
|
||||
"type": "ScalingActive"
|
||||
},
|
||||
{
|
||||
"lastTransitionTime": "2024-05-16T06:21:01Z",
|
||||
"message": "the desired replica count is more than the maximum replica count",
|
||||
"reason": "TooManyReplicas",
|
||||
"status": "True",
|
||||
"type": "ScalingLimited"
|
||||
}
|
||||
],
|
||||
"currentMetrics": [
|
||||
{
|
||||
"resource": {
|
||||
"current": {
|
||||
"averageUtilization": 50,
|
||||
"averageValue": "50m",
|
||||
"value": "100m"
|
||||
},
|
||||
"name": "cpu"
|
||||
},
|
||||
"type": "Resource"
|
||||
}
|
||||
],
|
||||
"currentReplicas": 13,
|
||||
"desiredReplicas": 14,
|
||||
"currentCPUUtilizationPercentage": 30
|
||||
"lastScaleTime": "2024-02-13T20:14:23Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
+13
-7
@@ -23,7 +23,7 @@ import Typography from '@material-ui/core/Typography';
|
||||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import {
|
||||
V1Pod,
|
||||
V1HorizontalPodAutoscaler,
|
||||
V2HorizontalPodAutoscaler,
|
||||
V1StatefulSet,
|
||||
} from '@kubernetes/client-node';
|
||||
import { PodsTable } from '../Pods';
|
||||
@@ -44,7 +44,7 @@ type StatefulSetsAccordionsProps = {
|
||||
type StatefulSetAccordionProps = {
|
||||
statefulset: V1StatefulSet;
|
||||
ownedPods: V1Pod[];
|
||||
matchingHpa?: V1HorizontalPodAutoscaler;
|
||||
matchingHpa?: V2HorizontalPodAutoscaler;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ type StatefulSetSummaryProps = {
|
||||
statefulset: V1StatefulSet;
|
||||
numberOfCurrentPods: number;
|
||||
numberOfPodsWithErrors: number;
|
||||
hpa?: V1HorizontalPodAutoscaler;
|
||||
hpa?: V2HorizontalPodAutoscaler;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -62,6 +62,14 @@ const StatefulSetSummary = ({
|
||||
numberOfPodsWithErrors,
|
||||
hpa,
|
||||
}: StatefulSetSummaryProps) => {
|
||||
const specCpuUtil = hpa?.spec?.metrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.target.averageUtilization;
|
||||
|
||||
const cpuUtil = hpa?.status?.currentMetrics?.find(
|
||||
metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',
|
||||
)?.resource?.current.averageUtilization;
|
||||
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
@@ -92,14 +100,12 @@ const StatefulSetSummary = ({
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="subtitle2">
|
||||
current CPU usage:{' '}
|
||||
{hpa.status?.currentCPUUtilizationPercentage ?? '?'}%
|
||||
current CPU usage: {cpuUtil ?? '?'}%
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
<Typography variant="subtitle2">
|
||||
target CPU usage:{' '}
|
||||
{hpa.spec?.targetCPUUtilizationPercentage ?? '?'}%
|
||||
target CPU usage: {specCpuUtil ?? '?'}%
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { V1ObjectMeta } from '@kubernetes/client-node/dist/gen/model/v1ObjectMeta';
|
||||
import {
|
||||
V1HorizontalPodAutoscaler,
|
||||
V2HorizontalPodAutoscaler,
|
||||
V1Pod,
|
||||
V1ReplicaSet,
|
||||
} from '@kubernetes/client-node';
|
||||
@@ -62,8 +62,8 @@ interface ResourceRef {
|
||||
|
||||
export const getMatchingHpa = (
|
||||
owner: ResourceRef,
|
||||
hpas: V1HorizontalPodAutoscaler[],
|
||||
): V1HorizontalPodAutoscaler | undefined => {
|
||||
hpas: V2HorizontalPodAutoscaler[],
|
||||
): V2HorizontalPodAutoscaler | undefined => {
|
||||
return hpas.find(hpa => {
|
||||
return (
|
||||
(hpa.spec?.scaleTargetRef?.kind ?? '').toLocaleLowerCase('en-US') ===
|
||||
|
||||
Reference in New Issue
Block a user