Skip to content

Commit

Permalink
Have ingresses for both A and B paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rcsb committed May 30, 2024
1 parent dca3a65 commit 2a7a2fe
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 41 deletions.
51 changes: 37 additions & 14 deletions k8s/helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,51 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "helm_chart.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- $labels := include "helm_chart.labels" . | nindent 4 }}
{{- range $path := tuple "a" "b" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "helm_chart.fullname" . }}
name: {{ $fullName }}-{{ $path }}
labels:
{{- include "helm_chart.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
{{- $labels }}
{{- with $.Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls }}
ingressClassName: {{ $.Values.ingress.className }}
tls:
{{- range .Values.ingress.tls }}
- secretName: {{ $.Values.ingress.tls.secretName }}-{{ $path }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
{{- if eq $path "a" }}
{{- range $.Values.ingress.tls.hostsA }}
- {{ . }}
{{- end }}
{{ else }}
{{- range $.Values.ingress.tls.hostsB }}
- {{ . }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- if eq $path "a" }}
{{- range $.Values.ingress.hostsA }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ $fullName }}-{{ $path }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{ else }}
{{- range $.Values.ingress.hostsB }}
- host: {{ .host | quote }}
http:
paths:
Expand All @@ -33,9 +54,11 @@ spec:
pathType: {{ .pathType }}
backend:
service:
name: {{ $fullName }}
name: {{ $fullName }}-{{ $path }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
18 changes: 0 additions & 18 deletions k8s/helm/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,3 @@ spec:
{{- include "helm_chart.selectorLabels" $ | nindent 4 }}
rcsb.org/path: {{ . | quote }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "helm_chart.fullname" . }}
annotations:
rcsb.org/path-operator-managed: "true"
labels:
{{- include "helm_chart.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: TCP
name: http
selector:
{{- include "helm_chart.selectorLabels" . | nindent 4 }}
25 changes: 16 additions & 9 deletions k8s/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,32 @@ ingress:
annotations:
cert-manager.io/cluster-issuer: rutgers-acme
kubernetes.io/tls-acme: "true"
hosts:
- host: idmapper.k8s.rcsb.org
hostsA:
- host: idmapper-a.east.k8s.rcsb.org
paths:
- path: /
pathType: ImplementationSpecific
- host: idmapper.east.k8s.rcsb.org
- host: idmapper-a.west.k8s.rcsb.org
paths:
- path: /
pathType: ImplementationSpecific
- host: idmapper.west.k8s.rcsb.org
hostsB:
- host: idmapper-b.east.k8s.rcsb.org
paths:
- path: /
pathType: ImplementationSpecific
- host: idmapper-b.west.k8s.rcsb.org
paths:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: rcsb-idmapper-tls
hosts:
- idmapper.k8s.rcsb.org
- idmapper.east.k8s.rcsb.org
- idmapper.west.k8s.rcsb.org
secretName: rcsb-idmapper-tls
hostsA:
- idmapper-a.east.k8s.rcsb.org
- idmapper-a.west.k8s.rcsb.org
hostsB:
- idmapper-b.east.k8s.rcsb.org
- idmapper-b.west.k8s.rcsb.org

# Define resource limits for your application. Especially important if you enable autoscaling for this Helm chart.
# Deploy without limits first to test the application performance, then tune afterwards to ensure that autoscaling
Expand Down

0 comments on commit 2a7a2fe

Please sign in to comment.