Skip to content

Commit

Permalink
k8s-stack: generate vm components tag from app version by default (#1553
Browse files Browse the repository at this point in the history
)

* k8s-stack: generate vm components tag from app version by default

* fixed templates

* minor fix
  • Loading branch information
AndrewChubatiuk authored Oct 4, 2024
1 parent 9474517 commit bc8f462
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 85 deletions.
44 changes: 0 additions & 44 deletions charts/victoria-metrics-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,50 +287,6 @@ name: ""
</pre>
</td>
<td><p>Print information after deployment</p>
</td>
</tr>
<tr>
<td>rbac.annotations</td>
<td>object</td>
<td><pre class="helm-vars-default-value" language-yaml" lang="plaintext">
<code class="language-yaml">{}
</code>
</pre>
</td>
<td><p>Role/RoleBinding annotations</p>
</td>
</tr>
<tr>
<td>rbac.create</td>
<td>bool</td>
<td><pre class="helm-vars-default-value" language-yaml" lang="">
<code class="language-yaml">true
</code>
</pre>
</td>
<td><p>Enables Role/RoleBinding creation</p>
</td>
</tr>
<tr>
<td>rbac.extraLabels</td>
<td>object</td>
<td><pre class="helm-vars-default-value" language-yaml" lang="plaintext">
<code class="language-yaml">{}
</code>
</pre>
</td>
<td><p>Role/RoleBinding labels</p>
</td>
</tr>
<tr>
<td>rbac.namespaced</td>
<td>bool</td>
<td><pre class="helm-vars-default-value" language-yaml" lang="">
<code class="language-yaml">false
</code>
</pre>
</td>
<td><p>If true and <code>rbac.enabled</code>, will deploy a Role/RoleBinding instead of a ClusterRole/ClusterRoleBinding</p>
</td>
</tr>
<tr>
Expand Down
13 changes: 0 additions & 13 deletions charts/victoria-metrics-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@ printNotes: true
# use SRV discovery for storageNode and selectNode flags for enterprise version
autoDiscovery: false

rbac:
# -- Enables Role/RoleBinding creation
create: true

# -- If true and `rbac.enabled`, will deploy a Role/RoleBinding instead of a ClusterRole/ClusterRoleBinding
namespaced: false

# -- Role/RoleBinding labels
extraLabels: {}

# -- Role/RoleBinding annotations
annotations: {}

serviceAccount:
# -- Specifies whether a service account should be created
create: true
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-k8s-stack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Next release

- TODO
- Generate VM components tag version from chart app name by default

## 0.27.0

Expand Down
12 changes: 0 additions & 12 deletions charts/victoria-metrics-k8s-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2164,8 +2164,6 @@ tls: []
extraArgs:
promscrape.dropOriginalLabels: "true"
promscrape.streamParse: "true"
image:
tag: v1.104.0
port: "8429"
scrapeInterval: 20s
selectAllByDefault: true
Expand Down Expand Up @@ -2257,8 +2255,6 @@ tls: []
externalLabels: {}
extraArgs:
http.pathPrefix: /
image:
tag: v1.104.0
port: "8080"
selectAllByDefault: true
</code>
Expand Down Expand Up @@ -2639,16 +2635,12 @@ port: "8427"
retentionPeriod: "1"
vminsert:
extraArgs: {}
image:
tag: v1.104.0-cluster
port: "8480"
replicaCount: 2
resources: {}
vmselect:
cacheMountPath: /select-cache
extraArgs: {}
image:
tag: v1.104.0-cluster
port: "8481"
replicaCount: 2
resources: {}
Expand All @@ -2659,8 +2651,6 @@ vmselect:
requests:
storage: 2Gi
vmstorage:
image:
tag: v1.104.0-cluster
replicaCount: 2
resources: {}
storage:
Expand Down Expand Up @@ -2813,8 +2803,6 @@ vmstorage:
<td>object</td>
<td><pre class="helm-vars-default-value" language-yaml" lang="plaintext">
<code class="language-yaml">extraArgs: {}
image:
tag: v1.104.0
port: "8429"
replicaCount: 1
retentionPeriod: "1"
Expand Down
14 changes: 11 additions & 3 deletions charts/victoria-metrics-k8s-stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,15 @@ If release name contains chart name it will be used as a full name.
{{- /* VMAlert spec */ -}}
{{- define "vm.alert.spec" -}}
{{- $Values := (.helm).Values | default .Values }}
{{- $Chart := (.helm).Chart | default .Chart }}
{{- $extraArgs := dict "remoteWrite.disablePathAppend" "true" -}}
{{- if $Values.vmalert.templateFiles -}}
{{- $ruleTmpl := (printf "/etc/vm/configs/%s-vmalert-extra-tpl/*.tmpl" (include "victoria-metrics-k8s-stack.fullname" .)) -}}
{{- $_ := set $extraArgs "rule.templates" $ruleTmpl -}}
{{- end -}}
{{- $vmAlertRemotes := (include "vm.alert.remotes" . | fromYaml) -}}
{{- $vmAlertTemplates := (include "vm.alert.templates" . | fromYaml) -}}
{{- $spec := dict "extraArgs" $extraArgs -}}
{{- $spec := dict "extraArgs" $extraArgs "image" (dict "tag" $Chart.AppVersion) -}}
{{- with (include "vm.license.global" .) -}}
{{- $_ := set $spec "license" (fromYaml .) -}}
{{- end -}}
Expand Down Expand Up @@ -276,10 +277,12 @@ If release name contains chart name it will be used as a full name.
{{- /* VMAgent spec */ -}}
{{- define "vm.agent.spec" -}}
{{- $Values := (.helm).Values | default .Values }}
{{- $Chart := (.helm).Chart | default .Chart }}
{{- $spec := (include "vm.agent.remote.write" . | fromYaml) -}}
{{- with (include "vm.license.global" .) -}}
{{- $_ := set $spec "license" (fromYaml .) -}}
{{- end -}}
{{- $_ := set $spec "image" (dict "tag" $Chart.AppVersion) -}}
{{- tpl (deepCopy $Values.vmagent.spec | mergeOverwrite $spec | toYaml) . -}}
{{- end }}

