_enterprise.tpl 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {{- define "vm.license.secret.key" -}}
  2. {{- $Values := (.helm).Values | default .Values -}}
  3. {{- (($Values.license).secret).key | default ((($Values.global).license).secret).key | default "" -}}
  4. {{- end -}}
  5. {{- define "vm.license.secret.name" -}}
  6. {{- $Values := (.helm).Values | default .Values -}}
  7. {{- (($Values.license).secret).name | default ((($Values.global).license).secret).name | default "" -}}
  8. {{- end -}}
  9. {{- define "vm.license.key" -}}
  10. {{- $Values := (.helm).Values | default .Values }}
  11. {{- ($Values.license).key | default (($Values.global).license).key | default "" -}}
  12. {{- end -}}
  13. {{- define "vm.enterprise.disabled" -}}
  14. {{- $licenseKey := (include "vm.license.key" .) -}}
  15. {{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
  16. {{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
  17. {{- and (empty $licenseKey) (and (empty $licenseSecretName) (empty $licenseSecretKey)) -}}
  18. {{- end -}}
  19. {{- define "vm.enterprise.only" -}}
  20. {{- if eq (include "vm.enterprise.disabled" .) "true" }}
  21. {{ fail `Pass valid license at .Values.license or .Values.global.license if you have an enterprise license for running this software.
  22. See https://victoriametrics.com/legal/esa/ for details.
  23. Documentation - https://docs.victoriametrics.com/enterprise
  24. for more information, visit https://victoriametrics.com/products/enterprise/
  25. To request a trial license, go to https://victoriametrics.com/products/enterprise/trial/` }}
  26. {{- end -}}
  27. {{- end -}}
  28. {{/*
  29. Return license volume mount
  30. */}}
  31. {{- define "vm.license.volume" -}}
  32. {{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
  33. {{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
  34. {{- if and $licenseSecretName $licenseSecretKey -}}
  35. - name: license-key
  36. secret:
  37. secretName: {{ $licenseSecretName }}
  38. {{- end -}}
  39. {{- end -}}
  40. {{/*
  41. Return license volume mount for container
  42. */}}
  43. {{- define "vm.license.mount" -}}
  44. {{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
  45. {{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
  46. {{- if and $licenseSecretName $licenseSecretKey -}}
  47. - name: license-key
  48. mountPath: /etc/vm-license-key
  49. readOnly: true
  50. {{- end -}}
  51. {{- end -}}
  52. {{/*
  53. Return license flag if necessary.
  54. */}}
  55. {{- define "vm.license.flag" -}}
  56. {{- $licenseKey := (include "vm.license.key" .) -}}
  57. {{- $licenseSecretKey := (include "vm.license.secret.key" .) -}}
  58. {{- $licenseSecretName := (include "vm.license.secret.name" .) -}}
  59. {{- if $licenseKey -}}
  60. license: {{ $licenseKey }}
  61. {{- else if and $licenseSecretName $licenseSecretKey -}}
  62. {{- $flagName := "licenseFile" -}}
  63. {{- if eq .flagStyle "kebab" }}
  64. {{- $flagName = "license-file" -}}
  65. {{- end -}}
  66. {{- $flagName }}: /etc/vm-license-key/{{ $licenseSecretKey }}
  67. {{- end -}}
  68. {{- end -}}