Skip to content

Commit

Permalink
Add single NodePort svc
Browse files Browse the repository at this point in the history
  • Loading branch information
as51340 committed Nov 25, 2024
1 parent 1936f67 commit d8dbf54
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 70 deletions.
7 changes: 4 additions & 3 deletions charts/memgraph-high-availability/templates/coordinators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spec:
metadata:
labels:
app: memgraph-coordinator-{{ $coordinator.id }}
instance-type: coordinator
spec:
{{ if $.Values.memgraph.affinity.enabled }}
affinity:
Expand Down Expand Up @@ -57,9 +58,9 @@ spec:
image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}"
imagePullPolicy: {{ $.Values.memgraph.image.pullPolicy }}
ports:
- containerPort: {{ $coordinator.boltPort }}
- containerPort: {{ $coordinator.managementPort }}
- containerPort: {{ $coordinator.coordinatorPort }}
- containerPort: {{ $.Values.memgraph.ports.boltPort }}
- containerPort: {{ $.Values.memgraph.ports.managementPort }}
- containerPort: {{ $.Values.memgraph.ports.coordinatorPort }}
args:
{{- range $arg := $coordinator.args }}
- "{{ $arg }}"
Expand Down
7 changes: 4 additions & 3 deletions charts/memgraph-high-availability/templates/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ spec:
metadata:
labels:
app: memgraph-data-{{ $data.id }}
instance-type: data
spec:
{{ if $.Values.memgraph.affinity.enabled }}
affinity:
Expand Down Expand Up @@ -57,9 +58,9 @@ spec:
image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}"
imagePullPolicy: {{ $.Values.memgraph.image.pullPolicy }}
ports:
- containerPort: {{ $data.boltPort }}
- containerPort: {{ $data.managementPort }}
- containerPort: {{ $data.replicationPort }}
- containerPort: {{ $.Values.memgraph.ports.boltPort }}
- containerPort: {{ $.Values.memgraph.ports.managementPort }}
- containerPort: {{ $.Values.memgraph.ports.replicationPort }}
args:
{{- range $arg := $data.args }}
- "{{ $arg }}"
Expand Down
13 changes: 13 additions & 0 deletions charts/memgraph-high-availability/templates/external-access.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: external-access
spec:
type: NodePort
selector:
instance-type: coordinator
ports:
- protocol: TCP
name: bolt
port: {{ $.Values.memgraph.ports.boltPort }}
targetPort: {{ $.Values.memgraph.ports.boltPort }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,14 @@ spec:
ports:
- protocol: TCP
name: bolt
port: {{ .boltPort }}
targetPort: {{ .boltPort }}
port: {{ $.Values.memgraph.ports.boltPort }}
targetPort: {{ $.Values.memgraph.ports.boltPort }}
- protocol: TCP
name: coordinator
port: {{ .coordinatorPort }}
targetPort: {{ .coordinatorPort }}
port: {{ $.Values.memgraph.ports.coordinatorPort }}
targetPort: {{ $.Values.memgraph.ports.coordinatorPort }}
- protocol: TCP
name: management
port: {{ .managementPort }}
targetPort: {{ .managementPort }}
{{- end }}

# Service for coordinators instances external
{{- range .Values.coordinators }}
---
apiVersion: v1
kind: Service
metadata:
name: memgraph-coordinator-{{ .id }}-external
spec:
type: NodePort
selector:
app: memgraph-coordinator-{{ .id }}
ports:
- protocol: TCP
name: bolt
port: {{ .boltPort }}
targetPort: {{ .boltPort }}
port: {{ $.Values.memgraph.ports.managementPort }}
targetPort: {{ $.Values.memgraph.ports.managementPort }}
{{- end }}
30 changes: 6 additions & 24 deletions charts/memgraph-high-availability/templates/services-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,14 @@ spec:
ports:
- protocol: TCP
name: bolt
port: {{ .boltPort }}
targetPort: {{ .boltPort }}
port: {{ $.Values.memgraph.ports.boltPort }}
targetPort: {{ $.Values.memgraph.ports.boltPort }}
- protocol: TCP
name: management
port: {{ .managementPort }}
targetPort: {{ .managementPort }}
port: {{ $.Values.memgraph.ports.managementPort }}
targetPort: {{ $.Values.memgraph.ports.managementPort }}
- protocol: TCP
name: replication
port: {{ .replicationPort }}
targetPort: {{ .replicationPort }}
{{- end }}

# Service for data instances external
{{- range .Values.data }}
---
apiVersion: v1
kind: Service
metadata:
name: memgraph-data-{{ .id }}-external
spec:
type: NodePort
selector:
app: memgraph-data-{{ .id }}
ports:
- protocol: TCP
name: bolt
port: {{ .boltPort }}
targetPort: {{ .boltPort }}
port: {{ $.Values.memgraph.ports.replicationPort }}
targetPort: {{ $.Values.memgraph.ports.replicationPort }}
{{- end }}
23 changes: 7 additions & 16 deletions charts/memgraph-high-availability/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Default values for memgraph-high-availability.
#{{ $.Values.memgraph.image.repository }}: Default values for memgraph-high-availability.

Check failure on line 1 in charts/memgraph-high-availability/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

1:2 [comments] missing starting space in comment
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.|

Expand Down Expand Up @@ -38,13 +38,16 @@ memgraph:
logPVCSize: "256Mi"
affinity:
enabled: true
ports:
boltPort: 7687
managementPort: 10000
replicationPort: 20000
coordinatorPort: 12000



Check failure on line 48 in charts/memgraph-high-availability/values.yaml

View workflow job for this annotation

GitHub Actions / lint-test

48:1 [empty-lines] too many blank lines (3 > 2)
data:
- id: "0"
boltPort: 7687
managementPort: 10000
replicationPort: 20000
args:
- "--experimental-enabled=high-availability"
- "--management-port=10000"
Expand All @@ -54,9 +57,6 @@ data:
- "--log-file=/var/log/memgraph/memgraph.log"

- id: "1"
boltPort: 7687
managementPort: 10000
replicationPort: 20000
args:
- "--experimental-enabled=high-availability"
- "--management-port=10000"
Expand All @@ -67,9 +67,6 @@ data:

coordinators:
- id: "1"
boltPort: 7687
managementPort: 10000
coordinatorPort: 12000
args:
- "--experimental-enabled=high-availability"
- "--coordinator-id=1"
Expand All @@ -83,9 +80,6 @@ coordinators:
- "--nuraft-log-file=/var/log/memgraph/memgraph.log"

- id: "2"
boltPort: 7687
managementPort: 10000
coordinatorPort: 12000
args:
- "--experimental-enabled=high-availability"
- "--coordinator-id=2"
Expand All @@ -99,9 +93,6 @@ coordinators:
- "--nuraft-log-file=/var/log/memgraph/memgraph.log"

- id: "3"
boltPort: 7687
managementPort: 10000
coordinatorPort: 12000
args:
- "--experimental-enabled=high-availability"
- "--coordinator-id=3"
Expand Down

0 comments on commit d8dbf54

Please sign in to comment.