Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: new release with enterprise and image related functions #1495

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion charts/victoria-metrics-common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,9 @@

## Next release

- TODO
- Add enterprise to existing variant if enterprise enabled
- Added `vm.enterprise.disabled` template to check if enterprise license is disabled
- Use `service.servicePort` as a port source if flag is not set in `vm.url`

## 0.0.11

2 changes: 1 addition & 1 deletion charts/victoria-metrics-common/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.11
version: 0.0.12
sources:
- https://github.com/VictoriaMetrics/helm-charts
kubeVersion: ">=1.23.0-0"
8 changes: 6 additions & 2 deletions charts/victoria-metrics-common/templates/_enterprise.tpl
Original file line number Diff line number Diff line change
@@ -13,11 +13,15 @@
{{- ($Values.license).key | default (($Values.global).license).key | default "" -}}
{{- end -}}

{{- define "vm.enterprise.only" -}}
{{- define "vm.enterprise.disabled" -}}
{{- $licenseKey := (include "vm.license.key" .) -}}
{{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
{{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
{{- if and (empty $licenseKey) (and (empty $licenseSecretName) (empty $licenseSecretKey)) -}}
{{- and (empty $licenseKey) (and (empty $licenseSecretName) (empty $licenseSecretKey)) -}}
{{- end -}}

{{- define "vm.enterprise.only" -}}
{{- if eq (include "vm.enterprise.disabled" .) "true" }}
{{ fail `Pass valid license at .Values.license or .Values.global.license if you have an enterprise license for running this software.
See https://victoriametrics.com/legal/esa/ for details.
Documentation - https://docs.victoriametrics.com/enterprise
11 changes: 8 additions & 3 deletions charts/victoria-metrics-common/templates/_image.tpl
Original file line number Diff line number Diff line change
@@ -6,10 +6,15 @@ Victoria Metrics Image
{{- $Values := (.helm).Values | default .Values -}}
{{- $image := (tpl (printf "%s:%s" .app.image.repository (.app.image.tag | default $Chart.AppVersion)) .) -}}
{{- $license := $Values.license | default dict }}
{{- if and (or $license.key (dig "secret" "name" "" $license)) (empty .app.image.tag) -}}
{{- $_ := set .app.image "variant" "enterprise" -}}
{{- $variant := .app.image.variant }}
{{- if and (eq (include "vm.enterprise.disabled" .) "false") (empty .app.image.tag) -}}
{{- if $variant }}
{{- $variant = printf "enterprise-%s" $variant }}
{{- else }}
{{- $variant = "enterprise" }}
{{- end }}
{{- end -}}
{{- with .app.image.variant -}}
{{- with $variant -}}
{{- $image = (printf "%s-%s" $image .) -}}
{{- end -}}
{{- with .app.image.registry | default (($Values.global).image).registry | default "" -}}
2 changes: 1 addition & 1 deletion charts/victoria-metrics-common/templates/_service.tpl
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@
{{- end -}}
{{- $isSecure = (eq ($spec.extraArgs).tls "true") | default $isSecure -}}
{{- $port = (ternary 443 80 $isSecure) -}}
{{- $port = $spec.port | default $port -}}
{{- $port = $spec.port | default ($spec.service).servicePort | default $port -}}
{{- end }}
{{- $fqdn }}:{{ $port }}
{{- end -}}