_resources.tpl 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {{/*
  2. Copyright Broadcom, Inc. All Rights Reserved.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{/* vim: set filetype=mustache: */}}
  6. {{/*
  7. Return a resource request/limit object based on a given preset.
  8. These presets are for basic testing and not meant to be used in production
  9. {{ include "common.resources.preset" (dict "type" "nano") -}}
  10. */}}
  11. {{- define "common.resources.preset" -}}
  12. {{/* The limits are the requests increased by 50% (except ephemeral-storage and xlarge/2xlarge sizes)*/}}
  13. {{- $presets := dict
  14. "nano" (dict
  15. "requests" (dict "cpu" "100m" "memory" "128Mi" "ephemeral-storage" "50Mi")
  16. "limits" (dict "cpu" "150m" "memory" "192Mi" "ephemeral-storage" "2Gi")
  17. )
  18. "micro" (dict
  19. "requests" (dict "cpu" "250m" "memory" "256Mi" "ephemeral-storage" "50Mi")
  20. "limits" (dict "cpu" "375m" "memory" "384Mi" "ephemeral-storage" "2Gi")
  21. )
  22. "small" (dict
  23. "requests" (dict "cpu" "500m" "memory" "512Mi" "ephemeral-storage" "50Mi")
  24. "limits" (dict "cpu" "750m" "memory" "768Mi" "ephemeral-storage" "2Gi")
  25. )
  26. "medium" (dict
  27. "requests" (dict "cpu" "500m" "memory" "1024Mi" "ephemeral-storage" "50Mi")
  28. "limits" (dict "cpu" "750m" "memory" "1536Mi" "ephemeral-storage" "2Gi")
  29. )
  30. "large" (dict
  31. "requests" (dict "cpu" "1.0" "memory" "2048Mi" "ephemeral-storage" "50Mi")
  32. "limits" (dict "cpu" "1.5" "memory" "3072Mi" "ephemeral-storage" "2Gi")
  33. )
  34. "xlarge" (dict
  35. "requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
  36. "limits" (dict "cpu" "3.0" "memory" "6144Mi" "ephemeral-storage" "2Gi")
  37. )
  38. "2xlarge" (dict
  39. "requests" (dict "cpu" "1.0" "memory" "3072Mi" "ephemeral-storage" "50Mi")
  40. "limits" (dict "cpu" "6.0" "memory" "12288Mi" "ephemeral-storage" "2Gi")
  41. )
  42. }}
  43. {{- if hasKey $presets .type -}}
  44. {{- index $presets .type | toYaml -}}
  45. {{- else -}}
  46. {{- printf "ERROR: Preset key '%s' invalid. Allowed values are %s" .type (join "," (keys $presets)) | fail -}}
  47. {{- end -}}
  48. {{- end -}}