-
Notifications
You must be signed in to change notification settings - Fork 120
feat(vector): add emptyConfig and configSidecar parameter to enable dynamic vector configuration by label #523
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
base: develop
Are you sure you want to change the base?
Changes from all commits
79b41b7
7b21bb1
3e8bd0f
42410fe
3a78586
57a020b
0e45332
a920ee2
b6992cb
55a0b1d
607dfc6
19b0841
cde92eb
1eaace5
2d80d16
9f422cb
2ac77d9
8a4eb36
920b2ca
39fe39d
74d4287
5048cc0
5ed661e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,46 @@ initContainers: | |
| {{- tpl (toYaml .Values.initContainers) . | nindent 2 }} | ||
| {{- end }} | ||
| containers: | ||
| {{- if .Values.configSidecar.enabled }} | ||
| - name: config-sidecar | ||
| {{- $sidecarSha := .Values.configSidecar.image.sha | trimPrefix "sha256:" | default "" -}} | ||
| {{- if and .Values.configSidecar.image.tag $sidecarSha }} | ||
| image: "{{ .Values.configSidecar.image.registry }}/{{ .Values.configSidecar.image.repository }}:{{ .Values.configSidecar.image.tag }}@sha256:{{ $sidecarSha }}" | ||
| {{- else if and (not .Values.configSidecar.image.tag) $sidecarSha }} | ||
| image: "{{ .Values.configSidecar.image.registry }}/{{ .Values.configSidecar.image.repository }}@sha256:{{ $sidecarSha }}" | ||
| {{- else }} | ||
| image: "{{ .Values.configSidecar.image.registry }}/{{ .Values.configSidecar.image.repository }}:{{ .Values.configSidecar.image.tag | default "latest" }}" | ||
| {{- end }} | ||
| imagePullPolicy: {{ .Values.configSidecar.imagePullPolicy }} | ||
| env: | ||
| {{- if .Values.configSidecar.ignoreAlreadyProcessed }} | ||
| - name: IGNORE_ALREADY_PROCESSED | ||
| value: "true" | ||
| {{- end }} | ||
| - name: METHOD | ||
| value: {{ .Values.configSidecar.watchMethod }} | ||
| - name: LABEL | ||
| value: "{{ .Values.configSidecar.label }}" | ||
| {{- with .Values.configSidecar.labelValue }} | ||
| - name: LABEL_VALUE | ||
| value: {{ quote . }} | ||
| {{- end }} | ||
| {{- with .Values.configSidecar.logLevel }} | ||
| - name: LOG_LEVEL | ||
| value: "{{ . }}" | ||
| {{- end }} | ||
| - name: FOLDER | ||
| value: "/etc/vector/" | ||
| - name: RESOURCE | ||
| value: "configmap" | ||
| {{- if .Values.configSidecar.uniqueFilenames }} | ||
| - name: UNIQUE_FILENAMES | ||
| value: "true" | ||
| {{- end }} | ||
| volumeMounts: | ||
| - name: config | ||
| mountPath: "/etc/vector/" | ||
| {{- end }} | ||
| - name: vector | ||
| {{- with .Values.securityContext }} | ||
| securityContext: | ||
|
|
@@ -47,9 +87,26 @@ containers: | |
| command: | ||
| {{- toYaml . | nindent 6 }} | ||
| {{- end }} | ||
| {{- with .Values.args }} | ||
| {{- $args := list }} | ||
| {{- if .Values.args }} | ||
| {{- $args = .Values.args }} | ||
| {{- end }} | ||
| {{- if or $.Values.emptyConfig $.Values.configSidecar.enabled }} | ||
| {{- if not (has "--allow-empty-config" $args) }} | ||
| {{ $args = append $args "--allow-empty-config" }} | ||
|
jusch23 marked this conversation as resolved.
|
||
| {{- end }} | ||
| {{- if not (has "--config-dir" $args) }} | ||
| {{ $args = concat $args (list "--config-dir" "/etc/vector/") }} | ||
|
Comment on lines
+98
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If Useful? React with 👍 / 👎. |
||
| {{- end }} | ||
|
jusch23 marked this conversation as resolved.
|
||
| {{- end }} | ||
| {{- if $.Values.configSidecar.enabled }} | ||
|
jusch23 marked this conversation as resolved.
|
||
| {{- if not (has "--watch-config" $args) }} | ||
| {{ $args = append $args "--watch-config" }} | ||
|
jusch23 marked this conversation as resolved.
|
||
| {{- end }} | ||
| {{- end }} | ||
| {{- if $args }} | ||
| args: | ||
| {{- toYaml . | nindent 6 }} | ||
| {{- toYaml $args | nindent 6 }} | ||
| {{- end }} | ||
| env: | ||
| - name: VECTOR_LOG | ||
|
|
@@ -125,7 +182,7 @@ containers: | |
| {{- if .Values.readinessProbe }} | ||
| readinessProbe: | ||
| {{- toYaml .Values.readinessProbe | trim | nindent 6 }} | ||
| {{- else if and (not .Values.existingConfigMaps) (not .Values.customConfig) }} | ||
| {{- else if and (not .Values.existingConfigMaps) (not .Values.customConfig) (not .Values.emptyConfig) }} | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /health | ||
|
|
@@ -145,14 +202,18 @@ containers: | |
| {{- end }} | ||
| volumeMounts: | ||
| - name: data | ||
| {{- if .Values.existingConfigMaps }} | ||
| {{- if or .Values.emptyConfig .Values.configSidecar.enabled }} | ||
| mountPath: "/var/lib/vector/" | ||
|
jusch23 marked this conversation as resolved.
|
||
| {{- else if .Values.existingConfigMaps }} | ||
| mountPath: "{{ if .Values.dataDir }}{{ .Values.dataDir }}{{ else }}{{ fail "Specify `dataDir` if you're using `existingConfigMaps`" }}{{ end }}" | ||
|
jusch23 marked this conversation as resolved.
|
||
| {{- else }} | ||
| mountPath: "{{ .Values.customConfig.data_dir | default "/vector-data-dir" }}" | ||
| {{- end }} | ||
| - name: config | ||
| mountPath: "/etc/vector/" | ||
| {{- if not .Values.configSidecar.enabled }} | ||
| readOnly: true | ||
| {{- end }} | ||
| {{- if (eq .Values.role "Agent") }} | ||
| {{- with .Values.defaultVolumeMounts }} | ||
| {{- toYaml . | nindent 6 }} | ||
|
|
@@ -193,6 +254,9 @@ volumes: | |
| emptyDir: {} | ||
| {{- end }} | ||
| - name: config | ||
| {{- if or .Values.emptyConfig .Values.configSidecar.enabled }} | ||
| emptyDir: {} | ||
| {{- else }} | ||
| projected: | ||
| sources: | ||
| {{- if .Values.existingConfigMaps }} | ||
|
|
@@ -204,6 +268,7 @@ volumes: | |
| - configMap: | ||
| name: {{ template "vector.fullname" . }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if (eq .Values.role "Agent") }} | ||
| - name: data | ||
| {{- if .Values.persistence.hostPath.enabled }} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,29 @@ | ||
| {{- if not .Values.existingConfigMaps }} | ||
| {{- if not (or .Values.emptyConfig .Values.existingConfigMaps) }} | ||
|
jusch23 marked this conversation as resolved.
|
||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: {{ include "vector.fullname" . }} | ||
| namespace: {{ .Release.Namespace | quote }} | ||
| labels: | ||
| {{- include "vector.labels" . | nindent 4 }} | ||
| {{- if .Values.configSidecar.enabled}} | ||
| {{ .Values.configSidecar.label }}: {{ quote .Values.configSidecar.labelValue }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When two Vector releases in the same namespace both enable Useful? React with 👍 / 👎. |
||
| {{- end }} | ||
| data: | ||
| {{- if .Values.customConfig }} | ||
| {{- if and .Values.configSidecar.enabled .Values.customConfig.data_dir }} | ||
| {{- $msg := "When configSidecar is enabled, customConfig.data_dir must not be set. " }} | ||
| {{- $msg = printf "%sVector uses /var/lib/vector before loading custom config and does not allow overrides. " $msg }} | ||
| {{- $msg = printf "%sRemove customConfig.data_dir or disable configSidecar." $msg }} | ||
| {{- fail $msg }} | ||
| {{- end }} | ||
| vector.yaml: | | ||
| {{ tpl (toYaml .Values.customConfig) . | indent 4 }} | ||
| {{- else if or (eq .Values.role "Aggregator") (eq .Values.role "Stateless-Aggregator") }} | ||
| aggregator.yaml: | | ||
| {{- if not .Values.configSidecar.enabled}} | ||
| data_dir: /vector-data-dir | ||
| {{- end }} | ||
| api: | ||
| enabled: true | ||
| address: 0.0.0.0:8686 | ||
|
|
@@ -55,7 +66,9 @@ data: | |
| codec: json | ||
| {{- else if (eq .Values.role "Agent") }} | ||
| agent.yaml: | | ||
| {{- if not .Values.configSidecar.enabled}} | ||
| data_dir: /vector-data-dir | ||
| {{- end }} | ||
| api: | ||
| enabled: true | ||
| address: 0.0.0.0:8686 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ spec: | |
| trafficDistribution: {{ .Values.service.trafficDistribution }} | ||
| {{- end }} | ||
| ports: | ||
| {{- if or .Values.service.ports .Values.existingConfigMaps }} | ||
| {{- if .Values.service.ports }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| {{- toYaml .Values.service.ports | nindent 4 }} | ||
| {{- else if .Values.customConfig }} | ||
| {{- include "vector.ports" . | indent 4 }} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.