nats chart provisoning
This commit is contained in:
32
opencloud/charts/nats/files/config/cluster.yaml
Normal file
32
opencloud/charts/nats/files/config/cluster.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- with .Values.config.cluster }}
|
||||
name: {{ $.Values.statefulSet.name }}
|
||||
port: {{ .port }}
|
||||
no_advertise: true
|
||||
routes:
|
||||
{{- $proto := ternary "tls" "nats" .tls.enabled }}
|
||||
{{- $auth := "" }}
|
||||
{{- if and .routeURLs.user .routeURLs.password }}
|
||||
{{- $auth = printf "%s:%s@" (urlquery .routeURLs.user) (urlquery .routeURLs.password) -}}
|
||||
{{- end }}
|
||||
{{- $domain := $.Values.headlessService.name }}
|
||||
{{- if .routeURLs.useFQDN }}
|
||||
{{- $domain = printf "%s.%s.svc.%s" $domain (include "nats.namespace" $) .routeURLs.k8sClusterDomain }}
|
||||
{{- end }}
|
||||
{{- $port := (int .port) }}
|
||||
{{- range $i, $_ := until (int .replicas) }}
|
||||
- {{ printf "%s://%s%s-%d.%s:%d" $proto $auth $.Values.statefulSet.name $i $domain $port }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .routeURLs.user .routeURLs.password }}
|
||||
authorization:
|
||||
user: {{ .routeURLs.user | quote }}
|
||||
password: {{ .routeURLs.password | quote }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .tls }}
|
||||
{{- if .enabled }}
|
||||
tls:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/tls.yaml" "ctx" (merge (dict "tls" .) $)) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
114
opencloud/charts/nats/files/config/config.yaml
Normal file
114
opencloud/charts/nats/files/config/config.yaml
Normal file
@@ -0,0 +1,114 @@
|
||||
{{- with .Values.config }}
|
||||
|
||||
server_name: << $SERVER_NAME >>
|
||||
lame_duck_grace_period: 10s
|
||||
lame_duck_duration: 30s
|
||||
pid_file: /var/run/nats/nats.pid
|
||||
|
||||
########################################
|
||||
# NATS
|
||||
########################################
|
||||
{{- with .nats }}
|
||||
port: {{ .port }}
|
||||
|
||||
{{- with .tls }}
|
||||
{{- if .enabled }}
|
||||
tls:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/tls.yaml" "ctx" (merge (dict "tls" .) $)) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# leafnodes
|
||||
########################################
|
||||
{{- with .leafnodes }}
|
||||
{{- if .enabled }}
|
||||
leafnodes:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/leafnodes.yaml" "ctx" $) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# websocket
|
||||
########################################
|
||||
{{- with .websocket }}
|
||||
{{- if .enabled }}
|
||||
websocket:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/websocket.yaml" "ctx" $) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# MQTT
|
||||
########################################
|
||||
{{- with .mqtt }}
|
||||
{{- if .enabled }}
|
||||
mqtt:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/mqtt.yaml" "ctx" $) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# cluster
|
||||
########################################
|
||||
{{- with .cluster }}
|
||||
{{- if .enabled }}
|
||||
cluster:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/cluster.yaml" "ctx" $) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# gateway
|
||||
########################################
|
||||
{{- with .gateway }}
|
||||
{{- if .enabled }}
|
||||
gateway:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/gateway.yaml" "ctx" $) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# monitor
|
||||
########################################
|
||||
{{- with .monitor }}
|
||||
{{- if .enabled }}
|
||||
{{- if .tls.enabled }}
|
||||
https_port: {{ .port }}
|
||||
{{- else }}
|
||||
http_port: {{ .port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# profiling
|
||||
########################################
|
||||
{{- with .profiling }}
|
||||
{{- if .enabled }}
|
||||
prof_port: {{ .port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# jetstream
|
||||
########################################
|
||||
{{- with $.Values.config.jetstream -}}
|
||||
{{- if .enabled }}
|
||||
jetstream:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/jetstream.yaml" "ctx" $) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
########################################
|
||||
# resolver
|
||||
########################################
|
||||
{{- with $.Values.config.resolver -}}
|
||||
{{- if .enabled }}
|
||||
resolver:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/resolver.yaml" "ctx" $) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
11
opencloud/charts/nats/files/config/gateway.yaml
Normal file
11
opencloud/charts/nats/files/config/gateway.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- with .Values.config.gateway }}
|
||||
name: {{ $.Values.statefulSet.name }}
|
||||
port: {{ .port }}
|
||||
|
||||
{{- with .tls }}
|
||||
{{- if .enabled }}
|
||||
tls:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/tls.yaml" "ctx" (merge (dict "tls" .) $)) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
23
opencloud/charts/nats/files/config/jetstream.yaml
Normal file
23
opencloud/charts/nats/files/config/jetstream.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
{{- with .Values.config.jetstream }}
|
||||
{{- with .memoryStore }}
|
||||
{{- if .enabled }}
|
||||
{{- with .maxSize }}
|
||||
max_memory_store: << {{ . }} >>
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
max_memory_store: 0
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .fileStore }}
|
||||
{{- if .enabled }}
|
||||
store_dir: {{ .dir }}
|
||||
{{- if .maxSize }}
|
||||
max_file_store: << {{ .maxSize }} >>
|
||||
{{- else if .pvc.enabled }}
|
||||
max_file_store: << {{ .pvc.size }} >>
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
max_file_store: 0
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
11
opencloud/charts/nats/files/config/leafnodes.yaml
Normal file
11
opencloud/charts/nats/files/config/leafnodes.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- with .Values.config.leafnodes }}
|
||||
port: {{ .port }}
|
||||
no_advertise: true
|
||||
|
||||
{{- with .tls }}
|
||||
{{- if .enabled }}
|
||||
tls:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/tls.yaml" "ctx" (merge (dict "tls" .) $)) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
10
opencloud/charts/nats/files/config/mqtt.yaml
Normal file
10
opencloud/charts/nats/files/config/mqtt.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- with .Values.config.mqtt }}
|
||||
port: {{ .port }}
|
||||
|
||||
{{- with .tls }}
|
||||
{{- if .enabled }}
|
||||
tls:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/tls.yaml" "ctx" (merge (dict "tls" .) $)) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
10
opencloud/charts/nats/files/config/protocol.yaml
Normal file
10
opencloud/charts/nats/files/config/protocol.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- with .protocol }}
|
||||
port: {{ .port }}
|
||||
|
||||
{{- with .tls }}
|
||||
{{- if .enabled }}
|
||||
tls:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/tls.yaml" "ctx" (merge (dict "tls" .) $)) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
3
opencloud/charts/nats/files/config/resolver.yaml
Normal file
3
opencloud/charts/nats/files/config/resolver.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
{{- with .Values.config.resolver }}
|
||||
dir: {{ .dir }}
|
||||
{{- end }}
|
||||
16
opencloud/charts/nats/files/config/tls.yaml
Normal file
16
opencloud/charts/nats/files/config/tls.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
# tls
|
||||
{{- with .tls }}
|
||||
{{- if .secretName }}
|
||||
{{- $dir := trimSuffix "/" .dir }}
|
||||
cert_file: {{ printf "%s/%s" $dir (.cert | default "tls.crt") | quote }}
|
||||
key_file: {{ printf "%s/%s" $dir (.key | default "tls.key") | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
# tlsCA
|
||||
{{- with $.Values.tlsCA }}
|
||||
{{- if and .enabled (or .configMapName .secretName) }}
|
||||
{{- $dir := trimSuffix "/" .dir }}
|
||||
ca_file: {{ printf "%s/%s" $dir (.key | default "ca.crt") | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
12
opencloud/charts/nats/files/config/websocket.yaml
Normal file
12
opencloud/charts/nats/files/config/websocket.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
{{- with .Values.config.websocket }}
|
||||
port: {{ .port }}
|
||||
|
||||
{{- if .tls.enabled }}
|
||||
{{- with .tls }}
|
||||
tls:
|
||||
{{- include "nats.loadMergePatch" (merge (dict "file" "config/tls.yaml" "ctx" (merge (dict "tls" .) $)) .) | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
no_tls: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user