Skip to content
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

Added values file option for -remoteWrite.relabelConfig & -remoteWrite.urlRelabelConfig #942

Closed
sushovan23 opened this issue Mar 25, 2024 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@sushovan23
Copy link

I went through the current helm chart for vmagent and I see that there is no option to pass -remoteWrite.relabelConfig or -remoteWrite.urlRelabelConfig in helm values file.

This issue is to add that option to official helm chart:
I think it would be similar to how remoteWrite.url is read today ->
https://github.com/VictoriaMetrics/helm-charts/blob/master/charts/victoria-metrics-agent/templates/deployment.yaml#L63-L64
and create new yaml file for it ->
#930 (comment)

@Haleygo
Copy link
Contributor

Haleygo commented Mar 26, 2024

Hello!
Like #930 (comment), you can add them using .Values,extraArgs

extraArgs:
  envflag.enable: "true"
  envflag.prefix: VM_
  loggerFormat: json
  
  remoteWrite.relabelConfig: test.yml
  ## remoteWrite.urlRelabelConfig: relabelDev.yml

Unlike -remoteWrite.url , -remoteWrite.relabelConfig and -remoteWrite.urlRelabelConfig point to files with relabeling configs, those files should be provided by extra configmaps or secrets.
It's better not to expose the raw config in chart's values file, since the config is normally big and not about chart itself, maintaining an extra config file would be more clear.

@Haleygo Haleygo added the question Further information is requested label Mar 26, 2024
@Haleygo Haleygo self-assigned this Mar 26, 2024
@sushovan23
Copy link
Author

I'm using helm for entire deployment, are you suggesting to maintain this file separately? if it was for single setup I would have done but we provision many vmagents per client and manage everything currently using helm.
remotewrite.relabelconfig will be much smaller than scrapeconfigs which are already supported in helm values.

@Haleygo
Copy link
Contributor

Haleygo commented Apr 8, 2024

Personally, I prefer to keep the values.yaml shorter and only expose important configs there, gives higher readability.
So I'd still recommend to maintain separated file for scrapeconfigs or remotewrite.relabelconfig using configmap or secret and mount them to vmagent, as they're separated config file themselves.
If you don't want to maintain the config file outside the chart release, you can create a second values.yaml using .Values. extraObjects like

## relabelconfig.yaml
extraArgs:
  remoteWrite.relabelConfig: /relabelconfig/relabelconfig.yaml

# Extra Volumes for the pod
extraVolumes:
  - name: relabelconfig
    configMap:
      name: relabelconfig

# Extra Volume Mounts for the container
extraVolumeMounts:
  - name: relabelconfig
    mountPath: /relabelconfig

# add this part to the original values file or create a separate one for multiple release to use
# Add extra specs dynamically to this chart
extraObjects:
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: relabelconfig
    data:
      relabelconfig.yaml: |
        - source_labels: [__address__]
          target_label: instance
          regex: (.*)
          replacement: $1
        - xxx

And install with helm install xxx victoria-metrics-vmagent -f relabelconfig.yaml.

@Haleygo
Copy link
Contributor

Haleygo commented Jun 26, 2024

Close as answered, feel free to re-open if there is further question.

@Haleygo Haleygo closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants