Skip to content

Commit 7b06a4f

Browse files
Reordering HPA metrics to match HPA ordering
This addresses an issue when using ArgoCD (and maybe other GitOps operators) where Kubernetes reorders the objects under the spec.metrics key thus causing Sync issues with ArgoCD. Originally reported to the ArgoCD project here: argoproj/argo-cd#1079 Originally reported to the Kubernetes project here: kubernetes/kubernetes#74099 Other projects and companies have also addressed this by simply reordering the metrics section: * kubernetes/ingress-nginx#10043 * nginx/kubernetes-ingress#3773 * grafana/helm-charts#758 * open-telemetry/opentelemetry-helm-charts#103 * Nextdoor/k8s-charts#102 Signed-off-by: Patrick O’Brien <[email protected]>
1 parent 9ceeaf0 commit 7b06a4f

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

deploy/helm/sumologic/templates/logs/common/hpa.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ spec:
1818
minReplicas: {{ .Values.metadata.logs.autoscaling.minReplicas }}
1919
maxReplicas: {{ .Values.metadata.logs.autoscaling.maxReplicas }}
2020
metrics:
21+
{{- if .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
2122
- type: Resource
2223
resource:
23-
name: cpu
24+
name: memory
2425
target:
2526
type: Utilization
26-
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetCPUUtilizationPercentage }}
27-
{{- if .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
27+
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
28+
{{- end }}
2829
- type: Resource
2930
resource:
30-
name: memory
31+
name: cpu
3132
target:
3233
type: Utilization
33-
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
34-
{{- end -}}
34+
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetCPUUtilizationPercentage }}
3535
{{- end -}}

deploy/helm/sumologic/templates/logs/fluentd/hpa.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ spec:
1818
minReplicas: {{ .Values.fluentd.logs.autoscaling.minReplicas }}
1919
maxReplicas: {{ .Values.fluentd.logs.autoscaling.maxReplicas }}
2020
metrics:
21-
- type: Resource
22-
resource:
23-
name: cpu
24-
target:
25-
type: Utilization
26-
averageUtilization: {{ .Values.fluentd.logs.autoscaling.targetCPUUtilizationPercentage }}
2721
{{- if .Values.fluentd.logs.autoscaling.targetMemoryUtilizationPercentage }}
2822
- type: Resource
2923
resource:
@@ -32,4 +26,10 @@ spec:
3226
type: Utilization
3327
averageUtilization: {{ .Values.fluentd.logs.autoscaling.targetMemoryUtilizationPercentage }}
3428
{{- end -}}
29+
- type: Resource
30+
resource:
31+
name: cpu
32+
target:
33+
type: Utilization
34+
averageUtilization: {{ .Values.fluentd.logs.autoscaling.targetCPUUtilizationPercentage }}
3535
{{- end -}}

deploy/helm/sumologic/templates/metrics/common/hpa.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ spec:
1818
minReplicas: {{ .Values.metadata.metrics.autoscaling.minReplicas }}
1919
maxReplicas: {{ .Values.metadata.metrics.autoscaling.maxReplicas }}
2020
metrics:
21-
- type: Resource
22-
resource:
23-
name: cpu
24-
target:
25-
type: Utilization
26-
averageUtilization: {{ .Values.metadata.metrics.autoscaling.targetCPUUtilizationPercentage }}
2721
{{- if .Values.metadata.metrics.autoscaling.targetMemoryUtilizationPercentage }}
2822
- type: Resource
2923
resource:
@@ -32,4 +26,10 @@ spec:
3226
type: Utilization
3327
averageUtilization: {{ .Values.metadata.metrics.autoscaling.targetMemoryUtilizationPercentage }}
3428
{{- end -}}
29+
- type: Resource
30+
resource:
31+
name: cpu
32+
target:
33+
type: Utilization
34+
averageUtilization: {{ .Values.metadata.metrics.autoscaling.targetCPUUtilizationPercentage }}
3535
{{- end -}}

deploy/helm/sumologic/templates/metrics/fluentd/hpa.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ spec:
1818
minReplicas: {{ .Values.fluentd.metrics.autoscaling.minReplicas }}
1919
maxReplicas: {{ .Values.fluentd.metrics.autoscaling.maxReplicas }}
2020
metrics:
21-
- type: Resource
22-
resource:
23-
name: cpu
24-
target:
25-
type: Utilization
26-
averageUtilization: {{ .Values.fluentd.metrics.autoscaling.targetCPUUtilizationPercentage }}
2721
{{- if .Values.fluentd.metrics.autoscaling.targetMemoryUtilizationPercentage }}
2822
- type: Resource
2923
resource:
@@ -32,4 +26,10 @@ spec:
3226
type: Utilization
3327
averageUtilization: {{ .Values.fluentd.metrics.autoscaling.targetMemoryUtilizationPercentage }}
3428
{{- end -}}
29+
- type: Resource
30+
resource:
31+
name: cpu
32+
target:
33+
type: Utilization
34+
averageUtilization: {{ .Values.fluentd.metrics.autoscaling.targetCPUUtilizationPercentage }}
3535
{{- end -}}

0 commit comments

Comments
 (0)