operator icon indicating copy to clipboard operation
operator copied to clipboard

vmalert doesn't take environment variables

Open afoninsky opened this issue 3 years ago • 1 comments

TLDR: both "vmagent" and "vmalert" have externalLabels field. vmagent replaces environment variables placed as placeholder, vmalert passes them as-is

k describe pod vmoperator-55d697dcf9-pfk55
   Image:         victoriametrics/operator:v0.28.5
k exec vmalert-infra-86bd448b6-kcr9r -c vmalert env | grep BKS_CLUSTER
BKS_CLUSTER=bplatform-eu-uk-prod-d
k exec vmalert-infra-86bd448b6-kcr9r -c vmalert ps
/vmalert-prod -datasource.url=http://monitor -enableTCP6=true -envflag.enable=true -evaluationInterval=1m -external.label=cluster=%{BKS_CLUSTER}

Screenshot 2022-10-04 at 14 48 02

afoninsky avatar Oct 04 '22 12:10 afoninsky

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAlert
metadata:
  name: infra
spec:
  extraEnvs:
    - name: BKS_CLUSTER
      valueFrom:
        configMapKeyRef:
          name: bookings.puppet
          key: cluster
  externalLabels:
    cluster: "%{BKS_CLUSTER}"

afoninsky avatar Oct 04 '22 13:10 afoninsky

Must be fixed at the v1.82.0 + vmalert release, feel free to re-open.

f41gh7 avatar Nov 14 '22 15:11 f41gh7