operator icon indicating copy to clipboard operation
operator copied to clipboard

VMAlertSpec needs externalLabels key for multiple external labels

Open brokenjacobs opened this issue 2 years ago • 2 comments

Currently using extraArgs you can define only one external label:

spec:
  extraArgs:
    external.label: mylabel=myvalue

But vmalert supports multiple -external.label arguments. And they cannot be passed in this way because it would create a duplicate field in the extraArgs map. I would like this to mirror what vmagent does like this:

spec:
  externalLabels:
    mylabel: myvalue
    mylabel2: myvalue2

I haven't been able to find a workaround for this using the operator.

brokenjacobs avatar Oct 04 '22 14:10 brokenjacobs

Hello @brokenjacobs As far as I can see you are looking for VMAlertSpec (but not VMAlertManager as it doesn't support external.label flag). If this is correct in order to apply multiple labels you can use the following syntax:

spec:
  extraArgs:
    external.label: "mylabel=myvalue,mylabel2=myvalue2"

You can find description for VMAlert cli flags here: https://docs.victoriametrics.com/vmalert.html#flags

  -external.label array
     Optional label in the form 'Name=value' to add to all generated recording rules and alerts. Pass multiple -label flags in order to add multiple label sets.
     Supports an array of values separated by comma or specified via multiple flags.

zekker6 avatar Oct 06 '22 07:10 zekker6

Correct vmalert not vmalertmanagerspec, I updated my topic to reflect that. I'll give a try as suggested but wow is that text confusing. I missed the part about supporting comma separated values twice.

brokenjacobs avatar Oct 06 '22 13:10 brokenjacobs