Skip to content

Commit

Permalink
feat: allow templates in annotations (#256)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Pierluigi Lenoci <[email protected]>
  • Loading branch information
gtudan and pierluigilenoci authored Nov 22, 2024
1 parent 7c3571c commit 4f41ec4
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 23 deletions.
8 changes: 4 additions & 4 deletions helm/oauth2-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: oauth2-proxy
version: 7.7.31
version: 7.8.0
apiVersion: v2
appVersion: 7.7.1
home: https://oauth2-proxy.github.io/oauth2-proxy/
Expand Down Expand Up @@ -34,8 +34,8 @@ maintainers:
kubeVersion: ">=1.16.0-0"
annotations:
artifacthub.io/changes: |
- kind: fixed
description: Added missing executable permission for check-redis.sh
- kind: added
description: allow templates in annotations
links:
- name: Github PR
url: https://github.com/oauth2-proxy/manifests/pull/255
url: https://github.com/oauth2-proxy/manifests/pull/256
33 changes: 33 additions & 0 deletions helm/oauth2-proxy/ci/tpl-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ ingress:
tls:
- hosts:
- "{{ $.Release.Name }}.local"
annotations:
test-annotations/test: "{{ $.Release.Name }}"
oauth2-proxy:
checkDeprecation: false
config:
Expand All @@ -27,3 +29,34 @@ extraVolumes:
items:
- key: secret
path: secret

authenticatedEmailsFile:
annotations:
test-annotations/test: "{{ $.Release.Name }}"

config:
annotations:
test-annotations/test: "{{ $.Release.Name }}"

deploymentAnnotations:
test-annotations/test: "{{ $.Release.Name }}"

autoscaling:
annotations:
test-annotations/test: "{{ $.Release.Name }}"

alphaConfig:
annotations:
test-annotations/test: "{{ $.Release.Name }}"

service:
annotations:
test-annotations/test: "{{ $.Release.Name }}"

serviceAccount:
annotations:
test-annotations/test: "{{ $.Release.Name }}"

serviceMonitor:
annotations:
test-annotations/test: "{{ $.Release.Name }}"
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ metadata:
labels:
app: {{ template "oauth2-proxy.name" . }}
{{- include "oauth2-proxy.labels" . | indent 4 }}
{{- if .Values.authenticatedEmailsFile.annotations }}
{{- with .Values.authenticatedEmailsFile.annotations }}
annotations:
{{ toYaml .Values.authenticatedEmailsFile.annotations | indent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
name: {{ template "oauth2-proxy.fullname" . }}-accesslist
namespace: {{ template "oauth2-proxy.namespace" $ }}
Expand Down
4 changes: 2 additions & 2 deletions helm/oauth2-proxy/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
{{- if .Values.config.annotations }}
{{- with .Values.config.annotations }}
annotations:
{{ toYaml .Values.config.annotations | indent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
labels:
app: {{ template "oauth2-proxy.name" . }}
Expand Down
4 changes: 2 additions & 2 deletions helm/oauth2-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ metadata:
labels:
app: {{ template "oauth2-proxy.name" . }}
{{- include "oauth2-proxy.labels" . | indent 4 }}
{{- if .Values.deploymentAnnotations }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{ toYaml .Values.deploymentAnnotations | indent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
name: {{ template "oauth2-proxy.fullname" . }}
namespace: {{ template "oauth2-proxy.namespace" $ }}
Expand Down
4 changes: 2 additions & 2 deletions helm/oauth2-proxy/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
labels:
app: {{ template "oauth2-proxy.name" . }}
{{- include "oauth2-proxy.labels" . | indent 4 }}
{{- if .Values.autoscaling.annotations }}
{{- with .Values.autoscaling.annotations }}
annotations:
{{ toYaml .Values.autoscaling.annotations | indent 8 }}
{{ tpl ( toYaml . ) $ | indent 8 }}
{{- end }}
name: {{ template "oauth2-proxy.fullname" . }}
namespace: {{ template "oauth2-proxy.namespace" $ }}
Expand Down
2 changes: 1 addition & 1 deletion helm/oauth2-proxy/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ metadata:
namespace: {{ template "oauth2-proxy.namespace" $ }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className ( eq "true" ( include "ingress.supportsIngressClassName" . ) ) }}
Expand Down
5 changes: 3 additions & 2 deletions helm/oauth2-proxy/templates/secret-alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
apiVersion: v1
kind: Secret
metadata:
{{- if .Values.alphaConfig.annotations }}
annotations: {{- toYaml .Values.alphaConfig.annotations | nindent 4 }}
{{- with .Values.alphaConfig.annotations }}
annotations:
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
labels:
app: {{ template "oauth2-proxy.name" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ metadata:
labels:
app: {{ template "oauth2-proxy.name" . }}
{{- include "oauth2-proxy.labels" . | indent 4 }}
{{- if .Values.authenticatedEmailsFile.annotations }}
{{- with .Values.authenticatedEmailsFile.annotations }}
annotations:
{{ toYaml .Values.authenticatedEmailsFile.annotations | indent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
name: {{ template "oauth2-proxy.fullname" . }}-accesslist
namespace: {{ template "oauth2-proxy.namespace" $ }}
Expand Down
4 changes: 2 additions & 2 deletions helm/oauth2-proxy/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: v1
kind: Secret
metadata:
{{- if .Values.config.annotations }}
{{- with .Values.config.annotations }}
annotations:
{{ toYaml .Values.config.annotations | indent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
labels:
app: {{ template "oauth2-proxy.name" . }}
Expand Down
4 changes: 2 additions & 2 deletions helm/oauth2-proxy/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ metadata:
{{- include "oauth2-proxy.labels" . | indent 4 }}
name: {{ template "oauth2-proxy.fullname" . }}
namespace: {{ template "oauth2-proxy.namespace" $ }}
{{- if .Values.service.annotations }}
{{- with .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
spec:
{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }}
Expand Down
2 changes: 1 addition & 1 deletion helm/oauth2-proxy/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kind: ServiceAccount
metadata:
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
labels:
app: {{ $name }}
Expand Down
2 changes: 1 addition & 1 deletion helm/oauth2-proxy/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: ServiceMonitor
metadata:
{{- with .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{ tpl ( toYaml . ) $ | indent 4 }}
{{- end }}
name: {{ template "oauth2-proxy.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
Expand Down

0 comments on commit 4f41ec4

Please sign in to comment.