Closed pinoOgni closed 1 year ago
Hello @pinoOgni
I will test the autoscaling feature in my environment. Just a question, does this happen with all NFs or only UPF?
Hello @raoufkh I solved the problem in my own way, I don't know if it's the right solution, if it is I'd be happy to do a PR (and also update the HPA version because with this one there is a warning when you install it).
Basically I modified the <NFname>-hpa.yaml
file explicitly writing the path to the desired variable (for example .Values.ausf.autoscaling.targetCPUUtilizationPercentage) and besides this I obviously enabled autoscaling in the values.yaml
file.
For example for the ausf
Yes, the problem was for all NFs.
Giuseppe
Hello
I think I found the cause of the problem. This is because of the use of {{ include "free5gc-ausf.fullname" . }}
in the HPA resource while we are not in the global scope because we are under the statement {{- with .Values.ausf }}
. To fix this problem, we should replace {{ include "free5gc-ausf.fullname" . }}
by {{ include "free5gc-ausf.fullname" $}}
and {{ include "free5gc-ausf.labels" . }}
by {{ include "free5gc-ausf.labels" $ }}
to indicate that these are variables is in the global scope.
In addition the API version should be updated to autoscaling/v2
and the target
has to be used to define the target utilization.
For example, in the ausf HPA:
--- a/charts/free5gc/charts/free5gc-ausf/templates/ausf-hpa.yaml
+++ b/charts/free5gc/charts/free5gc-ausf/templates/ausf-hpa.yaml
@@ -12,17 +12,17 @@
#
{{- with .Values.ausf }}
{{- if .autoscaling.enabled }}
-apiVersion: autoscaling/v2beta1
+apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
- name: {{ include "free5gc-ausf.fullname" . }}-{{ .name }}-hpa
+ name: {{ include "free5gc-ausf.fullname" $ }}-{{ .name }}-hpa
labels:
- {{- include "free5gc-ausf.labels" . | nindent 4 }}
+ {{- include "free5gc-ausf.labels" $ | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
- name: {{ include "free5gc-ausf.fullname" . }}-{{ .name }}
+ name: {{ include "free5gc-ausf.fullname" $ }}-{{ .name }}
minReplicas: {{ .autoscaling.minReplicas }}
maxReplicas: {{ .autoscaling.maxReplicas }}
metrics:
@@ -30,13 +30,17 @@ spec:
- type: Resource
resource:
name: cpu
- targetAverageUtilization: {{ .autoscaling.targetCPUUtilizationPercentage }}
+ target:
+ type: Utilization
+ averageUtilization: {{ .autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
- targetAverageUtilization: {{ .autoscaling.targetMemoryUtilizationPercentage }}
+ target:
+ type: Utilization
+ averageUtilization: {{ .autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
{{- end }}
Thank you very much and you're welcome to contribute (edit all charts HPAs). If you don't have time, I can do it.
Many thanks, Abderaouf
Hi @raoufkh great solution, much simpler than mine. I've already tried to do something similar using the "$" but unfortunately I couldn't. I wonder why.
However yes, I had already updated the API version to v2 locally, I'll update all charts with your solution and I'll do the PR.
I close the issue. Thank you!
Hi everybody I was trying to enable the HPA of some NFs. To do this I simply edited the "autoscaling" section in the values.yaml file i.e. switched from that
to this
But when I try to install free5gc, I get this error
I tried to make some changes but I get other errors always related to the helpers.tpl
Does anyone know how to do?