Skip to content

Commit

Permalink
Update port names and numbers for insecure mode (#103)
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Groth <[email protected]>
  • Loading branch information
travisgroth authored May 25, 2020
1 parent d00eb9d commit 9d45ddf
Show file tree
Hide file tree
Showing 14 changed files with 177 additions and 142 deletions.
2 changes: 1 addition & 1 deletion charts/pomerium/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: pomerium
version: 9.0.0
version: 9.1.0
appVersion: 0.8.0
home: http://www.pomerium.io/
icon: https://www.pomerium.io/logo-long.svg
Expand Down
215 changes: 108 additions & 107 deletions charts/pomerium/README.md

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions charts/pomerium/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,35 @@ Adapted from : https://github.com/helm/charts/blob/master/stable/drone/templates
{{- if .Values.operator.enabled -}}
{{- default (printf "%s-base" (include "pomerium.fullname" .)) .Values.config.existingSecret -}}
{{- end -}}
{{- end -}}

{{/*Expand the port number for secure or insecure mode */}}
{{- define "pomerium.trafficPort.number" -}}
{{- if .Values.config.insecure -}}
80
{{- else -}}
443
{{- end -}}
{{- end -}}

{{/*Expand the port name for secure or insecure mode */}}
{{- define "pomerium.trafficPort.name" -}}
{{- if .Values.config.insecure -}}
http
{{- else -}}
https
{{- end -}}
{{- end -}}

{{/*Expand the service port number for secure or insecure mode */}}
{{- define "pomerium.service.externalPort" -}}
{{- if .Values.service.externalPort -}}
{{- .Values.service.externalPort -}}
{{- else -}}
{{- if .Values.config.insecure -}}
80
{{- else -}}
443
{{- end -}}
{{- end -}}
{{- end -}}
8 changes: 4 additions & 4 deletions charts/pomerium/templates/authenticate-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ spec:
value: {{ quote $value }}
{{- end }}
ports:
- containerPort: 443
name: https
- containerPort: {{ template "pomerium.trafficPort.number" . }}
name: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
- containerPort: {{ .Values.metrics.port }}
name: metrics
protocol: TCP
livenessProbe:
httpGet:
path: /ping
port: https
port: {{ template "pomerium.trafficPort.name" . }}
{{- if .Values.config.insecure }}
scheme: HTTP
{{- else }}
Expand All @@ -111,7 +111,7 @@ spec:
readinessProbe:
httpGet:
path: /ping
port: https
port: {{ template "pomerium.trafficPort.name" . }}
{{- if .Values.config.insecure }}
scheme: HTTP
{{- else }}
Expand Down
6 changes: 3 additions & 3 deletions charts/pomerium/templates/authenticate-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: https
- port: {{ template "pomerium.service.externalPort" . }}
targetPort: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
name: https
name: {{ template "pomerium.trafficPort.name" . }}
- name: metrics
port: {{ .Values.metrics.port }}
protocol: TCP
Expand Down
8 changes: 4 additions & 4 deletions charts/pomerium/templates/authorize-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ spec:
value: {{ quote $value }}
{{- end }}
ports:
- containerPort: 443
name: https
- containerPort: {{ template "pomerium.trafficPort.number" . }}
name: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
- containerPort: {{ .Values.metrics.port }}
name: metrics
protocol: TCP
livenessProbe:
tcpSocket:
port: https
port: {{ template "pomerium.trafficPort.name" . }}
initialDelaySeconds: 15
readinessProbe:
tcpSocket:
port: https
port: {{ template "pomerium.trafficPort.name" . }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
Expand Down
6 changes: 3 additions & 3 deletions charts/pomerium/templates/authorize-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ spec:
type: {{ .Values.service.type }}
{{- end }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: https
- port: {{ template "pomerium.service.externalPort" . }}
targetPort: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
name: https
name: {{ template "pomerium.trafficPort.name" . }}
- name: metrics
port: {{ .Values.metrics.port }}
protocol: TCP
Expand Down
8 changes: 4 additions & 4 deletions charts/pomerium/templates/cache-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ spec:
value: {{ quote $value }}
{{- end }}
ports:
- containerPort: 443
name: https
- containerPort: {{ template "pomerium.trafficPort.number" . }}
name: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
- containerPort: {{ .Values.metrics.port }}
name: metrics
protocol: TCP
livenessProbe:
tcpSocket:
port: https
port: {{ template "pomerium.trafficPort.name" . }}
initialDelaySeconds: 15
readinessProbe:
tcpSocket:
port: https
port: {{ template "pomerium.trafficPort.name" . }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
Expand Down
6 changes: 3 additions & 3 deletions charts/pomerium/templates/cache-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ spec:
type: {{ .Values.service.type }}
{{- end }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: https
- port: {{ template "pomerium.service.externalPort" . }}
targetPort: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
name: https
name: {{ template "pomerium.trafficPort.name" . }}
- name: metrics
port: {{ .Values.metrics.port }}
protocol: TCP
Expand Down
10 changes: 5 additions & 5 deletions charts/pomerium/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
- paths:
backend:
serviceName: {{ template "pomerium.proxy.fullname" $ }}
servicePort: https
servicePort: {{ template "pomerium.trafficPort.name" $ }}
{{- end }}
{{- if not (or .Values.ingress.hosts .Values.forwardAuth.enabled) }}
{{- range .Values.config.policy }}
Expand All @@ -47,7 +47,7 @@ spec:
- paths:
backend:
serviceName: {{ template "pomerium.proxy.fullname" $ }}
servicePort: https
servicePort: {{ template "pomerium.trafficPort.name" $ }}
{{- end }}
{{- end }}
{{- if and (.Values.forwardAuth.enabled) (not .Values.forwardAuth.internal)}}
Expand All @@ -57,7 +57,7 @@ spec:
- paths:
backend:
serviceName: {{ template "pomerium.proxy.fullname" . }}
servicePort: https
servicePort: {{ template "pomerium.trafficPort.name" . }}
{{- end }}
{{- if not .Values.service.authorize.headless }}
- host: {{ printf "authorize.%s" .Values.config.rootDomain }}
Expand All @@ -66,13 +66,13 @@ spec:
- paths:
backend:
serviceName: {{ template "pomerium.authorize.fullname" . }}
servicePort: https
servicePort: {{ template "pomerium.trafficPort.name" . }}
{{- end }}
- host: {{ printf "authenticate.%s" .Values.config.rootDomain }}
http:
paths:
- paths:
backend:
serviceName: {{ template "pomerium.authenticate.fullname" . }}
servicePort: https
servicePort: {{ template "pomerium.trafficPort.name" . }}
{{- end }}
8 changes: 4 additions & 4 deletions charts/pomerium/templates/proxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ spec:
value: {{ quote $value }}
{{- end }}
ports:
- containerPort: 443
name: https
- containerPort: {{ template "pomerium.trafficPort.number" . }}
name: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
- containerPort: {{ .Values.metrics.port }}
name: metrics
protocol: TCP
livenessProbe:
httpGet:
path: /ping
port: https
port: {{ template "pomerium.trafficPort.name" . }}
{{- if .Values.config.insecure }}
scheme: HTTP
{{- else }}
Expand All @@ -112,7 +112,7 @@ spec:
readinessProbe:
httpGet:
path: /ping
port: https
port: {{ template "pomerium.trafficPort.name" . }}
{{- if .Values.config.insecure }}
scheme: HTTP
{{- else }}
Expand Down
6 changes: 3 additions & 3 deletions charts/pomerium/templates/proxy-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: https
- port: {{ template "pomerium.service.externalPort" . }}
targetPort: {{ template "pomerium.trafficPort.name" . }}
protocol: TCP
name: https
name: {{ template "pomerium.trafficPort.name" . }}
- name: metrics
port: {{ .Values.metrics.port }}
protocol: TCP
Expand Down
1 change: 1 addition & 0 deletions charts/pomerium/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ metadata:
type: Opaque
stringData:
config.yaml: |
address: :{{ template "pomerium.trafficPort.number" . }}
{{- if and .Values.config.existingPolicy .Values.config.extraOpts }}
{{ fail "Cannot use config.extraOpts with config.existingPolicy" }}
{{- end }}
Expand Down
4 changes: 3 additions & 1 deletion charts/pomerium/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ config:
forceGenerateSigningKey: false
extraOpts: {}
existingPolicy: ""
insecure: false
administrators: ""
policy: []

Expand Down Expand Up @@ -158,7 +159,8 @@ service:
cache:
headless: true
type: ClusterIP
externalPort: 443
# externalPort defaults to 80 or 443 depending on config.insecure
externalPort: ""
annotations:
{}
# === GKE load balancer tweaks; default on until I can figure out
Expand Down

0 comments on commit 9d45ddf

Please sign in to comment.