Skip to content

Commit

Permalink
Use dedicated no-auth Ingress when multiple containers (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock authored May 14, 2024
1 parent 4e2b7bf commit 88e89d6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion charts/webservice/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: webservice
description: OSC webservice bootstrap Helm Chart
type: application
version: 0.34.2
version: 0.34.3
appVersion: "0.1.0"
maintainers:
- name: treydock
Expand Down
42 changes: 21 additions & 21 deletions charts/webservice/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
{{ $root := . }}
{{ range $idx, $container := .Values.containers }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "webservice.name" . }}
name: {{ tpl $container.name $root }}
labels:
{{- include "webservice.labels" . | nindent 4 }}
{{- if (include "webservice.alert.receiver" .) }}
receiver: {{ include "webservice.alert.receiver" . }}
{{- include "webservice.labels" $root | nindent 4 }}
{{- if (include "webservice.alert.receiver" $root) }}
receiver: {{ include "webservice.alert.receiver" $root }}
{{- end }}
annotations:
{{- if .Values.auth.enable }}
{{- if $root.Values.auth.enable }}
prometheus.io/probe_scheme: 'https'
{{- end }}
{{- if not .Values.auth.enable }}
{{- if not $root.Values.auth.enable }}
cert-manager.io/cluster-issuer: letsencrypt
{{- end }}
{{- with .Values.ingress.annotations }}
{{- with $root.Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.auth.enable }}
{{- if and (ne $container.auth false) (eq $root.Values.auth.enable true) }}
nginx.ingress.kubernetes.io/auth-url: "https://$host/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://$host/oauth2/start?rd=$escaped_request_uri"
{{- end }}
{{- if (include "webservice.ingressHostAlias" .) }}
nginx.ingress.kubernetes.io/server-alias: {{ tpl (include "webservice.ingressHostAlias" .) . }}
{{- if (include "webservice.ingressHostAlias" $root) }}
nginx.ingress.kubernetes.io/server-alias: {{ tpl (include "webservice.ingressHostAlias" $root) $root }}
{{- end }}
{{- if eq .Values.appType "rshiny" }}
{{- toYaml .Values.ingress.rShinyAnnotations | nindent 4 }}
{{- if eq $root.Values.appType "rshiny" }}
{{- toYaml $root.Values.ingress.rShinyAnnotations | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.auth.enable }}
{{- if not $root.Values.auth.enable }}
tls:
- hosts:
- {{ required "Must provide ingress host" (tpl (include "webservice.ingressHost" .) .) | quote }}
{{- if (include "webservice.ingressHostAlias" .) }}
- {{ tpl (include "webservice.ingressHostAlias" .) . | quote }}
- {{ required "Must provide ingress host" (tpl (include "webservice.ingressHost" $root) $root) | quote }}
{{- if (include "webservice.ingressHostAlias" $root) }}
- {{ tpl (include "webservice.ingressHostAlias" $root) $root | quote }}
{{- end }}
secretName: {{ include "webservice.name" . }}-cert
secretName: {{ include "webservice.name" $root }}-cert
{{- end }}
rules:
- host: {{ tpl (include "webservice.ingressHost" .) . | quote }}
- host: {{ tpl (include "webservice.ingressHost" $root) $root | quote }}
http:
paths:
{{- $root := . }}
{{- range $idx, $container := .Values.containers }}
- path: {{ $container.ingressPath }}
pathType: Prefix
backend:
service:
name: {{ include "webservice.name" $root }}
port:
number: {{ $container.port | default (add $root.Values.service.port $idx) }}
{{- end }}
{{ end }}
1 change: 1 addition & 0 deletions charts/webservice/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ containers:
portName: http
startCommand: ~
ingressPath: /
auth: ~

image:
repository:
Expand Down

0 comments on commit 88e89d6

Please sign in to comment.