Skip to content

Commit 4d36457

Browse files
authored
Added ingress for apiVersion: networking.k8s.io/v1 (#37)
* Added ingress for apiVersion: networking.k8s.io/v1 fix variables added missing new line character * add deprecation yaml, docs + major version bump
1 parent 9b07555 commit 4d36457

File tree

7 files changed

+60
-13
lines changed

7 files changed

+60
-13
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: 3.3.2
2+
version: 4.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: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,20 @@ This version upgrades oauth2-proxy to v4.0.0. Please see the [changelog](https:/
4646

4747
Version 2.0.0 of this chart introduces support for Kubernetes v1.16.x by way of addressing the deprecation of the Deployment object apiVersion `apps/v1beta2`. See [the v1.16 API deprecations page](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/) for more information.
4848

49-
Due to [this issue](https://github.com/helm/helm/issues/6583) there may be errors performing a `helm upgrade`of this chart from versions earlier than 2.0.0.
49+
Due to [this issue](https://github.com/helm/helm/issues/6583) there may be errors performing a `helm upgrade` of this chart from versions earlier than 2.0.0.
5050

5151
### To 3.0.0
5252

5353
Version 3.0.0 introduces support for [EKS IAM roles for service accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html) by adding a managed service account to the chart. This is a breaking change since the service account is enabled by default. To disable this behaviour set `serviceAccount.enabled` to `false`
5454

55+
### To 4.0.0
56+
57+
Version 4.0.0 adds support for the new Ingress apiVersion **networking.k8s.io/v1**.
58+
Therefore the `ingress.extraPaths` parameter needs to be updated to the new format.
59+
See the [v1.22 API deprecations guide](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#ingress-v122) for more information.
60+
61+
For the same reason `service.port` was renamed to `service.portNumber`.
62+
5563
## Configuration
5664

5765
The following table lists the configurable parameters of the oauth2-proxy chart and their default values.
@@ -109,7 +117,7 @@ Parameter | Description | Default
109117
`readinessProbe.successThreshold` | number of successes | 1
110118
`replicaCount` | desired number of pods | `1`
111119
`resources` | pod resource requests & limits | `{}`
112-
`service.port` | port for the service | `80`
120+
`service.portNumber` | port number for the service | `80`
113121
`service.type` | type of service | `ClusterIP`
114122
`service.clusterIP` | cluster ip address | `nil`
115123
`service.loadBalancerIP` | ip of load balancer | `nil`
@@ -131,7 +139,7 @@ Parameter | Description | Default
131139
`sessionStorage.redis.sentinel.masterName` | Redis sentinel master name | `nil`
132140
`sessionStorage.redis.sentinel.connectionUrls` | List of Redis sentinel connection URLs (e.g. redis://HOST[:PORT]) | `[]`
133141
`redis.enabled` | Enable the redis subchart deployment | `false`
134-
142+
`checkDeprecation` | Enable deprecation checks | `true`
135143

136144
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
137145

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
ingress:
22
extraPaths:
33
- path: /*
4+
pathType: ImplementationSpecific
45
backend:
5-
serviceName: ssl-redirect
6-
servicePort: use-annotation
6+
service:
7+
name: ssl-redirect
8+
port:
9+
name: use-annotation
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.checkDeprecation }}
2+
{{- if .Values.service.port }}
3+
{{ fail "`service.port` does no longer exist. It has been renamed to `service.portNumber`" }}
4+
{{- end }}
5+
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
6+
{{- range .Values.ingress.extraPaths }}
7+
{{- if or (.backend.serviceName) (.backend.servicePort) }}
8+
{{ fail "Please update the format of your `ingress.extraPaths` to the new ingress apiVersion `networking.k8s.io/v1` format" }}
9+
{{- end }}
10+
{{- end }}
11+
{{- end }}
12+
{{- end }}

helm/oauth2-proxy/templates/ingress.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $serviceName := include "oauth2-proxy.fullname" . -}}
3-
{{- $servicePort := .Values.service.port -}}
3+
{{- $servicePort := .Values.service.portNumber -}}
44
{{- $ingressPath := .Values.ingress.path -}}
5+
{{- $ingressPathType := .Values.ingress.pathType -}}
56
{{- $extraPaths := .Values.ingress.extraPaths -}}
6-
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
7+
{{- $apiV1 := false -}}
8+
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
9+
apiVersion: networking.k8s.io/v1
10+
{{- $apiV1 = true -}}
11+
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
712
apiVersion: networking.k8s.io/v1beta1
813
{{- else -}}
914
apiVersion: extensions/v1beta1
@@ -26,13 +31,23 @@ spec:
2631
- host: {{ $host | quote }}
2732
http:
2833
paths:
29-
{{ if $extraPaths }}
34+
{{- if $extraPaths }}
3035
{{ toYaml $extraPaths | indent 10 }}
3136
{{- end }}
37+
{{- if $apiV1 }}
38+
- path: {{ $ingressPath }}
39+
pathType: {{ $ingressPathType }}
40+
backend:
41+
service:
42+
name: {{ $serviceName }}
43+
port:
44+
number: {{ $servicePort }}
45+
{{- else }}
3246
- path: {{ $ingressPath }}
3347
backend:
3448
serviceName: {{ $serviceName }}
3549
servicePort: {{ $servicePort }}
50+
{{- end }}
3651
{{- end -}}
3752
{{- if .Values.ingress.tls }}
3853
tls:

helm/oauth2-proxy/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
type: {{ .Values.service.type }}
3131
{{- end }}
3232
ports:
33-
- port: {{ .Values.service.port }}
33+
- port: {{ .Values.service.portNumber }}
3434
targetPort: {{ .Values.httpScheme }}
3535
protocol: TCP
3636
name: {{ .Values.httpScheme }}

helm/oauth2-proxy/values.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ service:
7373
# when service.type is LoadBalancer ...
7474
# loadBalancerIP: 198.51.100.40
7575
# loadBalancerSourceRanges: 203.0.113.0/24
76-
port: 80
76+
portNumber: 80
7777
annotations: {}
7878
# foo.io/bar: "true"
7979

@@ -89,15 +89,21 @@ serviceAccount:
8989
ingress:
9090
enabled: false
9191
path: /
92+
# Only used if API capabilities (networking.k8s.io/v1) allow it
93+
pathType: ImplementationSpecific
9294
# Used to create an Ingress record.
9395
# hosts:
9496
# - chart-example.local
9597
# Extra paths to prepend to every host configuration. This is useful when working with annotation based services.
98+
# Warning! The configuration is dependant on your current k8s API version capabilities (networking.k8s.io/v1)
9699
# extraPaths:
97100
# - path: /*
101+
# pathType: ImplementationSpecific
98102
# backend:
99-
# serviceName: ssl-redirect
100-
# servicePort: use-annotation
103+
# service:
104+
# name: ssl-redirect
105+
# port:
106+
# name: use-annotation
101107
# annotations:
102108
# kubernetes.io/ingress.class: nginx
103109
# kubernetes.io/tls-acme: "true"
@@ -222,3 +228,6 @@ redis:
222228
# cluster:
223229
# enabled: false
224230
# slaveCount: 1
231+
232+
# Enables apiVersion deprecation checks
233+
checkDeprecation: true

0 commit comments

Comments
 (0)