Skip to content

Commit

Permalink
added ability to override default headless service
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewChubatiuk committed Feb 5, 2025
1 parent 3d7ca44 commit 9ef1861
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 29 deletions.
1 change: 1 addition & 0 deletions charts/victoria-logs-single/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Next release

- added ability to override default headless service .Values.server.service.clusterIP with empty value
- vector chart 0.37.x -> 0.40.x

## 0.8.14
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-logs-single/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ readOnlyRootFilesystem: true
<td>server.service.clusterIP</td>
<td>string</td>
<td><pre class="helm-vars-default-value language-yaml" lang="">
<code class="language-yaml">""
<code class="language-yaml">None
</code>
</pre>
</td>
Expand Down
7 changes: 3 additions & 4 deletions charts/victoria-logs-single/templates/server-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ spec:
{{- end }}
type: {{ $type }}
{{- $clusterIP := $service.clusterIP }}
{{- if and (not $clusterIP) (eq $type "ClusterIP") $app.statefulSet.enabled }}
{{- $clusterIP = "None" }}
{{- end }}
{{- with $clusterIP }}
{{- if eq $type "ClusterIP" }}
{{- with $service.clusterIP }}
clusterIP: {{ . }}
{{- end }}
{{- end }}
{{- with $service.externalIPs }}
externalIPs: {{ toYaml . | nindent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-logs-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ server:
# -- Service labels
labels: {}
# -- Service ClusterIP
clusterIP: ""
clusterIP: None
# -- Service external IPs. Details are [here]( https://kubernetes.io/docs/user-guide/services/#external-ips)
externalIPs: []
# -- Service load balancer IP
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-cluster/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Next release

- TODO
- added ability to override default headless service .Values.vmselect.service.clusterIP with empty value

## 0.17.4

Expand Down
13 changes: 12 additions & 1 deletion charts/victoria-metrics-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ Change the values according to the need of the environment in ``victoria-metrics
</pre>
</td>
<td><p>Image registry, that can be shared across multiple helm charts</p>
</td>
</tr>
<tr>
<td>global.image.vm.tag</td>
<td>string</td>
<td><pre class="helm-vars-default-value language-yaml" lang="">
<code class="language-yaml">""
</code>
</pre>
</td>
<td><p>Image tag for all vm charts</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -2632,7 +2643,7 @@ timeoutSeconds: 5
<td>vmselect.service.clusterIP</td>
<td>string</td>
<td><pre class="helm-vars-default-value language-yaml" lang="">
<code class="language-yaml">""
<code class="language-yaml">None
</code>
</pre>
</td>
Expand Down
8 changes: 3 additions & 5 deletions charts/victoria-metrics-cluster/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ spec:
{{- $type = "ClusterIP" }}
{{- end }}
type: {{ $type }}
{{- $clusterIP := $service.clusterIP }}
{{- if and (not $clusterIP) (eq $type "ClusterIP") ($app.statefulSet).enabled }}
{{- $clusterIP = "None" }}
{{- if eq $type "ClusterIP" }}
{{- with $service.clusterIP }}
clusterIP: {{. }}
{{- end }}
{{- with $clusterIP }}
clusterIP: {{ . }}
{{- end }}
{{- with $service.externalIPs }}
externalIPs: {{ toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ service should match snapshot:
name: RELEASE-NAME-victoria-metrics-cluster-vmselect
namespace: NAMESPACE
spec:
clusterIP: None
ports:
- name: http
port: 8481
Expand Down Expand Up @@ -170,6 +171,7 @@ service should match snapshot with fullnameOverride and extraLabels:
name: vmselect-node
namespace: NAMESPACE
spec:
clusterIP: None
ports:
- name: http
port: 8481
Expand Down
5 changes: 4 additions & 1 deletion charts/victoria-metrics-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ global:
image:
# -- Image registry, that can be shared across multiple helm charts
registry: ""
vm:
# -- Image tag for all vm charts
tag: ""
# -- Openshift security context compatibility configuration
compatibility:
openshift:
Expand Down Expand Up @@ -220,7 +223,7 @@ vmselect:
# -- Service labels
labels: {}
# -- Service ClusterIP
clusterIP: ""
clusterIP: None
# -- Service external IPs. Details are [here](https://kubernetes.io/docs/user-guide/services/#external-ips)
externalIPs: []
# -- Extra service ports
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Next release

- TODO
- Support `.Values.global.image.vm.tag` property to set tag for all VM images globally

## 0.0.38

Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
type: library
description: Victoria Metrics Common - contains shared templates for all Victoria Metrics helm charts
name: victoria-metrics-common
version: 0.0.38
version: 0.0.39
sources:
- https://github.com/VictoriaMetrics/helm-charts
kubeVersion: ">=1.23.0-0"
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-common/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


![Version](https://img.shields.io/badge/0.0.38-gray?logo=Helm&labelColor=gray&link=https%3A%2F%2Fdocs.victoriametrics.com%2Fhelm%2Fvictoria-metrics-common%2Fchangelog%2F%230038)
![Version](https://img.shields.io/badge/0.0.39-gray?logo=Helm&labelColor=gray&link=https%3A%2F%2Fdocs.victoriametrics.com%2Fhelm%2Fvictoria-metrics-common%2Fchangelog%2F%230039)
![ArtifactHub](https://img.shields.io/badge/ArtifactHub-informational?logoColor=white&color=417598&logo=artifacthub&link=https%3A%2F%2Fartifacthub.io%2Fpackages%2Fhelm%2Fvictoriametrics%2Fvictoria-metrics-common)
![License](https://img.shields.io/github/license/VictoriaMetrics/helm-charts?labelColor=green&label=&link=https%3A%2F%2Fgithub.com%2FVictoriaMetrics%2Fhelm-charts%2Fblob%2Fmaster%2FLICENSE)
![Slack](https://img.shields.io/badge/Join-4A154B?logo=slack&link=https%3A%2F%2Fslack.victoriametrics.com)
Expand Down
6 changes: 5 additions & 1 deletion charts/victoria-metrics-common/templates/_image.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Victoria Metrics Image
{{- if and (not $image.registry) (hasKey $image "registry") -}}
{{- $_ := unset $image "registry" -}}
{{- end -}}
{{- $image = mergeOverwrite (deepCopy (($Values.global).image | default dict)) ($image | default dict) -}}
{{- $globalImage := deepCopy ((($Values.global).image).vm | default dict) -}}
{{- with (($Values.global).image).registry }}
{{- $_ := set $globalImage "registry" . }}
{{- end }}
{{- $image = merge ($image | default dict) $globalImage -}}
{{- toYaml (dict "image" $image) -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/victoria-metrics-k8s-stack/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


![Version](https://img.shields.io/badge/0.35.6-gray?logo=Helm&labelColor=gray&link=https%3A%2F%2Fdocs.victoriametrics.com%2Fhelm%2Fvictoria-metrics-k8s-stack%2Fchangelog%2F%230356)
![Version](https://img.shields.io/badge/0.35.7-gray?logo=Helm&labelColor=gray&link=https%3A%2F%2Fdocs.victoriametrics.com%2Fhelm%2Fvictoria-metrics-k8s-stack%2Fchangelog%2F%230357)
![ArtifactHub](https://img.shields.io/badge/ArtifactHub-informational?logoColor=white&color=417598&logo=artifacthub&link=https%3A%2F%2Fartifacthub.io%2Fpackages%2Fhelm%2Fvictoriametrics%2Fvictoria-metrics-k8s-stack)
![License](https://img.shields.io/github/license/VictoriaMetrics/helm-charts?labelColor=green&label=&link=https%3A%2F%2Fgithub.com%2FVictoriaMetrics%2Fhelm-charts%2Fblob%2Fmaster%2FLICENSE)
![Slack](https://img.shields.io/badge/Join-4A154B?logo=slack&link=https%3A%2F%2Fslack.victoriametrics.com)
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-single/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Next release

- TODO
- added ability to override default headless service .Values.server.service.clusterIP with empty value

## 0.13.8

Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-single/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ scrape_configs:
<td>server.service.clusterIP</td>
<td>string</td>
<td><pre class="helm-vars-default-value language-yaml" lang="">
<code class="language-yaml">""
<code class="language-yaml">None
</code>
</pre>
</td>
Expand Down
8 changes: 3 additions & 5 deletions charts/victoria-metrics-single/templates/server-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ spec:
{{- $type = "ClusterIP" }}
{{- end }}
type: {{ $type }}
{{- $clusterIP := $service.clusterIP }}
{{- if and (not $clusterIP) (eq $type "ClusterIP") $app.statefulSet.enabled }}
{{- $clusterIP = "None" }}
{{- end }}
{{- with $clusterIP }}
{{- if eq $type "ClusterIP" }}
{{- with $service.clusterIP }}
clusterIP: {{ . }}
{{- end }}
{{- end }}
{{- with $service.externalIPs }}
externalIPs: {{ toYaml . | nindent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/victoria-metrics-single/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ server:
# -- Service labels
labels: {}
# -- Service ClusterIP
clusterIP: ""
clusterIP: "None"
# -- Service external IPs. Details are [here](https://kubernetes.io/docs/user-guide/services/#external-ips)
externalIPs: []
# -- Service load balancer IP
Expand Down
7 changes: 5 additions & 2 deletions test-charts/victoria-metrics-common/tests/image_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,16 @@ tests:
app:
image:
repository: vmagent
tag: ""
global:
image:
registry: localhost:8080
vm:
tag: 1.1.1
asserts:
- equal:
path: vm.image.name
value: localhost:8080/vmagent:0.0.0
value: localhost:8080/vmagent:1.1.1
- equal:
path: vm.image.tag
value: 0.0.0
value: 1.1.1

0 comments on commit 9ef1861

Please sign in to comment.