Skip to content

Commit

Permalink
Merge pull request #178 from jkroepke/avoid-restarts
Browse files Browse the repository at this point in the history
Avoid unnecessary pod restart on each helm chart version
  • Loading branch information
pierluigilenoci authored Dec 11, 2023
2 parents 32aa3a3 + 855e996 commit 74e598d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 32 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: 6.22.0
version: 6.23.0
apiVersion: v2
appVersion: 7.5.1
home: https://oauth2-proxy.github.io/oauth2-proxy/
Expand Down Expand Up @@ -34,8 +34,8 @@ maintainers:
kubeVersion: ">=1.9.0-0"
annotations:
artifacthub.io/changes: |
- kind: added
description: Redis chart bumped to 18.5.0
- kind: fixed
description: Avoid unnecessary pod restart on each helm chart version
links:
- name: Github PR
url: https://github.com/oauth2-proxy/manifests/pull/179
url: https://github.com/oauth2-proxy/manifests/pull/178
28 changes: 28 additions & 0 deletions helm/oauth2-proxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,31 @@ Workaround for EKS https://github.com/aws/eks-distro/issues/1128
{{- printf "%s.%s" .Capabilities.KubeVersion.Major (.Capabilities.KubeVersion.Minor | replace "+" "") -}}
{{- end -}}
{{- end -}}

{{- define "oauth2-proxy.alpha-config" -}}
---
server:
BindAddress: '0.0.0.0:4180'
{{- if .Values.alphaConfig.serverConfigData }}
{{- toYaml .Values.alphaConfig.serverConfigData | nindent 6 }}
{{- end }}
{{- if .Values.metrics.enabled }}
metricsServer:
BindAddress: '0.0.0.0:44180'
{{- if .Values.alphaConfig.metricsConfigData }}
{{- toYaml .Values.alphaConfig.metricsConfigData | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.alphaConfig.configData }}
{{- toYaml .Values.alphaConfig.configData | nindent 4 }}
{{- end }}
{{- if .Values.alphaConfig.configFile }}
{{- tpl .Values.alphaConfig.configFile $ | nindent 4 }}
{{- end }}
{{- end -}}

{{- define "oauth2-proxy.secrets" -}}
cookie-secret: {{ tpl .Values.config.cookieSecret $ | b64enc | quote }}
client-secret: {{ tpl .Values.config.clientSecret $ | b64enc | quote }}
client-id: {{ tpl .Values.config.clientID $ | b64enc | quote }}
{{- end -}}
10 changes: 6 additions & 4 deletions helm/oauth2-proxy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ spec:
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/config: {{ tpl .Values.config.configFile $ | sha256sum }}
{{- if .Values.alphaConfig.enabled }}
checksum/alpha-config: {{ include (print $.Template.BasePath "/secret-alpha.yaml") . | sha256sum }}
checksum/alpha-config: {{ include "oauth2-proxy.alpha-config" . | sha256sum }}
{{- end }}
{{- if .Values.authenticatedEmailsFile.enabled }}
checksum/config-emails: {{ include (print $.Template.BasePath "/configmap-authenticated-emails-file.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }}
checksum/secret: {{ include "oauth2-proxy.secrets" . | sha256sum }}
checksum/google-secret: {{ include (print $.Template.BasePath "/google-secret.yaml") . | sha256sum }}
checksum/redis-secret: {{ include (print $.Template.BasePath "/redis-secret.yaml") . | sha256sum }}
{{- if .Values.htpasswdFile.enabled }}
checksum/htpasswd: {{ include (print $.Template.BasePath "/secret-htpasswd-file.yaml") . | sha256sum }}
checksum/htpasswd: {{ toYaml .Values.htpasswdFile.entries | sha256sum }}
{{- end }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
Expand Down
23 changes: 2 additions & 21 deletions helm/oauth2-proxy/templates/secret-alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@ metadata:
{{- include "oauth2-proxy.labels" . | indent 4 }}
name: {{ template "oauth2-proxy.fullname" . }}-alpha
namespace: {{ template "oauth2-proxy.namespace" $ }}
stringData:
oauth2_proxy.yml: |
---
server:
BindAddress: '0.0.0.0:4180'
{{- if .Values.alphaConfig.serverConfigData }}
{{- toYaml .Values.alphaConfig.serverConfigData | nindent 6 }}
{{- end }}
{{- if .Values.metrics.enabled }}
metricsServer:
BindAddress: '0.0.0.0:44180'
{{- if .Values.alphaConfig.metricsConfigData }}
{{- toYaml .Values.alphaConfig.metricsConfigData | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.alphaConfig.configData }}
{{- toYaml .Values.alphaConfig.configData | nindent 4 }}
{{- end }}
{{- if .Values.alphaConfig.configFile }}
{{- tpl .Values.alphaConfig.configFile $ | nindent 4 }}
{{- end }}
data:
oauth2_proxy.yml: {{ include "oauth2-proxy.alpha-config" . | b64enc | quote }}
{{- end }}
4 changes: 1 addition & 3 deletions helm/oauth2-proxy/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ metadata:
namespace: {{ template "oauth2-proxy.namespace" $ }}
type: Opaque
data:
cookie-secret: {{ tpl .Values.config.cookieSecret $ | b64enc | quote }}
client-secret: {{ tpl .Values.config.clientSecret $ | b64enc | quote }}
client-id: {{ tpl .Values.config.clientID $ | b64enc | quote }}
{{- include "oauth2-proxy.secrets" . | nindent 2 }}
{{- end -}}

0 comments on commit 74e598d

Please sign in to comment.