diff --git a/charts/datahub/Chart.yaml b/charts/datahub/Chart.yaml index 377510e59..7d380bf08 100644 --- a/charts/datahub/Chart.yaml +++ b/charts/datahub/Chart.yaml @@ -4,7 +4,7 @@ description: A Helm chart for DataHub type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.4.37 +version: 0.4.38 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. appVersion: 0.14.1 diff --git a/charts/datahub/subcharts/datahub-gms/README.md b/charts/datahub/subcharts/datahub-gms/README.md index 7446f16fd..6129c7813 100644 --- a/charts/datahub/subcharts/datahub-gms/README.md +++ b/charts/datahub/subcharts/datahub-gms/README.md @@ -2,7 +2,7 @@ datahub-gms =========== A Helm chart for DataHub's datahub-gms component -Current chart version is `0.2.0` +Current chart version is `0.2.176` ## Chart Values diff --git a/charts/datahub/subcharts/datahub-gms/templates/_helpers.tpl b/charts/datahub/subcharts/datahub-gms/templates/_helpers.tpl index 8bdf26f22..5db1f0034 100644 --- a/charts/datahub/subcharts/datahub-gms/templates/_helpers.tpl +++ b/charts/datahub/subcharts/datahub-gms/templates/_helpers.tpl @@ -74,3 +74,22 @@ Return the appropriate apiVersion for ingress. {{- print "networking.k8s.io/v1beta1" -}} {{- end -}} {{- end -}} + +{{/* +Return the appropriate apiVersion for HorizontalPodAutoscaler. +*/}} +{{- define "datahub-gms.hpa.apiVersion" -}} + {{- if and (.Capabilities.APIVersions.Has "autoscaling/v2") (semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version) -}} + {{- print "autoscaling/v2" -}} + {{- else -}} + {{- print "autoscaling/v2beta1" -}} + {{- end -}} +{{- end -}} + +{{/* +Create image registry, name and tag for a datahub component +*/}} +{{- define "datahub.image" -}} +{{- $registry := .image.registry | default .imageRegistry -}} +{{ $registry }}/{{ .image.repository }}:{{ required "Global or specific tag is required" (.image.tag | default .version) -}} +{{- end -}} diff --git a/charts/datahub/subcharts/datahub-gms/templates/hpa.yaml b/charts/datahub/subcharts/datahub-gms/templates/hpa.yaml new file mode 100644 index 000000000..02dc28a54 --- /dev/null +++ b/charts/datahub/subcharts/datahub-gms/templates/hpa.yaml @@ -0,0 +1,52 @@ +{{- if .Values.hpa.enabled }} +{{- $apiVersion := include "datahub-gms.hpa.apiVersion" . -}} +apiVersion: {{ $apiVersion }} +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "datahub-gms.fullname" . }} + labels: + {{- include "datahub-gms.labels" . | nindent 4 }} + {{- range $key, $val := .Values.extraLabels }} + {{ $key }}: {{ $val | quote }} + {{- end }} +spec: + {{- if and (.Values.global.strict_mode) (.Values.hpa.enabled) (.Values.global.datahub.managed_ingestion.enabled) (not .Values.global.datahub_standalone_consumers_enabled) }} + {{- fail "\nHPA cannot be used in non standalone mode. Please enable standalone consumers if you wish to run multiple GMS instances and managed ingestion." }} + {{- else }} + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "datahub-gms.fullname" . }} + minReplicas: {{ .Values.hpa.minReplicas }} + maxReplicas: {{ .Values.hpa.maxReplicas }} + {{- with .Values.hpa.behavior }} + behavior: + {{- toYaml . | nindent 4 }} + {{- end }} + metrics: + {{- with .Values.hpa.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + {{- if (eq $apiVersion "autoscaling/v2") }} + target: + type: Utilization + averageUtilization: {{ . }} + {{- else }} + targetAverageUtilization: {{ . }} + {{- end }} + {{- end }} + {{- with .Values.hpa.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + {{- if (eq $apiVersion "autoscaling/v2") }} + target: + type: Utilization + averageUtilization: {{ . }} + {{- else }} + targetAverageUtilization: {{ . }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} diff --git a/charts/datahub/subcharts/datahub-gms/values.yaml b/charts/datahub/subcharts/datahub-gms/values.yaml index 29618399a..0a8134ca0 100644 --- a/charts/datahub/subcharts/datahub-gms/values.yaml +++ b/charts/datahub/subcharts/datahub-gms/values.yaml @@ -4,6 +4,15 @@ replicaCount: 1 +hpa: + # Can only be enabled if global.datahub_standalone_consumers_enabled + enabled: false + minReplicas: 1 + maxReplicas: 2 + behavior: {} + targetCPUUtilizationPercentage: 100 + targetMemoryUtilizationPercentage: + revisionHistoryLimit: 10 image: