rfcs/2021-06-29-7709-helm-update-vector-config-pattern.md
This RFC proposes an update for our current configuration to fully embrace our support of YAML configuration files.
This RFC will cover the component configuration keys and the default sinks and sources defined under unique keys in
our Helm charts today. We provide defaults configurations for the following components:
vector-agent:
kubernetes_logs sourceinternal_metrics sourcehost_metrics sourcevector sinkprometheus_exporter sinkvector-aggregator:
vector sourceinternal_metrics sourceprometheus_exporter sinkOur current Helm chart for configuring Vector in Kubernetes provides shortcuts for configuring common
sources and sinks, while also allowing users to specify their configuration in the more traditional "direct"
fashion, similar to configuring Vector when running on a virtual machine. These two approaches being
used simultaneously can lead to issues, and general confusion, about what the correct way to configure Vector is.
Our default configurations are provided directly in the ConfigMap raw, or containing minimal helper templates if needed.
Users can opt-out of our configuration by providing their configuration file under a customConfig key which disables
our default configurations for Vector and it's related Kubernetes resources.
The following example for the vector-agent chart ignores backward compatibility with existing keys for simplicity. The ConfigMap template would be replaced with the following:
{{- if (empty .Values.existingConfigMap) -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "libvector.configMapName" . }}
labels:
{{- include "libvector.labels" . | nindent 4 }}
data:
{{- if .Values.customConfig }}
vector.yaml: |
{{ tpl (toYaml .Values.customConfig) . | indent 4 }}
{{- else }}
vector.yaml: |
# Docs: https://vector.dev/docs/
data_dir: "/vector-data-dir"
log_schema:
host_key: host
message_key: message
source_type_key: source_type
timestamp_key: timestamp
sources:
host_metrics:
type: host_metrics
filesystem:
devices:
excludes: ["binfmt_misc"]
filesystems:
excludes: ["binfmt_misc"]
mountpoints:
excludes: ["*/proc/sys/fs/binfmt_misc"]
internal_metrics:
type: internal_metrics
kubernetes_logs:
type: kubernetes_logs
sinks:
prometheus_sink:
type: prometheus_exporter
inputs: ["host_metrics", "internal_metrics"]
address: 0.0.0.0:9090
{{- end }}
{{- end }}
To make it easier for users to make minor changes to our default configuration we could provide a copy of the default configuration (commented out). Users would uncomment the block and be able to make any required changes without having to rewrite the entire configuration.
# Specify custom contents for the Vector config
## ref: https://vector.dev/docs/reference/configuration/
## Note a complete and valid configuration is required
customConfig: {}
# data_dir: "/vector-data-dir"
# log_schema:
# host_key: host
# message_key: message
# source_type_key: source_type
# timestamp_key: timestamp
# sources:
# host_metrics:
# type: host_metrics
# filesystem:
# devices:
# excludes: ["binfmt_misc"]
# filesystems:
# excludes: ["binfmt_misc"]
# mountpoints:
# excludes: ["*/proc/sys/fs/binfmt_misc"]
# internal_metrics:
# type: internal_metrics
# kubernetes_logs:
# type: kubernetes_logs
# sinks:
# prometheus_sink:
# type: prometheus_exporter
# inputs: ["host_metrics", "internal_metrics"]
# address: 0.0.0.0:9090
We will be able to support the existing deprecated fields until the 1.0 release by not rendering the new YAML based
configuration if any deprecated config key is used or enabled, and if a combination of new and old keys are used we
can use a fail function to terminate chart rendering early.
The only page we currently have with documentation around Helm is on the Kubernetes platform installation page, which today does not mention how to configure any of the default components.
if/else statement and a one-liner to template the provided configuration (if needed)customConfig through a tpl function users can more easily generate parts of their configuration from other values (ports, volumes, etc)customConfigvalues.yamlsources, transforms, and sinks keysnull value, example for the vector-agent chart:sources:
kubernetes_logs: null
internal_metrics: null
host_metrics: null
sinks:
vector_sink: null
prometheus_sink: null
values.yamlcustomConfig patternsources, transforms, sinks, and "unique" default keys in future release (1.0 unless maintenance burden is costly)