thanos-io / kube-thanos

Kubernetes specific configuration for deploying Thanos.
Apache License 2.0
520 stars 177 forks source link

query: Add support for ArgoCD: Define replace action in servicemonitor #296

Closed francescsanjuanmrf closed 1 year ago

francescsanjuanmrf commented 1 year ago

The relabelings block of the serviceMonitor configuration for the query component does not include the action field.

The default value for action is replace.

Having this field undefined makes ArgoCD always unsynced.

The definitions in this repo code lack the action field, but when the object is created in Kubernetes, the field is written in the Kubernetes object with the default value (replace). Then, ArgoCD compares with the code in the repo and tries to sync again (removing the action field). This causes an infinite loop of adding and removing the action field.

Setting the action field to the default value (replace) in the code solves this problem and does not change the behavior of serviceMonitor.

Changes

Verification

I've tested it by modifying the chart and testing locally.

francescsanjuanmrf commented 1 year ago

Added modified YAMLs

francescsanjuanmrf commented 1 year ago

I've just modified all the ServiceMonitors, but I haven't all of them deployed, and I haven't tested them. Initially, I only added the action field in one because I've just tested one.

francescsanjuanmrf commented 1 year ago

Sure! I've just added the missing template.

Thanks for your help!