Skip to content

Commit

Permalink
Reordering HPA metrics to match HPA ordering
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
poblahblahblah committed Jun 7, 2023
1 parent 9ceeaf0 commit 7b06a4f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions deploy/helm/sumologic/templates/logs/common/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ spec:
minReplicas: {{ .Values.metadata.logs.autoscaling.minReplicas }}
maxReplicas: {{ .Values.metadata.logs.autoscaling.maxReplicas }}
metrics:
{{- if .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: cpu
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetCPUUtilizationPercentage }}
{{- if .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
- type: Resource
resource:
name: memory
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetMemoryUtilizationPercentage }}
{{- end -}}
averageUtilization: {{ .Values.metadata.logs.autoscaling.targetCPUUtilizationPercentage }}
{{- end -}}
12 changes: 6 additions & 6 deletions deploy/helm/sumologic/templates/logs/fluentd/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ spec:
minReplicas: {{ .Values.fluentd.logs.autoscaling.minReplicas }}
maxReplicas: {{ .Values.fluentd.logs.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.fluentd.logs.autoscaling.targetCPUUtilizationPercentage }}
{{- if .Values.fluentd.logs.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
Expand All @@ -32,4 +26,10 @@ spec:
type: Utilization
averageUtilization: {{ .Values.fluentd.logs.autoscaling.targetMemoryUtilizationPercentage }}
{{- end -}}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.fluentd.logs.autoscaling.targetCPUUtilizationPercentage }}
{{- end -}}
12 changes: 6 additions & 6 deletions deploy/helm/sumologic/templates/metrics/common/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ spec:
minReplicas: {{ .Values.metadata.metrics.autoscaling.minReplicas }}
maxReplicas: {{ .Values.metadata.metrics.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.metadata.metrics.autoscaling.targetCPUUtilizationPercentage }}
{{- if .Values.metadata.metrics.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
Expand All @@ -32,4 +26,10 @@ spec:
type: Utilization
averageUtilization: {{ .Values.metadata.metrics.autoscaling.targetMemoryUtilizationPercentage }}
{{- end -}}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.metadata.metrics.autoscaling.targetCPUUtilizationPercentage }}
{{- end -}}
12 changes: 6 additions & 6 deletions deploy/helm/sumologic/templates/metrics/fluentd/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ spec:
minReplicas: {{ .Values.fluentd.metrics.autoscaling.minReplicas }}
maxReplicas: {{ .Values.fluentd.metrics.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.fluentd.metrics.autoscaling.targetCPUUtilizationPercentage }}
{{- if .Values.fluentd.metrics.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
Expand All @@ -32,4 +26,10 @@ spec:
type: Utilization
averageUtilization: {{ .Values.fluentd.metrics.autoscaling.targetMemoryUtilizationPercentage }}
{{- end -}}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.fluentd.metrics.autoscaling.targetCPUUtilizationPercentage }}
{{- end -}}

0 comments on commit 7b06a4f

Please sign in to comment.