Skip to content

Commit a20abe7

Browse files
committed
Add config to redirect trafic to external service for nominatim api and ui
1 parent 08436fe commit a20abe7

File tree

5 files changed

+67
-8
lines changed

5 files changed

+67
-8
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{{- if and .Values.nominatimApi.enabled .Values.nominatimApi.externalService.enabled }}
2+
apiVersion: v1
3+
kind: Endpoints
4+
metadata:
5+
name: {{ .Release.Name }}-nominatim-api
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
app: {{ template "osm-seed.name" . }}
9+
component: nominatim-api-endpoints
10+
environment: {{ .Values.environment }}
11+
release: {{ .Release.Name }}
12+
subsets:
13+
- addresses:
14+
- ip: {{ .Values.nominatimApi.externalService.ip }}
15+
ports:
16+
- name: http
17+
port: {{ .Values.nominatimApi.externalService.port }}
18+
protocol: TCP
19+
{{- end }}
20+
---
21+
{{- if and .Values.nominatimUI.enabled .Values.nominatimUI.externalService.enabled }}
22+
apiVersion: v1
23+
kind: Endpoints
24+
metadata:
25+
name: {{ .Release.Name }}-nominatim-ui
26+
namespace: {{ .Release.Namespace }}
27+
labels:
28+
app: {{ template "osm-seed.name" . }}
29+
component: nominatim-ui-endpoints
30+
environment: {{ .Values.environment }}
31+
release: {{ .Release.Name }}
32+
subsets:
33+
- addresses:
34+
- ip: {{ .Values.nominatimUI.externalService.ip }}
35+
ports:
36+
- name: http
37+
port: {{ .Values.nominatimUI.externalService.port }}
38+
protocol: TCP
39+
{{- end }}

osm-seed/templates/nominatim-api/nominatim-ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ spec:
6262
port:
6363
number: 80
6464
{{- end }}
65-
{{- end }}
65+
{{- end }}

osm-seed/templates/nominatim-api/nominatim-pd.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.nominatimApi.enabled -}}
1+
{{- if and .Values.nominatimApi.enabled (not .Values.nominatimApi.externalService.enabled) }}
22
{{- if .Values.nominatimApi.persistenceDisk.enabled -}}
33
apiVersion: v1
44
kind: PersistentVolume
@@ -82,4 +82,4 @@ spec:
8282
storage: {{ .Values.nominatimApi.persistenceDisk.GCP_gcePersistentDisk_size }}
8383
{{- end }}
8484
{{- end }}
85-
{{- end }}
85+
{{- end }}

osm-seed/templates/nominatim-api/nominatim-service.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,25 @@ metadata:
2424
{{- toYaml . | nindent 4 }}
2525
{{- end }}
2626
spec:
27+
{{- if and .Values.nominatimApi.enabled .Values.nominatimApi.externalService.enabled }}
28+
# External service (no selector)
29+
ports:
30+
- name: http
31+
port: 80
32+
targetPort: {{ .Values.nominatimApi.externalService.port | default "80" }}
33+
protocol: TCP
34+
{{- else }}
35+
# Internal service
2736
type: {{ .Values.serviceType }}
2837
ports:
2938
- port: 80
3039
protocol: TCP
3140
name: http
3241
targetPort: api
33-
- port: 5432
34-
protocol: TCP
35-
name: postgres
36-
targetPort: postgres
42+
# - port: 5432
43+
# protocol: TCP
44+
# name: postgres
45+
# targetPort: postgres
3746
{{- if and (eq .Values.serviceType "LoadBalancer") .Values.AWS_SSL_ARN }}
3847
- port: 443
3948
protocol: TCP
@@ -44,6 +53,7 @@ spec:
4453
app: {{ template "osm-seed.name" . }}
4554
release: {{ .Release.Name }}
4655
run: {{ .Release.Name }}-nominatim
56+
{{- end }}
4757
{{- end }}
4858
---
4959
{{- if and .Values.nominatimApi.enabled .Values.nominatimUI.enabled }}
@@ -57,6 +67,15 @@ metadata:
5767
environment: {{ .Values.environment }}
5868
release: {{ .Release.Name }}
5969
spec:
70+
{{- if and .Values.nominatimUI.enabled .Values.nominatimUI.externalService.enabled }}
71+
# External service (no selector)
72+
ports:
73+
- name: http
74+
port: 80
75+
targetPort: {{ .Values.nominatimUI.externalService.port | default "80" }}
76+
protocol: TCP
77+
{{- else }}
78+
# Internal service
6079
type: ClusterIP
6180
ports:
6281
- port: 80
@@ -67,4 +86,5 @@ spec:
6786
app: {{ template "osm-seed.name" . }}
6887
release: {{ .Release.Name }}
6988
run: {{ .Release.Name }}-nominatim
89+
{{- end }}
7090
{{- end }}

osm-seed/templates/nominatim-api/nominatim-statefulset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.nominatimApi.enabled -}}
1+
{{- if and .Values.nominatimApi.enabled (not .Values.nominatimApi.externalService.enabled) }}
22
apiVersion: apps/v1
33
kind: StatefulSet
44
metadata:

0 commit comments

Comments
 (0)