Skip to content

Commit

Permalink
[stable/k8s-resources] add keda scaled object (deliveryhero#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyambati authored May 31, 2023
1 parent 3e2613d commit 0c10df2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
3 changes: 2 additions & 1 deletion stable/k8s-resources/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
version: 0.6.1
version: 0.6.2
appVersion: 0.0.1
name: k8s-resources
description: |
Expand All @@ -16,6 +16,7 @@ description: |
- Secret
- Service
- ServiceAccount
- ScaledObject (KEDA)
Every resource type can have custom labels, annotations or a `fullnameOverride` set. See default [values.yaml](https://github.com/deliveryhero/helm-charts/blob/master/stable/k8s-resources/values.yaml) for examples.
Expand Down
4 changes: 3 additions & 1 deletion stable/k8s-resources/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# k8s-resources

![Version: 0.6.1](https://img.shields.io/badge/Version-0.6.1-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square)
![Version: 0.6.2](https://img.shields.io/badge/Version-0.6.2-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square)

Not an application but a Helm chart to create any and many resources in Kubernetes.

Expand All @@ -15,6 +15,7 @@ Currently supports:
- Secret
- Service
- ServiceAccount
- ScaledObject (KEDA)

Every resource type can have custom labels, annotations or a `fullnameOverride` set. See default [values.yaml](https://github.com/deliveryhero/helm-charts/blob/master/stable/k8s-resources/values.yaml) for examples.

Expand Down Expand Up @@ -63,6 +64,7 @@ helm install my-release deliveryhero/k8s-resources -f values.yaml
| Ingresses | list | `[]` | A list Ingress to create |
| Namespaces | list | `[]` | A list Namespaces to create |
| PriorityClasses | list | `[]` | A list PriorityClasses to create |
| ScaledObjects | list | `[]` | A list ScaledObjects to create |
| Secrets | list | `[]` | A list Secret to create |
| ServiceAccounts | list | `[]` | A list ServiceAccount to create |
| Services | list | `[]` | A list Service to create |
Expand Down
34 changes: 34 additions & 0 deletions stable/k8s-resources/templates/scaledObject.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Values.ScaledObjects -}}
{{- range .Values.ScaledObjects }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ if .fullnameOverride }}{{ .fullnameOverride }}{{ else }}{{ include "k8s-resources.fullname" $ }}-{{ .name }}{{ end }}
spec:
scaleTargetRef:
{{- with .scaleTargetRef }}
{{- toYaml . | nindent 4 }}
{{- end }}
pollingInterval: {{ .pollingInterval | default 30 }}
cooldownPeriod: {{ .cooldownPeriod | default 300 }}
idleReplicaCount: {{ .idleReplicaCount | default 0 }}
minReplicaCount: {{ .minReplicaCount }}
maxReplicaCount: {{ .maxReplicaCount }}
{{- if .fallback }}
fallback:
{{- with .fallback }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .advanced }}
advanced:
{{- with .advanced }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
triggers:
{{- with .triggers }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions stable/k8s-resources/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,21 @@ Namespaces: []
# fullnameOverride: ""
# annotations: {}
# extraLabels: {}

# ScaledObjects -- A list ScaledObjects to create
ScaledObjects: []
# - name: querier-hpa
# fullnameOverride: eu01-infra02-loki-querier
# scaleTargetRef:
# name: eu01-infra02-loki-querier
# idleReplicaCount: 26
# maxReplicaCount: 100
# minReplicaCount: 26
# triggers:
# - metadata:
# metricName: querier_autoscaling_metric
# query: sum(max_over_time(cortex_query_scheduler_inflight_requests{dh_app="loki", dh_cluster="eu01-infra02", quantile="0.75"}[2m]))
# serverAddress: http://metrics-no-auth.syslogistics.io/prometheus
# cortexOrgID: logistics
# threshold: "4"
# type: prometheus

0 comments on commit 0c10df2

Please sign in to comment.