Files
neo-blog/helm/templates/hpa.yaml
Snowykami 1b29d50ba4 📝 feat: Update README with feature list and deployment instructions
refactor: Remove old Helm chart files and templates

feat: Add new Helm chart structure for neo-blog deployment

chore: Add .helmignore and initial Chart.yaml for Helm chart

feat: Implement backend and frontend deployment templates in Helm chart

feat: Create services and ingress configurations for backend and frontend

chore: Define resource limits and requests for backend and frontend in values.yaml

feat: Enable autoscaling configuration for backend and frontend deployments

chore: Clean up unused files and configurations from previous setup
2025-07-29 08:15:20 +08:00

66 lines
2.0 KiB
YAML

{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "neo-blog.fullname" . }}-backend
labels:
{{- include "neo-blog.backend.selectorLabels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "neo-blog.fullname" . }}-backend
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- if .Values.frontend.enabled -}}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "neo-blog.fullname" . }}-frontend
labels:
{{- include "neo-blog.frontend.selectorLabels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "neo-blog.fullname" . }}-frontend
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end -}}
{{- end }}