Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow helm users to disable kong and use the ingress #9317

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions charts/kubernetes-dashboard/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,63 @@ private.key: {{ randBytes 256 | b64enc | quote }}
{{- fail "value of .Values.app.ingress.issuer.scope must be one of [default, cluster, disabled]"}}
{{- end -}}
{{- end -}}

{{- define "kubernetes-dashboard.ingress.paths" -}}
paths:
{{- if eq .Values.app.mode "dashboard" }}
- pathType: Exact
path: {{ .Values.app.ingress.path }}api/v1/login
backend:
service:
name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.auth.role }}
port:
{{- with (index .Values.auth.containers.ports 0) }}
number: {{ .containerPort }}
{{- end }}
- pathType: Exact
path: {{ .Values.app.ingress.path }}api/v1/csrftoken/login
backend:
service:
name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.auth.role }}
port:
{{- with (index .Values.auth.containers.ports 0) }}
number: {{ .containerPort }}
{{- end }}
- pathType: Exact
path: {{ .Values.app.ingress.path }}api/v1/me
backend:
service:
name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.auth.role }}
port:
{{- with (index .Values.auth.containers.ports 0) }}
number: {{ .containerPort }}
{{- end }}
- pathType: Prefix
path: {{ .Values.app.ingress.path }}
backend:
service:
name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.web.role }}
port:
{{- with (index .Values.web.containers.ports 0) }}
number: {{ .containerPort }}
{{- end }}
{{- end }}
- pathType: Prefix
path: {{ .Values.app.ingress.path }}api
backend:
service:
name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.api.role }}
port:
{{- with (index .Values.api.containers.ports 0) }}
number: {{ .containerPort }}
{{- end }}
- pathType: Prefix
path: {{ .Values.app.ingress.path }}metrics
backend:
service:
name: {{ template "kubernetes-dashboard.name" . }}-{{ .Values.api.role }}
port:
{{- with (index .Values.api.containers.ports 0) }}
number: {{ .containerPort }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/kubernetes-dashboard/templates/config/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{{- if eq .Values.app.mode "dashboard" }}
{{- if and .Values.kong.enabled (eq .Values.app.mode "dashboard") }}

apiVersion: v1
kind: ConfigMap
Expand Down
10 changes: 10 additions & 0 deletions charts/kubernetes-dashboard/templates/networking/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ metadata:
cert-manager.io/cluster-issuer: {{ .Values.app.ingress.issuer.name }}
{{- end }}
{{- if .Values.app.ingress.useDefaultAnnotations }}
{{- if .Values.kong.enabled }}
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
{{- end }}
nginx.ingress.kubernetes.io/ssl-redirect: "true"
{{- end }}
{{- if not (eq .Values.app.ingress.path "/") }}
Expand Down Expand Up @@ -61,6 +63,7 @@ spec:
{{- range $host := .Values.app.ingress.hosts }}
- host: {{ $host }}
http:
{{- if $.Values.kong.enabled }}
paths:
{{- if not (eq $.Values.app.ingress.path "/") }}
- path: {{ $.Values.app.ingress.path }}(/|$)(.*)
Expand All @@ -73,9 +76,13 @@ spec:
name: {{ template "kong.fullname" (index $.Subcharts "kong") }}-proxy
port:
number: {{ $.Values.kong.proxy.tls.servicePort }}
{{- else }}
{{- include "kubernetes-dashboard.ingress.paths" $ | nindent 9 }}
{{- end }}
{{- end }}
{{- else }}
- http:
{{- if .Values.kong.enabled }}
paths:
- path: {{ .Values.app.ingress.path }}
pathType: {{ .Values.app.ingress.pathType }}
Expand All @@ -84,5 +91,8 @@ spec:
name: {{ template "kong.fullname" (index $.Subcharts "kong") }}-proxy
port:
number: {{ $.Values.kong.proxy.tls.servicePort }}
{{- else }}
{{- include "kubernetes-dashboard.ingress.paths" $ | nindent 9 }}
{{- end }}
{{- end }}
{{- end }}
Loading