Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced ability to use KEDA triggers for autoscaling #166

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"


- name: Set up Helm
uses: azure/setup-helm@v4
with:
Expand Down
8 changes: 3 additions & 5 deletions charts/coredns/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: coredns
version: 1.29.0
version: 1.29.1
appVersion: 1.11.1
home: https://coredns.io
icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png
Expand All @@ -19,7 +19,5 @@ maintainers:
type: application
annotations:
artifacthub.io/changes: |
- kind: changed
description: Ignore duplicate strings in the fullname helper template
- kind: removed
description: Removed deprecated "engine: gotpl" from the Chart.yaml
- kind: added
description: Ability to use KEDA triggers for autoscaling
12 changes: 8 additions & 4 deletions charts/coredns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $ helm --namespace=kube-system install coredns coredns/coredns
This chart bootstraps a [CoreDNS](https://github.com/coredns/coredns) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. This chart will provide DNS Services and can be deployed in multiple configuration to support various scenarios listed below:

- CoreDNS as a cluster dns service and a drop-in replacement for Kube/SkyDNS. This is the default mode and CoreDNS is deployed as cluster-service in kube-system namespace. This mode is chosen by setting `isClusterService` to true.
- CoreDNS as an external dns service. In this mode CoreDNS is deployed as any kubernetes app in user specified namespace. The CoreDNS service can be exposed outside the cluster by using using either the NodePort or LoadBalancer type of service. This mode is chosen by setting `isClusterService` to false.
- CoreDNS as an external dns service. In this mode CoreDNS is deployed as any kubernetes app in user specified namespace. The CoreDNS service can be exposed outside the cluster by using either the NodePort or LoadBalancer type of service. This mode is chosen by setting `isClusterService` to false.
- CoreDNS as an external dns provider for kubernetes federation. This is a sub case of 'external dns service' which uses etcd plugin for CoreDNS backend. This deployment mode as a dependency on `etcd-operator` chart, which needs to be pre-installed.

## Prerequisites
Expand Down Expand Up @@ -47,9 +47,9 @@ The command removes all the Kubernetes components associated with the chart and
## Configuration

| Parameter | Description | Default |
| :--------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------- |
|:-----------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------|
| `image.repository` | The image repository to pull from | coredns/coredns |
| `image.tag` | The image tag to pull from (derived from Chart.yaml) | `` |
| `image.tag` | The image tag to pull from (derived from Chart.yaml) | `` |
| `image.pullPolicy` | Image pull policy | IfNotPresent |
| `image.pullSecrets` | Specify container image pull secrets | `[]` |
| `replicaCount` | Number of replicas | 1 |
Expand Down Expand Up @@ -110,6 +110,10 @@ The command removes all the Kubernetes components associated with the chart and
| `hpa.minReplicas` | Hpa minimum number of CoreDNS replicas | `1` |
| `hpa.maxReplicas` | Hpa maximum number of CoreDNS replicas | `2` |
| `hpa.metrics` | Metrics definitions used by Hpa to scale up and down | {} |
| `keda.enabled` | Optionally enable KEDA for CoreDNS | `false` |
| `keda.fallback` | Optional. Section to specify fallback options | {} |
| `keda.advanced` | Optional. Section to specify advanced options | {} |
| `keda.triggers` | List of triggers to activate scaling of the target resource | [] |
| `autoscaler.enabled` | Optionally enabled a cluster-proportional-autoscaler for CoreDNS | `false` |
| `autoscaler.coresPerReplica` | Number of cores in the cluster per CoreDNS replica | `256` |
| `autoscaler.nodesPerReplica` | Number of nodes in the cluster per CoreDNS replica | `16` |
Expand Down Expand Up @@ -187,7 +191,7 @@ the autoscaler deployment.
`replicaCount` is ignored if this is enabled.

By setting `hpa.enabled = true` a [Horizontal Pod Autoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)
is enabled for Coredns deployment. This can scale number of replicas based on meitrics
is enabled for Coredns deployment. This can scale number of replicas based on metrics
like CpuUtilization, MemoryUtilization or Custom ones.

## Adopting existing CoreDNS resources
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/deployment-autoscaler.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and (.Values.autoscaler.enabled) (not .Values.hpa.enabled) }}
{{- if and (.Values.autoscaler.enabled) (not .Values.hpa.enabled) (not .Values.keda.enabled) }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down
2 changes: 1 addition & 1 deletion charts/coredns/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ metadata:
{{- end }}
{{- end }}
spec:
{{- if and (not .Values.autoscaler.enabled) (not .Values.hpa.enabled) }}
{{- if and (not .Values.autoscaler.enabled) (not .Values.hpa.enabled) (not .Values.keda.enabled) }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
Expand Down
32 changes: 32 additions & 0 deletions charts/coredns/templates/scaledobject.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if and (.Values.keda.enabled) (not .Values.hpa.enabled) (not .Values.autoscaler.enabled) }}
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ template "coredns.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "coredns.labels" . | nindent 4 }}
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 4 }}
{{- end }}
{{- with .Values.customAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ default (include "coredns.fullname" .) .Values.deployment.name }}
pollingInterval: {{ .Values.keda.pollingInterval | default 30 }}
cooldownPeriod: {{ .Values.keda.cooldownPeriod | default 300 }}
idleReplicaCount: {{ .Values.keda.idleReplicaCount | default 0 }}
minReplicaCount: {{ .Values.keda.minReplicaCount | default 1 }}
maxReplicaCount: {{ .Values.keda.maxReplicaCount | default 100 }}
fallback:
{{- toYaml .Values.keda.fallback | nindent 4 }}
advanced:
{{- toYaml .Values.keda.advanced | nindent 4 }}
triggers:
{{- toYaml .Values.keda.triggers | nindent 4 }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/coredns/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,24 @@ hpa:
maxReplicas: 2
metrics: []

## Configue KEDA (Kubernetes Event-driven Autoscaling) for coredns
# See https://keda.sh/docs/2.14/concepts/scaling-deployments/#scaledobject-spec
keda:
# Enabled the KEDA
enabled: false

# pollingInterval: 30
# cooldownPeriod: 300
# minReplicaCount: 1
# maxReplicaCount: 100

# Optional. Section to specify fallback options
fallback: {}
# Optional. Section to specify advanced options
advanced: {}
# List of triggers to activate scaling of the target resource
triggers: []

## Configue a cluster-proportional-autoscaler for coredns
# See https://github.com/kubernetes-incubator/cluster-proportional-autoscaler
autoscaler:
Expand Down