Skip to content
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
5 changes: 5 additions & 0 deletions charts/opencrvs-services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ helm upgrade --install opencrvs oci://ghcr.io/opencrvs/opencrvs-services \
<td>opencrvs.org</td>
<td>Hostname for OpenCRVS application, without wildcard or subdomain. Example: hostname: opencrvs.localhost</td>
</tr>
<tr>
<td>subdomain_separator</td>
<td><code>.</code></td>
<td>Separator between <code>hostname</code> and subdomains. See values.yaml for more information.</td>
</tr>
<tr>
<td>ingress.ssl_enabled</td>
<td>true</td>
Expand Down
8 changes: 7 additions & 1 deletion charts/opencrvs-services/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,16 @@ Parameters:
{{- end }}
{{- end }}

{{- define "render-external-subdomain" -}}
{{- $service_name := .service_name }}
{{- $http_scheme := include "http-scheme" . }}
{{- printf "%s%s%s" $service_name ( .Values.subdomain_separator | default ".") .Values.hostname }}
{{- end }}

{{- define "render-external-url" -}}
{{- $service_name := .service_name }}
{{- $http_scheme := include "http-scheme" . }}
{{- printf "%s://%s.%s" $http_scheme $service_name .Values.hostname }}
{{- printf "%s://%s%s%s" $http_scheme $service_name ( .Values.subdomain_separator | default ".") .Values.hostname }}
{{- end }}

{{- define "service-helper" -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/opencrvs-services/templates/auth-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`auth.{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "auth" "Values" .Values) }}`)'
kind: Rule
services:
- name: auth
Expand Down
2 changes: 1 addition & 1 deletion charts/opencrvs-services/templates/client-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`register.{{ .Values.hostname }}`) || Host(`{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "register" "Values" .Values) }}`) || Host(`{{ .Values.hostname }}`)'
kind: Rule
services:
- name: client
Expand Down
2 changes: 1 addition & 1 deletion charts/opencrvs-services/templates/config-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`config.{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "config" "Values" .Values) }}`)'
kind: Rule
services:
- name: config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`countryconfig.{{ .Values.hostname }}`) && !Path(`/email`) && !Path(`/notification`) && !Path(`/dashboards/queries.json`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "countryconfig" "Values" .Values) }}`) && !Path(`/email`) && !Path(`/notification`) && !Path(`/dashboards/queries.json`)'
kind: Rule
services:
- name: countryconfig
Expand All @@ -21,23 +21,23 @@ spec:
middlewares:
- name: sts-and-basic-response-headers
- name: enable-compression
- match: 'Host(`countryconfig.{{ .Values.hostname }}`) && Path(`/email`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "countryconfig" "Values" .Values) }}`) && Path(`/email`)'
kind: Rule
services:
- name: countryconfig
namespace: {{ .Release.Namespace }}
port: {{ .Values.countryconfig.port }}
middlewares:
- name: block-internal-routes
- match: 'Host(`countryconfig.{{ .Values.hostname }}`) && Path(`/notification`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "countryconfig" "Values" .Values) }}`) && Path(`/notification`)'
kind: Rule
services:
- name: countryconfig
namespace: {{ .Release.Namespace }}
port: {{ .Values.countryconfig.port }}
middlewares:
- name: block-internal-routes
- match: 'Host(`countryconfig.{{ .Values.hostname }}`) && Path(`/dashboards/queries.json`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "countryconfig" "Values" .Values) }}`) && Path(`/dashboards/queries.json`)'
kind: Rule
services:
- name: countryconfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`metabase.{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "metabase" "Values" .Values) }}`)'
kind: Rule
services:
- name: dashboards
Expand Down
2 changes: 1 addition & 1 deletion charts/opencrvs-services/templates/events-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`events.{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "events" "Values" .Values) }}`)'
kind: Rule
services:
- name: events
Expand Down
2 changes: 1 addition & 1 deletion charts/opencrvs-services/templates/gateway-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`gateway.{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "gateway" "Values" .Values) }}`)'
kind: Rule
services:
- name: gateway
Expand Down
2 changes: 1 addition & 1 deletion charts/opencrvs-services/templates/login-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`login.{{ .Values.hostname }}`) || Host(`{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "login" "Values" .Values) }}`) || Host(`{{ .Values.hostname }}`)'
kind: Rule
services:
- name: login
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- web
{{- end }}
routes:
- match: 'Host(`webhooks.{{ .Values.hostname }}`)'
- match: 'Host(`{{ include "render-external-subdomain" (dict "service_name" "webhooks" "Values" .Values) }}`)'
kind: Rule
services:
- name: webhooks
Expand Down
11 changes: 11 additions & 0 deletions charts/opencrvs-services/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ postgres:
# All OpenCRVS services will be available under domain:
hostname: opencrvs.localhost

# subdomain_separator: separator between hostname and subdomains
# generic form: <subdomain><subdomain_separator><hostname>
# OpenCRVS can be deployed in different ways:
# - as set of subdomains to hostname, examples:
# - auth.opencrvs.localhost
# - register.opencrvs.localhost
# - as set of variations to main domain,
# in this variant wildcard certificate is needed only to one domain, examples:
# - auth-opencrvs.localhost
# - register-opencrvs.localhost
subdomain_separator: "."

ingress:
# Access OpenCRVS services at https://<hostname>/
Expand Down