Skip to content

Commit eb96b38

Browse files
Merge pull request #25 from nlamirault/feat/k8s-labelss
2 parents 2875c40 + 0427131 commit eb96b38

16 files changed

+64
-43
lines changed

helm/oauth2-proxy/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: oauth2-proxy
2-
version: 4.2.2
2+
version: 5.0.0
33
apiVersion: v2
44
appVersion: 7.1.3
55
home: https://oauth2-proxy.github.io/oauth2-proxy/

helm/oauth2-proxy/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,24 @@ See the [v1.22 API deprecations guide](https://kubernetes.io/docs/reference/usin
6060

6161
For the same reason `service.port` was renamed to `service.portNumber`.
6262

63+
### To 5.0.0
64+
65+
Version 5.0.0 introduces support for custom labels and refactor [Kubernetes recommended labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/). This is a breaking change because many labels of all resources need to be updated to stay consistent.
66+
67+
In order to upgrade, delete the Deployment before upgrading:
68+
69+
```bash
70+
kubectl delete deployment my-release-oauth2-proxy
71+
```
72+
73+
This will introduce a slight downtime.
74+
75+
For users who don't want downtime, you can perform these actions:
76+
77+
- Perform a non-cascading removal of the deployment that keeps the pods running
78+
- Add new labels to pods
79+
- Perform `helm upgrade`
80+
6381
## Configuration
6482

6583
The following table lists the configurable parameters of the oauth2-proxy chart and their default values.
@@ -80,6 +98,7 @@ Parameter | Description | Default
8098
`config.configFile` | custom [oauth2_proxy.cfg](https://github.com/oauth2-proxy/oauth2-proxy/blob/master/contrib/oauth2-proxy.cfg.example) contents for settings not overridable via environment nor command line | `""`
8199
`config.existingConfig` | existing Kubernetes configmap to use for the configuration file. See [config template](https://github.com/oauth2-proxy/manifests/blob/master/helm/oauth2-proxy/templates/configmap.yaml) for the required values | `nil`
82100
`config.cookieName` | The name of the cookie that oauth2-proxy will create. | `""`
101+
`customLabels` | Custom labels to add into metadata | `{}` |
83102
`config.google.adminEmail` | user impersonated by the google service account | `""`
84103
`config.google.serviceAccountJson` | google service account json contents | `""`
85104
`config.google.existingConfig` | existing Kubernetes configmap to use for the service account file. See [google secret template](https://github.com/oauth2-proxy/manifests/blob/master/helm/oauth2-proxy/templates/google-secret.yaml) for the required values | `nil`

helm/oauth2-proxy/templates/_helpers.tpl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,31 @@ Create chart name and version as used by the chart label.
3131
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
3232
{{- end -}}
3333

34+
{{/*
35+
Generate basic labels
36+
*/}}
37+
{{- define "oauth2-proxy.labels" }}
38+
helm.sh/chart: {{ include "oauth2-proxy.chart" . }}
39+
app.kubernetes.io/managed-by: {{ .Release.Service }}
40+
app.kubernetes.io/component: authentication-proxy
41+
app.kubernetes.io/part-of: {{ template "oauth2-proxy.name" . }}
42+
{{- include "oauth2-proxy.selectorLabels" . }}
43+
{{- if .Chart.AppVersion }}
44+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
45+
{{- end }}
46+
{{- if .Values.customLabels }}
47+
{{ toYaml .Values.customLabels }}
48+
{{- end }}
49+
{{- end }}
50+
51+
{{/*
52+
Selector labels
53+
*/}}
54+
{{- define "oauth2-proxy.selectorLabels" }}
55+
app.kubernetes.io/name: {{ include "oauth2-proxy.name" . }}
56+
app.kubernetes.io/instance: {{ .Release.Name }}
57+
{{- end }}
58+
3459
{{/*
3560
Get the secret name.
3661
*/}}

helm/oauth2-proxy/templates/configmap-authenticated-emails-file.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ kind: ConfigMap
55
metadata:
66
labels:
77
app: {{ template "oauth2-proxy.name" . }}
8-
chart: {{ template "oauth2-proxy.chart" . }}
9-
heritage: {{ .Release.Service }}
10-
release: {{ .Release.Name }}
8+
{{- include "oauth2-proxy.labels" . | indent 4 }}
119
{{- if .Values.authenticatedEmailsFile.annotations }}
1210
annotations:
1311
{{ toYaml .Values.authenticatedEmailsFile.annotations | indent 4 }}

helm/oauth2-proxy/templates/configmap-htpasswd-file.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ kind: Secret
44
metadata:
55
labels:
66
app: {{ template "oauth2-proxy.name" . }}
7-
chart: {{ template "oauth2-proxy.chart" . }}
8-
heritage: {{ .Release.Service }}
9-
release: {{ .Release.Name }}
7+
{{- include "oauth2-proxy.labels" . | indent 4 }}
108
name: {{ template "oauth2-proxy.fullname" . }}-htpasswd-file
119
type: Opaque
1210
stringData:

helm/oauth2-proxy/templates/configmap.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ kind: ConfigMap
55
metadata:
66
labels:
77
app: {{ template "oauth2-proxy.name" . }}
8-
chart: {{ template "oauth2-proxy.chart" . }}
9-
heritage: {{ .Release.Service }}
10-
release: {{ .Release.Name }}
8+
{{- include "oauth2-proxy.labels" . | indent 4 }}
119
name: {{ template "oauth2-proxy.fullname" . }}
1210
data:
1311
oauth2_proxy.cfg: {{ .Values.config.configFile | quote }}

helm/oauth2-proxy/templates/deployment.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ kind: Deployment
33
metadata:
44
labels:
55
app: {{ template "oauth2-proxy.name" . }}
6-
chart: {{ template "oauth2-proxy.chart" . }}
7-
heritage: {{ .Release.Service }}
8-
release: {{ .Release.Name }}
6+
{{- include "oauth2-proxy.labels" . | indent 4 }}
97
name: {{ template "oauth2-proxy.fullname" . }}
108
spec:
119
replicas: {{ .Values.replicaCount }}
1210
selector:
1311
matchLabels:
14-
app: {{ template "oauth2-proxy.name" . }}
15-
release: {{ .Release.Name }}
12+
{{- include "oauth2-proxy.selectorLabels" . | indent 6 }}
1613
template:
1714
metadata:
1815
annotations:
@@ -29,7 +26,7 @@ spec:
2926
{{- end }}
3027
labels:
3128
app: {{ template "oauth2-proxy.name" . }}
32-
release: "{{ .Release.Name }}"
29+
{{- include "oauth2-proxy.labels" . | indent 8 }}
3330
{{- if .Values.podLabels }}
3431
{{ toYaml .Values.podLabels | indent 8 }}
3532
{{- end }}

helm/oauth2-proxy/templates/google-secret.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ kind: Secret
44
metadata:
55
labels:
66
app: {{ template "oauth2-proxy.name" . }}
7-
chart: {{ template "oauth2-proxy.chart" . }}
8-
heritage: {{ .Release.Service }}
9-
release: {{ .Release.Name }}
7+
{{- include "oauth2-proxy.labels" . | indent 4 }}
108
name: {{ template "oauth2-proxy.fullname" . }}-google
119
type: Opaque
1210
data:

helm/oauth2-proxy/templates/ingress.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ kind: Ingress
1717
metadata:
1818
labels:
1919
app: {{ template "oauth2-proxy.name" . }}
20-
chart: {{ template "oauth2-proxy.chart" . }}
21-
heritage: {{ .Release.Service }}
22-
release: {{ .Release.Name }}
20+
{{- include "oauth2-proxy.labels" . | indent 4 }}
2321
name: {{ template "oauth2-proxy.fullname" . }}
2422
{{- with .Values.ingress.annotations }}
2523
annotations:

helm/oauth2-proxy/templates/poddisruptionbudget.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ kind: PodDisruptionBudget
44
metadata:
55
labels:
66
app: {{ template "oauth2-proxy.name" . }}
7-
chart: {{ template "oauth2-proxy.chart" . }}
8-
heritage: {{ .Release.Service }}
9-
release: {{ .Release.Name }}
7+
{{- include "oauth2-proxy.labels" . | indent 4 }}
108
name: {{ template "oauth2-proxy.fullname" . }}
119
spec:
1210
selector:

0 commit comments

Comments
 (0)