Skip to content

Commit 75e57c1

Browse files
jskoraJoe Skora
and
Joe Skora
authored
fix: add support for global connector envFromSecret, env, volumes, and volumeMounts. (#82)
Add support for global connector values for envFromSecret, env, volumes, and volumeMounts. Co-authored-by: Joe Skora <jskora@eitccorp.com>
1 parent 6011ab2 commit 75e57c1

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

charts/opencti/templates/connector/deployment.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $connectorsGlobal := .Values.connectorsGlobal }}
12
{{- range .Values.connectors }}
23
{{- $connectorName := .name }}
34

@@ -81,6 +82,7 @@ spec:
8182
env:
8283
# Variables from secrets have precedence
8384
{{- $envList := dict -}}
85+
# Connector specific env from secrets
8486
{{- if .envFromSecrets }}
8587
{{- range $key, $value := .envFromSecrets }}
8688
- name: {{ $key | upper }}
@@ -90,6 +92,19 @@ spec:
9092
key: {{ $value.key | default $key }}
9193
{{- $_ := set $envList $key true }}
9294
{{- end }}
95+
{{- end }}
96+
# Connectors global env from secrets
97+
{{- if $connectorsGlobal.envFromSecret }}
98+
{{- range $key, $value := $connectorsGlobal.envFromSecret }}
99+
{{- if not (hasKey $envList $key) }}
100+
- name: {{ $key | upper }}
101+
valueFrom:
102+
secretKeyRef:
103+
name: {{ $value.name }}
104+
key: {{ $value.key | default $key }}
105+
{{- $_ := set $envList $key true }}
106+
{{- end }}
107+
{{- end }}
93108
{{- end }}
94109
# Add variables in plain text if they were not already added from secrets
95110
{{- if .env }}
@@ -101,6 +116,16 @@ spec:
101116
{{- end }}
102117
{{- end }}
103118
{{- end }}
119+
# Connectors global env from secrets
120+
{{- if $connectorsGlobal.env }}
121+
{{- range $key, $value := $connectorsGlobal.env }}
122+
{{- if not (hasKey $envList $key) }}
123+
- name: {{ $key | upper }}
124+
value: {{ $value | quote }}
125+
{{- $_ := set $envList $key true }}
126+
{{- end }}
127+
{{- end }}
128+
{{- end }}
104129
# Special handling for OPENCTI_URL which is constructed from other values
105130
{{- if not (hasKey $envList "OPENCTI_URL") }}
106131
{{- if eq $.Values.env.APP__BASE_PATH "/" }}
@@ -123,7 +148,17 @@ spec:
123148
{{- end }}
124149
resources:
125150
{{- toYaml .resources | nindent 12 }}
151+
# Connectors global volumeMounts if defined
152+
{{- with $connectorsGlobal.volumeMounts }}
153+
volumeMounts:
154+
{{- toYaml . | nindent 12 }}
155+
{{- end }}
126156
terminationGracePeriodSeconds: {{ .terminationGracePeriodSeconds | default 30 }}
157+
{{- with $connectorsGlobal.volumes }}
158+
# Connectors global volumes if defined
159+
volumes:
160+
{{- toYaml . | nindent 8 }}
161+
{{- end }}
127162
{{- with .nodeSelector }}
128163
nodeSelector:
129164
{{- toYaml . | nindent 8 }}

charts/opencti/values.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,31 @@ topologySpreadConstraints: []
348348
# topologyKey: zone
349349
# whenUnsatisfiable: DoNotSchedule
350350

351-
# -- Connector Global environment
352-
connectorsGlobalEnv: {}
351+
# -- Connectors Globals
352+
connectorsGlobal:
353+
# -- Secrets from variables
354+
envFromSecrets: {}
355+
# MY_VARIABLE:
356+
# name: <release-name>-credentials
357+
# key: secret_key
358+
359+
# -- Additional environment variables on the output connector definition
360+
env: {}
353361
# MY_VARIABLE: my_value
354362

363+
# -- Additional volumes on the output connector Deployment definition
364+
volumes: []
365+
# - name: foo
366+
# secret:
367+
# secretName: mysecret
368+
# optional: false
369+
370+
# -- Additional volumeMounts on the output connector Deployment definition
371+
volumeMounts: []
372+
# - name: foo
373+
# mountPath: "/etc/foo"
374+
# readOnly: true
375+
355376
# -- Connectors
356377
# </br> Ref: https://github.com/OpenCTI-Platform/connectors/tree/master
357378
connectors: []

0 commit comments

Comments
 (0)