Skip to content

Commit

Permalink
Make the ingress host field optional (#94)
Browse files Browse the repository at this point in the history
* Make the ingress host field optional

* Bump chart version to 0.1.26

* Remove leftover labels

* Fix blobvault ingress annotation

* Make TLS depend on hostnameEnabled

* Fix comparator
  • Loading branch information
jesper7 authored Apr 4, 2023
1 parent 6702a91 commit 235e6eb
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 11 deletions.
2 changes: 1 addition & 1 deletion charts/studio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.25
version: 0.1.26

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
53 changes: 53 additions & 0 deletions charts/studio/templates/ingress-blobvault.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{- if .Values.global.ingress.enabled -}}
{{- if and .Values.global.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.global.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.global.ingress.annotations "kubernetes.io/ingress.class" .Values.global.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: blobvault
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
{{- with .Values.global.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.global.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.global.ingress.className }}
{{- end }}
{{- if and .Values.global.ingress.tlsEnabled .Values.global.ingress.hostnameEnabled }}
tls:
- hosts:
- {{ .Values.global.host }}
secretName: {{ .Values.global.ingress.tlsSecretName }}
{{- end }}
rules:
- http:
paths:
- path: /blobvault(/|$)(.*)
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: ImplementationSpecific
{{- end }}
backend:
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ .Release.Name }}-nginx
port:
name: http
{{- else }}
serviceName: {{ .Release.Name }}-nginx
servicePort: 80
{{- end }}
{{- if .Values.global.ingress.hostnameEnabled }}
host: {{ .Values.global.host }}
{{- end }}
{{- end }}

12 changes: 7 additions & 5 deletions charts/studio/templates/ingress-studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: studio
name: app
labels:
{{- include "studio-ui.labels" . | nindent 4 }}
{{- with .Values.global.ingress.annotations }}
Expand All @@ -24,15 +24,14 @@ spec:
{{- if and .Values.global.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.global.ingress.className }}
{{- end }}
{{- if .Values.global.ingress.tlsEnabled }}
{{- if and .Values.global.ingress.tlsEnabled .Values.global.ingress.hostnameEnabled }}
tls:
- hosts:
- {{ .Values.global.host }}
secretName: {{ .Values.global.ingress.tlsSecretName }}
{{- end }}
rules:
- host: {{ .Values.global.host }}
http:
- http:
paths:
- path: /
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
Expand Down Expand Up @@ -74,6 +73,9 @@ spec:
number: {{ .Values.studioBackend.service.port }}
{{- else }}
serviceName: studio-backend
servicePort: {{ .Values.stu.service.port }}
servicePort: {{ .Values.studioBackend.service.port }}
{{- end }}
{{- if .Values.global.ingress.hostnameEnabled }}
host: {{ .Values.global.host }}
{{- end }}
{{- end }}
7 changes: 2 additions & 5 deletions charts/studio/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ global:

ingress:
enabled: true
hostnameEnabled: true
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
Expand Down Expand Up @@ -139,11 +140,7 @@ nginx:
type: ClusterIP

ingress:
enabled: true
hostname: "localhost"
path: /blobvault(/|$)(.*)
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
enabled: false

extraVolumes:
- name: blobvault
Expand Down

0 comments on commit 235e6eb

Please sign in to comment.