Skip to content

Commit

Permalink
Merge pull request #1906 from bcgov/chore/update-route
Browse files Browse the repository at this point in the history
chore: update route.yaml
  • Loading branch information
mikevespi authored May 9, 2024
2 parents 39ad9bb + af8f257 commit 3303959
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 4 deletions.
1 change: 1 addition & 0 deletions chart/cas-cif/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ dependencies:
- name: certbot
version: 0.1.3
repository: https://bcdevops.github.io/certbot
condition: certbot.enabled
38 changes: 38 additions & 0 deletions chart/cas-cif/templates/route.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if hasSuffix "-prod" .Release.Namespace }}

{{- $keySecret := "Secret not found" }}
{{- $certSecret := "Secret not found" }}
{{- $CACertSecret := "Secret not found" }}

{{- $existingSSLSecret := (lookup "v1" "Secret" .Release.Namespace "ssl-cert-cas-cif" ) }}
{{- if $existingSSLSecret }}
{{- $keySecret = index $existingSSLSecret.data "private-key" | b64dec | quote}}
{{- $certSecret = index $existingSSLSecret.data "certificate" | b64dec | quote}}
{{- $CACertSecret = index $existingSSLSecret.data "CACert" | b64dec | quote}}
{{- end -}}

apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ template "cas-cif.fullname" . }}
labels: {{ include "cas-cif.labels" . | nindent 4 }}
annotations:
haproxy.router.openshift.io/balance: roundrobin

spec:
host: {{ .Values.hostName }}
port:
targetPort: {{ template "cas-cif.fullname" . }}
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
key: {{ $keySecret }}
certificate: {{ $certSecret }}
caCertificate: {{ $CACertSecret }}
to:
kind: Service
name: {{ template "cas-cif.fullname" . }}
weight: 100
wildcardPolicy: None

{{- end }}
4 changes: 4 additions & 0 deletions chart/cas-cif/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if not (hasSuffix "-prod" .Release.Namespace)}}

{{- $route := (lookup "route.openshift.io/v1" "Route" .Release.Namespace "cas-cif" ) }}
{{- $certificate := "" }}
{{- $key := "" }}
Expand Down Expand Up @@ -32,3 +34,5 @@ spec:
name: {{ template "cas-cif.fullname" . }}
weight: 100
wildcardPolicy: None

{{- end -}}
3 changes: 3 additions & 0 deletions chart/cas-cif/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ deploy-db:

download-dags:
airflowEndpoint: https://cas-airflow-dev.apps.silver.devops.gov.bc.ca

certbot:
enabled: true
5 changes: 1 addition & 4 deletions chart/cas-cif/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
hostName: cif.gov.bc.ca

certbot:
certbot:
server:
secretName: cas-acme-url
secretKey: url
enabled: false

deploy-db:
airflowEndpoint: https://cas-airflow-prod.apps.silver.devops.gov.bc.ca
Expand Down
3 changes: 3 additions & 0 deletions chart/cas-cif/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ deploy-db:

download-dags:
airflowEndpoint: https://cas-airflow-test.apps.silver.devops.gov.bc.ca

certbot:
enabled: true

0 comments on commit 3303959

Please sign in to comment.