Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[helm] Adding support for gateways and leafnodes #36

Merged
merged 2 commits into from
Mar 25, 2020
Merged
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
54 changes: 54 additions & 0 deletions helm/charts/nats/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,66 @@ data:
include "advertise/client_advertise.conf"
{{- end }}

#################
# #
# NATS Leafnode #
# #
#################
{{- if .Values.leafnodes.enabled }}
leafnodes {
listen: "0.0.0.0:7422"
{{ if and .Values.nats.advertise .Values.nats.externalAccess }}
include "advertise/gateway_advertise.conf"
{{ end }}

remotes: [
{{- range .Values.leafnodes.remotes }}
{
{{- with .url }}
url: {{ . }}
{{- end }}

{{- with .credentials }}
credentials: "/etc/nats-creds/{{ .secret.name }}/{{ .secret.key }}"
{{- end }}
}
{{- end }}
]
}
{{ end }}

#################
# #
# NATS Gateways #
# #
#################
{{- if .Values.gateway.enabled }}
gateway {
name: {{ .Values.gateway.name }}
port: 7522

{{ if and .Values.nats.advertise .Values.nats.externalAccess }}
include "advertise/gateway_advertise.conf"
{{ end }}

# Gateways array here
gateways: [
{{- range .Values.gateway.gateways }}
{
{{- with .name }}
name: {{ . }}
{{- end }}

{{- with .url }}
url: {{ . | quote }}
{{- end }}

{{- with .urls }}
urls: {{ . | quote }}
{{- end }}
},
{{- end }}
]
}
{{ end }}

Expand Down
2 changes: 2 additions & 0 deletions helm/charts/nats/templates/nats-box.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ spec:
{{- if .Values.natsbox.credentials }}
- name: USER_CREDS
value: /etc/nats-config/creds/{{ .Values.natsbox.credentials.secret.key }}
- name: USER2_CREDS
value: /etc/nats-config/creds/{{ .Values.natsbox.credentials.secret.key }}
{{- end }}
command:
- "tail"
Expand Down
25 changes: 25 additions & 0 deletions helm/charts/nats/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ spec:
emptyDir: {}
{{ end }}

{{- if .Values.leafnodes.enabled }}
#
# Leafnode credential volumes
#
{{- range .Values.leafnodes.remotes }}
{{- with .credentials }}
- name: {{ .secret.name }}-volume
secret:
secretName: {{ .secret.name }}
{{- end }}
{{- end }}
{{- end }}

{{ if and .Values.nats.externalAccess .Values.nats.advertise }}
# Assume that we only use the service account in case we want to
# figure out what is the current external public IP from the server
Expand Down Expand Up @@ -161,6 +174,18 @@ spec:
- name: operator-jwt-volume
mountPath: /etc/nats-config/operator
{{- end }}

{{- if .Values.leafnodes.enabled }}
#
# Leafnode credential volumes
#
{{- range .Values.leafnodes.remotes }}
{{- with .credentials }}
- name: {{ .secret.name }}-volume
mountPath: /etc/nats-creds/{{ .secret.name }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

# Liveness/Readiness probes against the monitoring.
Expand Down
14 changes: 14 additions & 0 deletions helm/charts/nats/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,21 @@ cluster:
#
leafnodes:
enabled: false
# remotes:
# - url: "tls://connect.ngs.global:7422"

# Gateway connections to create a super cluster
#
# https://docs.nats.io/nats-server/configuration/gateways
#
gateway:
enabled: false
name: 'default'
# List of remote gateways
# gateways:
# - name: other
# url: nats://my-gateway-url:7522

# In case of both external access and advertisements being
# enabled, an initializer container will be used to gather
# the public ips.
Expand Down