added repo
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
{{- define "vmagent.args" -}}
|
||||
{{- $args := default dict -}}
|
||||
{{- $Values := (.helm).Values | default .Values -}}
|
||||
{{- if empty $Values.remoteWrite -}}
|
||||
{{- fail "Please define at least one remoteWrite" -}}
|
||||
{{- end -}}
|
||||
{{- $_ := set $args "promscrape.config" "/config/scrape/scrape.yml" -}}
|
||||
{{- $_ := set $args "remoteWrite.tmpDataPath" "/tmpData" -}}
|
||||
{{- range $i, $rw := $Values.remoteWrite -}}
|
||||
{{- if not $rw.url -}}
|
||||
{{- fail (printf "`url` is not set for `remoteWrite` idx %d" $i) -}}
|
||||
{{- end -}}
|
||||
{{- range $rwKey, $rwValue := $rw -}}
|
||||
{{- $key := printf "remoteWrite.%s" $rwKey -}}
|
||||
{{- $param := index $args $key | default list -}}
|
||||
{{- range until (int (sub $i (len $param))) }}
|
||||
{{- $param = append $param "" }}
|
||||
{{- end }}
|
||||
{{- if or (kindIs "slice" $rwValue) (kindIs "map" $rwValue) -}}
|
||||
{{- $param = append $param (printf "/config/rw/%d-%s.yaml" $i $rwKey) }}
|
||||
{{- else -}}
|
||||
{{- $param = append $param $rwValue }}
|
||||
{{- end -}}
|
||||
{{- $_ := set $args $key $param -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $args = mergeOverwrite $args (fromYaml (include "vm.license.flag" .)) -}}
|
||||
{{- $args = mergeOverwrite $args $Values.extraArgs -}}
|
||||
{{- if and (eq $Values.mode "statefulSet") $Values.statefulSet.clusterMode }}
|
||||
{{- $_ := set $args "promscrape.cluster.membersCount" $Values.replicaCount -}}
|
||||
{{- $_ := set $args "promscrape.cluster.replicationFactor" $Values.statefulSet.replicationFactor -}}
|
||||
{{- $_ := set $args "promscrape.cluster.memberNum" "$(POD_NAME)" -}}
|
||||
{{- end -}}
|
||||
{{- toYaml (fromYaml (include "vm.args" $args)).args -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "vmagent.rw.config" -}}
|
||||
{{- $Values := (.helm).Values | default .Values -}}
|
||||
{{- $rwcm := default dict }}
|
||||
{{- range $i, $rw := $Values.remoteWrite }}
|
||||
{{- range $rwKey, $rwValue := $rw }}
|
||||
{{- if or (kindIs "slice" $rwValue) (kindIs "map" $rwValue) }}
|
||||
{{- $rwContent := toYaml $rwValue }}
|
||||
{{- if $Values.config.useTpl }}
|
||||
{{- $rwContent = tpl $rwContent $ | trim }}
|
||||
{{- end }}
|
||||
{{- $_ := set $rwcm (printf "%d-%s.yaml" $i $rwKey) $rwContent }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- toYaml $rwcm -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "vmagent.scrape.config.name" -}}
|
||||
{{- $Values := (.helm).Values | default .Values -}}
|
||||
{{- $fullname := include "vm.plain.fullname" . -}}
|
||||
{{- $Values.configMap | default (printf "%s-config" $fullname) -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user