You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All properties are passed through to the NATS account configuration. On CPCs, `jetstream` is always forced to `false` and a JetStream domain mapping to CSC is automatically added.
370
+
Extra account names must use letters and numbers only, start with a letter, and
371
+
must not use built-in account names (`SYS`, `AUTH`, `AUTHX`, `CSC`, `CPC`) or
372
+
start with `cpc` in any case.
373
+
All properties are passed through to the NATS account configuration except
374
+
`enabled`. On CPCs, `jetstream` is always forced to `false` and a JetStream
375
+
domain mapping to CSC is automatically added. Every enabled extra account gets a
376
+
CPC-to-CSC leaf connection by default. Provide the CPC seed env
377
+
`LEAF_{ACCOUNT}_USER_SEED`from `nats-leaf-{account}-csc` and the CSC pubkey env
{{- fail (printf "eventBus.cpcIds includes %q, but CPC IDs must use lower-case letters and numbers only so generated secret names and env vars are valid." $cpcId) -}}
21
+
{{- end -}}
22
+
{{- if hasKey $cpcIds $cpcId -}}
23
+
{{- fail (printf "eventBus.cpcIds includes duplicate ID %q." $cpcId) -}}
24
+
{{- end -}}
25
+
{{- $_ := set $cpcIds $cpcId true -}}
26
+
{{- end -}}
27
+
{{- range $accountName, $config := .Values.eventBus.extraAccounts }}
28
+
{{- $enabled := true -}}
29
+
{{- if hasKey $config "enabled" -}}
30
+
{{- $enabled = $config.enabled -}}
31
+
{{- end -}}
32
+
{{- if $enabled -}}
33
+
{{- if not (regexMatch "^[A-Za-z][A-Za-z0-9]*$" $accountName) -}}
34
+
{{- fail (printf "eventBus.extraAccounts.%s is not a valid NATS account name. Use letters and numbers only, starting with a letter." $accountName) -}}
35
+
{{- end -}}
36
+
{{- if hasKey $reservedAccountNames (upper $accountName) -}}
37
+
{{- fail (printf "eventBus.extraAccounts.%s conflicts with a built-in NATS account name." $accountName) -}}
38
+
{{- end -}}
39
+
{{- if regexMatch "^CPC" (upper $accountName) -}}
40
+
{{- fail (printf "eventBus.extraAccounts.%s is not allowed because extra account names must not start with cpc." $accountName) -}}
41
+
{{- end -}}
42
+
{{- $envToken := include "nats-event-bus.extraAccountEnvName" $accountName -}}
43
+
{{- $secretToken := include "nats-event-bus.extraAccountSecretName" $accountName -}}
44
+
{{- if eq $envToken "" -}}
45
+
{{- fail (printf "eventBus.extraAccounts includes %q, but its env token is empty after normalization." $accountName) -}}
46
+
{{- end -}}
47
+
{{- if eq $secretToken "" -}}
48
+
{{- fail (printf "eventBus.extraAccounts includes %q, but its secret-name token is empty after normalization." $accountName) -}}
49
+
{{- end -}}
50
+
{{- if hasKey $extraAccountEnvNames $envToken -}}
51
+
{{- fail (printf "eventBus.extraAccounts.%s normalizes to env token %s, which is already used by eventBus.extraAccounts.%s." $accountName $envToken (get $extraAccountEnvNames $envToken)) -}}
52
+
{{- end -}}
53
+
{{- if hasKey $extraAccountSecretNames $secretToken -}}
54
+
{{- fail (printf "eventBus.extraAccounts.%s normalizes to secret token %s, which is already used by eventBus.extraAccounts.%s." $accountName $secretToken (get $extraAccountSecretNames $secretToken)) -}}
55
+
{{- end -}}
56
+
{{- $_ := set $extraAccountEnvNames $envToken $accountName -}}
57
+
{{- $_ := set $extraAccountSecretNames $secretToken $accountName -}}
58
+
{{- end -}}
59
+
{{- end -}}
10
60
{{- if and (eq .Values.eventBus.clusterType "csc") (gt (len .Values.eventBus.cpcIds) 0) -}}
{{- fail (printf "eventBus.cpcIds includes %q, but auth-callout.extraEnvs.%s is missing. Add a secretKeyRef to nats-leaf-cpc-%s key pubkey so CSC can authorize the CPC leaf connection." $cpcId $envName $cpcId) -}}
{{- fail (printf "eventBus.extraAccounts.%s is enabled on a CPC cluster, but nats.container.env.%s is missing. Add a secretKeyRef to nats-leaf-%s-csc key seed so the CPC can connect this account leaf to CSC." $accountName $seedEnvName $accountSecretName) -}}
{{- fail (printf "eventBus.extraAccounts.%s is enabled on CSC, but auth-callout.extraEnvs.%s is missing. Add a secretKeyRef to nats-leaf-%s-cpc-%s key pubkey so CSC can authorize this extra-account CPC leaf." $accountName $envName $accountSecretName $cpcId) -}}
0 commit comments