Skip to content

Commit

Permalink
feat(helm): Support HPA for supersetNode and supersetWorker (apache#2…
Browse files Browse the repository at this point in the history
…5280)

Co-authored-by: Nav_InverseInfinity <[email protected]>
  • Loading branch information
tenkian4 and nav-InverseInfinity authored Sep 18, 2023
1 parent 090ae64 commit 5cc0feb
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 2 deletions.
2 changes: 1 addition & 1 deletion helm/superset/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ maintainers:
- name: craig-rueda
email: [email protected]
url: https://github.com/craig-rueda
version: 0.10.6
version: 0.10.7
dependencies:
- name: postgresql
version: 12.1.6
Expand Down
10 changes: 9 additions & 1 deletion helm/superset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ NOTE: This file is generated by helm-docs: https://github.com/norwoodj/helm-docs

# superset

![Version: 0.10.6](https://img.shields.io/badge/Version-0.10.6-informational?style=flat-square)
![Version: 0.10.7](https://img.shields.io/badge/Version-0.10.7-informational?style=flat-square)

Apache Superset is a modern, enterprise-ready business intelligence web application

Expand Down Expand Up @@ -169,6 +169,10 @@ helm install my-superset superset/superset
| supersetCeleryFlower.startupProbe.timeoutSeconds | int | `1` | |
| supersetCeleryFlower.topologySpreadConstraints | list | `[]` | TopologySpreadConstrains to be added to supersetCeleryFlower deployments |
| supersetNode.affinity | object | `{}` | Affinity to be added to supersetNode deployment |
| supersetNode.autoscaling.enabled | bool | `false` | |
| supersetNode.autoscaling.maxReplicas | int | `100` | |
| supersetNode.autoscaling.minReplicas | int | `1` | |
| supersetNode.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| supersetNode.command | list | See `values.yaml` | Startup command |
| supersetNode.connections.db_host | string | `"{{ .Release.Name }}-postgresql"` | |
| supersetNode.connections.db_name | string | `"superset"` | |
Expand Down Expand Up @@ -257,6 +261,10 @@ helm install my-superset superset/superset
| supersetWebsockets.strategy | object | `{}` | |
| supersetWebsockets.topologySpreadConstraints | list | `[]` | TopologySpreadConstrains to be added to supersetWebsockets deployments |
| supersetWorker.affinity | object | `{}` | Affinity to be added to supersetWorker deployment |
| supersetWorker.autoscaling.enabled | bool | `false` | |
| supersetWorker.autoscaling.maxReplicas | int | `100` | |
| supersetWorker.autoscaling.minReplicas | int | `1` | |
| supersetWorker.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| supersetWorker.command | list | a `celery worker` command | Worker startup command |
| supersetWorker.containerSecurityContext | object | `{}` | |
| supersetWorker.deploymentAnnotations | object | `{}` | Annotations to be added to supersetWorker deployment |
Expand Down
2 changes: 2 additions & 0 deletions helm/superset/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ metadata:
annotations: {{- toYaml .Values.supersetWorker.deploymentAnnotations | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.supersetWorker.autoscaling.enabled }}
replicas: {{ .Values.supersetWorker.replicaCount }}
{{- end }}
selector:
matchLabels:
app: {{ template "superset.name" . }}-worker
Expand Down
2 changes: 2 additions & 0 deletions helm/superset/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ metadata:
annotations: {{- toYaml .Values.supersetNode.deploymentAnnotations | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.supersetNode.autoscaling.enabled }}
replicas: {{ .Values.supersetNode.replicaCount }}
{{- end }}
{{- if .Values.supersetNode.strategy }}
strategy: {{- toYaml .Values.supersetNode.strategy | nindent 4 }}
{{- end }}
Expand Down
54 changes: 54 additions & 0 deletions helm/superset/templates/hpa-node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{/*

Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/}}

{{- if .Values.supersetNode.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "superset.fullname" . }}-hpa
labels:
app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "superset.fullname" . }}
minReplicas: {{ .Values.supersetNode.autoscaling.minReplicas }}
maxReplicas: {{ .Values.supersetNode.autoscaling.maxReplicas }}
metrics:
{{- if .Values.supersetNode.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.supersetNode.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.supersetNode.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.supersetNode.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
54 changes: 54 additions & 0 deletions helm/superset/templates/hpa-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{/*

Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/}}

{{- if .Values.supersetWorker.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "superset.fullname" . }}-hpa-worker
labels:
app: {{ template "superset.name" . }}
chart: {{ template "superset.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "superset.fullname" . }}-worker
minReplicas: {{ .Values.supersetWorker.autoscaling.minReplicas }}
maxReplicas: {{ .Values.supersetWorker.autoscaling.maxReplicas }}
metrics:
{{- if .Values.supersetWorker.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.supersetWorker.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.supersetWorker.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.supersetWorker.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions helm/superset/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ hostAliases: []
# Superset node configuration
supersetNode:
replicaCount: 1
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# -- Startup command
# @default -- See `values.yaml`
command:
Expand Down Expand Up @@ -334,6 +341,13 @@ supersetNode:
# Superset Celery worker configuration
supersetWorker:
replicaCount: 1
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# -- Worker startup command
# @default -- a `celery worker` command
command:
Expand Down

0 comments on commit 5cc0feb

Please sign in to comment.