暫無描述

_helpers.tpl 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. {{/*
  2. Return the common name for backend componentes
  3. */}}
  4. {{- define "shuffle.backend.name" -}}
  5. {{- printf "%s-backend" (include "common.names.fullname" .) | trunc 63 -}}
  6. {{- end -}}
  7. {{/*
  8. Return the common labels for backend components
  9. The shuffle app builder requires the io.kompose.service=backend label to be set on the backend pod.
  10. */}}
  11. {{- define "shuffle.backend.labels" -}}
  12. {{- include "common.labels.standard" . }}
  13. app.kubernetes.io/component: backend
  14. io.kompose.service: backend
  15. {{- end -}}
  16. {{/*
  17. Return the match labels for backend components
  18. */}}
  19. {{- define "shuffle.backend.matchLabels" -}}
  20. {{- include "common.labels.matchLabels" . }}
  21. app.kubernetes.io/component: backend
  22. {{- end -}}
  23. {{/*
  24. Return the proper Shuffle backend image name
  25. */}}
  26. {{- define "shuffle.backend.image" -}}
  27. {{- include "common.images.image" ( dict "imageRoot" .Values.backend.image "global" .Values.global "chart" .Chart ) -}}
  28. {{- end -}}
  29. {{/*
  30. Return the proper Docker Image Registry Secret Names for the backend pod
  31. */}}
  32. {{- define "shuffle.backend.imagePullSecrets" -}}
  33. {{- include "common.images.renderPullSecrets" (dict "images" (list .Values.backend.image) "context" $) -}}
  34. {{- end -}}
  35. {{/*
  36. Create the name of the service account to use for the Shuffle backend
  37. */}}
  38. {{- define "shuffle.backend.serviceAccount.name" -}}
  39. {{- if .Values.backend.serviceAccount.create -}}
  40. {{ default (include "shuffle.backend.name" .) .Values.backend.serviceAccount.name | trunc 63 | trimSuffix "-" }}
  41. {{- else -}}
  42. {{ default "default" .Values.backend.serviceAccount.name }}
  43. {{- end -}}
  44. {{- end -}}
  45. {{/*
  46. Return the proper Docker Image Registry Secret Names for the backend service account
  47. */}}
  48. {{- define "shuffle.backend.serviceAccount.imagePullSecrets" -}}
  49. {{- $pullSecrets := list }}
  50. {{- range .Values.global.imagePullSecrets -}}
  51. {{- if kindIs "map" . -}}
  52. {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" .)) -}}
  53. {{- else -}}
  54. {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" .)) -}}
  55. {{- end -}}
  56. {{- end -}}
  57. {{- range .Values.backend.serviceAccount.imagePullSecrets -}}
  58. {{- if kindIs "map" . -}}
  59. {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" .name "context" .)) -}}
  60. {{- else -}}
  61. {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" .)) -}}
  62. {{- end -}}
  63. {{- end -}}
  64. {{- if (not (empty $pullSecrets)) -}}
  65. imagePullSecrets:
  66. {{- range $pullSecrets | uniq }}
  67. - name: {{ . }}
  68. {{- end }}
  69. {{- end }}
  70. {{- end -}}
  71. {{- define "shuffle.backend.baseUrl" -}}
  72. http://{{ include "shuffle.backend.name" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.backend.containerPorts.http }}
  73. {{- end -}}
  74. {{/*
  75. Return the environment variables of shuffle-backend in the format
  76. KEY: VALUE
  77. */}}
  78. {{- define "shuffle.backend.env" -}}
  79. RUNNING_MODE: kubernetes
  80. IS_KUBERNETES: "true"
  81. SHUFFLE_APP_HOTLOAD_FOLDER: /shuffle-apps
  82. SHUFFLE_FILE_LOCATION: /shuffle-files
  83. BACKEND_PORT: "{{ .Values.backend.containerPorts.http }}"
  84. {{- if .Values.shuffle.baseUrl }}
  85. BASE_URL: "{{ .Values.shuffle.baseUrl }}"
  86. SSO_REDIRECT_URL: "{{ .Values.shuffle.baseUrl }}"
  87. {{- else }}
  88. BASE_URL: "{{ include "shuffle.backend.baseUrl" . }}"
  89. {{- end }}
  90. ORG_ID: "{{ .Values.shuffle.org }}"
  91. SHUFFLE_APP_DOWNLOAD_LOCATION: "{{ .Values.backend.apps.downloadLocation }}"
  92. SHUFFLE_DOWNLOAD_AUTH_BRANCH: "{{ .Values.backend.apps.downloadBranch }}"
  93. SHUFFLE_APP_FORCE_UPDATE: "{{ .Values.backend.apps.forceUpdate }}"
  94. SHUFFLE_CHAT_DISABLED: "true"
  95. # Sets backend_url parameter for workflow execution to the cluster-internal shuffle-backend address
  96. SHUFFLE_CLOUDRUN_URL: "{{ include "shuffle.backend.baseUrl" .}}"
  97. SHUFFLE_OPENSEARCH_URL: {{ include "common.tplvalues.render" (dict "value" .Values.backend.openSearch.url "context" $) }}
  98. SHUFFLE_OPENSEARCH_USERNAME: "{{ .Values.backend.openSearch.username }}"
  99. SHUFFLE_OPENSEARCH_CERTIFICATE_FILE: "{{ .Values.backend.openSearch.certificateFile }}"
  100. SHUFFLE_OPENSEARCH_SKIPSSL_VERIFY: "{{ .Values.backend.openSearch.skipSSLVerify }}"
  101. SHUFFLE_OPENSEARCH_INDEX_PREFIX: "{{ .Values.backend.openSearch.indexPrefix }}"
  102. SHUFFLE_RERUN_SCHEDULE: "{{ .Values.backend.cleanupSchedule }}"
  103. TZ: "{{ .Values.shuffle.timezone }}"
  104. REGISTRY_URL: "{{ .Values.shuffle.appRegistry }}" # Used by app builder
  105. {{- end -}}