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

Feat: Add additional annotations templating #334

Merged
merged 1 commit into from
Dec 5, 2022
Merged
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: 1 addition & 0 deletions keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ their default values.
| `metricsServer.affinity` | Affinity for pod scheduling ([docs](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/)) for Metrics API Server. Takes precedence over the `affinity` field | `{}` |
| `imagePullSecrets` | Name of secret to use to pull images to use to pull Docker images | `[]` |
| `additionalLabels` | Additional labels to apply to KEDA workloads | `{}` |
| `additionalAnnotations` | Additional annotations to apply to KEDA workloads | `{}` |
| `podAnnotations.keda` | Pod annotations for KEDA operator | `{}` |
| `podAnnotations.metricsAdapter` | Pod annotations for KEDA Metrics Adapter | `{}` |
| `upgradeStrategy.operator` | Capability to configure [Deployment upgrade strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) for operator | `{}` |
Expand Down
3 changes: 3 additions & 0 deletions keda/templates/01-serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ metadata:
{{- include "keda.labels" . | indent 4 }}
{{- if or .Values.podIdentity.azureWorkload.enabled .Values.podIdentity.aws.irsa.enabled .Values.serviceAccount.annotations }}
annotations:
{{- if .Values.additionalAnnotations }}
{{- toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
{{- if .Values.podIdentity.azureWorkload.enabled }}
{{- if .Values.podIdentity.azureWorkload.clientId }}
azure.workload.identity/client-id: {{ .Values.podIdentity.azureWorkload.clientId | quote }}
Expand Down
3 changes: 3 additions & 0 deletions keda/templates/02-crd-clustertriggerauthentications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
{{- if .Values.additionalAnnotations }}
{{- toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions keda/templates/03-crd-scaledjobs.keda.sh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
{{- if .Values.additionalAnnotations }}
{{- toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions keda/templates/04-crd-scaledobjects.keda.sh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
{{- if .Values.additionalAnnotations }}
{{- toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions keda/templates/05-crd-triggerauthentications.keda.sh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
{{- if .Values.additionalAnnotations }}
{{- toYaml .Values.additionalAnnotations | indent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
2 changes: 2 additions & 0 deletions keda/templates/10-keda-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
4 changes: 3 additions & 1 deletion keda/templates/11-keda-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand All @@ -14,4 +16,4 @@ subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.name }}
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}
7 changes: 5 additions & 2 deletions keda/templates/12-keda-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Deployment
metadata:
name: {{ .Values.operator.name }}
namespace: {{ .Release.Namespace }}
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app: {{ .Values.operator.name }}
name: {{ .Values.operator.name }}
Expand All @@ -28,14 +30,15 @@ spec:
aadpodidbinding: {{ .Values.podIdentity.activeDirectory.identity }}
{{- end }}
{{- if .Values.podLabels.keda }}
{{- toYaml .Values.podLabels.keda | nindent 8}}
{{- toYaml .Values.podLabels.keda | nindent 8 }}
{{- end }}
{{- if .Values.podIdentity.azureWorkload.enabled }}
azure.workload.identity/use: "true"
{{- end }}
{{- if .Values.podAnnotations.keda }}
annotations:
{{- toYaml .Values.podAnnotations.keda | nindent 8}}
{{- toYaml .Values.podAnnotations.keda | nindent 8 }}
{{- toYaml .Values.additionalAnnotations | nindent 8 }}
{{- end }}
spec:
{{- if .Values.priorityClassName }}
Expand Down
2 changes: 2 additions & 0 deletions keda/templates/14-keda-poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: PodDisruptionBudget
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.operator.name }}
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.serviceAccount.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
2 changes: 2 additions & 0 deletions keda/templates/15-keda-podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ .Values.operator.name }}
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
2 changes: 2 additions & 0 deletions keda/templates/16-keda-prometheusrules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ .Values.operator.name }}
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
4 changes: 3 additions & 1 deletion keda/templates/20-metrics-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}-external-metrics-reader
{{- include "keda.labels" . | indent 4 }}
Expand All @@ -14,4 +16,4 @@ rules:
- '*'
verbs:
- '*'
{{- end -}}
{{- end -}}
6 changes: 6 additions & 0 deletions keda/templates/21-metrics-clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}-system-auth-delegator
{{- include "keda.labels" . | indent 4 }}
Expand All @@ -18,6 +20,8 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}-auth-reader
{{- include "keda.labels" . | indent 4 }}
Expand All @@ -35,6 +39,8 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}-hpa-controller-external-metrics
{{- include "keda.labels" . | indent 4 }}
Expand Down
3 changes: 3 additions & 0 deletions keda/templates/22-metrics-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Deployment
metadata:
name: {{ .Values.operator.name }}-metrics-apiserver
namespace: {{ .Release.Namespace }}
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app: {{ .Values.operator.name }}-metrics-apiserver
app.kubernetes.io/name: {{ .Values.operator.name }}-metrics-apiserver
Expand Down Expand Up @@ -32,6 +34,7 @@ spec:
azure.workload.identity/use: "true"
{{- end }}
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 8 }}
{{- if and .Values.prometheus.metricServer.enabled ( not .Values.prometheus.metricServer.podMonitor.enabled ) }}
prometheus.io/scrape: "true"
prometheus.io/port: {{ .Values.prometheus.metricServer.port | quote }}
Expand Down
1 change: 1 addition & 0 deletions keda/templates/23-metrics-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
name: {{ .Values.operator.name }}-metrics-apiserver
namespace: {{ .Release.Namespace }}
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
{{- range $key, $value := .Values.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions keda/templates/24-metrics-apiservice.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: v1beta1.external.metrics.k8s.io
{{- include "keda.labels" . | indent 4 }}
Expand Down
2 changes: 2 additions & 0 deletions keda/templates/25-metrics-poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: PodDisruptionBudget
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.operator.name }}-metrics-apiserver
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}-metrics-apiserver
{{- include "keda.labels" . | indent 4 }}
Expand Down
2 changes: 2 additions & 0 deletions keda/templates/26-metrics-podmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ .Values.operator.name }}-metrics-apiserver
annotations:
{{- toYaml .Values.additionalAnnotations | nindent 4 }}
labels:
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
Expand Down
5 changes: 5 additions & 0 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ additionalLabels:
{}
# foo: bar

# -- Custom annotations to add into metadata
additionalAnnotations:
{}
# foo: bar

podAnnotations:
keda: {}
metricsAdapter: {}
Expand Down