Expand Down Expand Up @@ -344,12 +347,13 @@ If release name contains chart name it will be used as a full name.
{{- /* Single spec */ -}}
{{- define "vm.single.spec" -}}
{{- $Values := (.helm).Values | default .Values }}
{{- $Chart := (.helm).Chart | default .Chart }}
{{- $extraArgs := default dict -}}
{{- if $Values.vmalert.enabled }}
{{- $ctx := dict "helm" . "appKey" "vmalert" -}}
{{- $_ := set $extraArgs "vmalert.proxyURL" (include "vm.url" $ctx) -}}
{{- end -}}
{{- $spec := dict "extraArgs" $extraArgs -}}
{{- $spec := dict "extraArgs" $extraArgs "image" (dict "tag" $Chart.AppVersion) -}}
{{- with (include "vm.license.global" .) -}}
{{- $_ := set $spec "license" (fromYaml .) -}}
{{- end -}}
Expand All @@ -359,18 +363,22 @@ If release name contains chart name it will be used as a full name.
{{- /* Cluster spec */ -}}
{{- define "vm.select.spec" -}}
{{- $Values := (.helm).Values | default .Values }}
{{- $Chart := (.helm).Chart | default .Chart }}
{{- $extraArgs := default dict -}}
{{- if $Values.vmalert.enabled -}}
{{- $ctx := dict "helm" . "appKey" "vmalert" -}}
{{- $_ := set $extraArgs "vmalert.proxyURL" (include "vm.url" $ctx) -}}
{{- end -}}
{{- $spec := dict "extraArgs" $extraArgs -}}
{{- $spec := dict "extraArgs" $extraArgs "image" (dict "tag" (printf "%s-cluster" $Chart.AppVersion)) -}}
{{- toYaml $spec -}}
{{- end -}}

{{- define "vm.cluster.spec" -}}
{{- $Values := (.helm).Values | default .Values }}
{{- $Chart := (.helm).Chart | default .Chart }}
{{- $spec := (include "vm.select.spec" . | fromYaml) -}}
{{- $_ := set $spec "vminsert" (dict "image" (dict "tag" (printf "%s-cluster" $Chart.AppVersion))) -}}
{{- $_ := set $spec "vmstorage" (dict "image" (dict "tag" (printf "%s-cluster" $Chart.AppVersion))) -}}
{{- $clusterSpec := (deepCopy $Values.vmcluster.spec) -}}
{{- with (include "vm.license.global" .) -}}
{{- $_ := set $clusterSpec "license" (fromYaml .) -}}
Expand Down
12 changes: 0 additions & 12 deletions charts/victoria-metrics-k8s-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ vmsingle:
# -- Full spec for VMSingle CRD. Allowed values describe [here](https://docs.victoriametrics.com/operator/api#vmsinglespec)
spec:
port: "8429"
image:
tag: v1.104.0
# -- Data retention period. Possible units character: h(ours), d(ays), w(eeks), y(ears), if no unit character specified - month. The minimum retention period is 24h. See these [docs](https://docs.victoriametrics.com/single-server-victoriametrics/#retention)
retentionPeriod: "1"
replicaCount: 1
Expand Down Expand Up @@ -320,8 +318,6 @@ vmcluster:
retentionPeriod: "1"
replicationFactor: 2
vmstorage:
image:
tag: v1.104.0-cluster
replicaCount: 2
storageDataPath: "/vm-data"
storage:
Expand All @@ -337,8 +333,6 @@ vmcluster:
# memory: 1500Mi
vmselect:
port: "8481"
image:
tag: v1.104.0-cluster
replicaCount: 2
cacheMountPath: "/select-cache"
extraArgs: {}
Expand All @@ -358,8 +352,6 @@ vmcluster:
# memory: "500Mi"
vminsert:
port: "8480"
image:
tag: v1.104.0-cluster
replicaCount: 2
extraArgs: {}
resources:
Expand Down Expand Up @@ -667,8 +659,6 @@ vmalert:
spec:
port: "8080"
selectAllByDefault: true
image:
tag: v1.104.0
evaluationInterval: 15s
extraArgs:
http.pathPrefix: "/"
Expand Down Expand Up @@ -748,8 +738,6 @@ vmagent:
spec:
port: "8429"
selectAllByDefault: true
image:
tag: v1.104.0
scrapeInterval: 20s
externalLabels: {}
# For multi-cluster setups it is useful to use "cluster" label to identify the metrics source.
Expand Down

0 comments on commit bc8f462

Please sign in to comment.