_redis.tpl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {{/*
  2. Copyright Broadcom, Inc. All Rights Reserved.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{/* vim: set filetype=mustache: */}}
  6. {{/*
  7. Auxiliary function to get the right value for enabled redis.
  8. Usage:
  9. {{ include "common.redis.values.enabled" (dict "context" $) }}
  10. */}}
  11. {{- define "common.redis.values.enabled" -}}
  12. {{- if .subchart -}}
  13. {{- printf "%v" .context.Values.redis.enabled -}}
  14. {{- else -}}
  15. {{- printf "%v" (not .context.Values.enabled) -}}
  16. {{- end -}}
  17. {{- end -}}
  18. {{/*
  19. Auxiliary function to get the right prefix path for the values
  20. Usage:
  21. {{ include "common.redis.values.key.prefix" (dict "subchart" "true" "context" $) }}
  22. Params:
  23. - subchart - Boolean - Optional. Whether redis is used as subchart or not. Default: false
  24. */}}
  25. {{- define "common.redis.values.keys.prefix" -}}
  26. {{- if .subchart -}}redis.{{- else -}}{{- end -}}
  27. {{- end -}}
  28. {{/*
  29. Checks whether the redis chart's includes the standarizations (version >= 14)
  30. Usage:
  31. {{ include "common.redis.values.standarized.version" (dict "context" $) }}
  32. */}}
  33. {{- define "common.redis.values.standarized.version" -}}
  34. {{- $standarizedAuth := printf "%s%s" (include "common.redis.values.keys.prefix" .) "auth" -}}
  35. {{- $standarizedAuthValues := include "common.utils.getValueFromKey" (dict "key" $standarizedAuth "context" .context) }}
  36. {{- if $standarizedAuthValues -}}
  37. {{- true -}}
  38. {{- end -}}
  39. {{- end -}}