deployment.yaml 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {{ include "common.storage.hostPathValidate" .Values }}
  2. apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
  3. kind: Deployment
  4. metadata:
  5. name: {{ template "common.names.fullname" . }}
  6. labels:
  7. app: {{ template "common.names.name" . }}
  8. chart: {{ template "common.names.chart" . }}
  9. release: {{ .Release.Name }}
  10. heritage: {{ .Release.Service }}
  11. annotations:
  12. rollme: {{ randAlphaNum 5 | quote }}
  13. spec:
  14. replicas: {{ (default 1 .Values.replicas) }}
  15. strategy:
  16. type: "Recreate"
  17. selector:
  18. matchLabels:
  19. app: {{ template "common.names.name" . }}
  20. release: {{ .Release.Name }}
  21. template:
  22. metadata:
  23. name: {{ template "common.names.fullname" . }}
  24. labels:
  25. app: {{ template "common.names.name" . }}
  26. release: {{ .Release.Name }}
  27. {{- include "common.labels.selectorLabels" . | nindent 8 }}
  28. annotations: {{ include "common.annotations" . | nindent 8 }}
  29. spec:
  30. initContainers:
  31. - name: generate-identity
  32. image: "alpine/curl:latest"
  33. securityContext:
  34. runAsUser: 0
  35. runAsGroup: 0
  36. command:
  37. - ./init_script/init_config.sh
  38. env:
  39. {{ $envListIdentity := (default list) }}
  40. {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "DEFAULT_CERT_PATH" "value" (printf "%s/ca.cert" .Values.identityCreationMountPath)) }}
  41. {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "DEFAULT_IDENTITY_CERT_PATH" "value" (printf "%s/identity.cert" .Values.identityCreationMountPath)) }}
  42. {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "AUTH_KEY" "valueFromSecret" true "secretName" "storj-credentials" "secretKey" "authToken") }}
  43. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envListIdentity) | nindent 12 }}
  44. volumeMounts:
  45. - name: initial-scripts
  46. mountPath: /init_script/
  47. - name: identity
  48. mountPath: {{ .Values.identityCreationMountPath }}
  49. - name: setup
  50. {{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
  51. command:
  52. - /bin/sh
  53. - -c
  54. - 'test ! -f {{ .Values.appVolumeMounts.data.mountPath }}/config.yaml && export SETUP="true"; /entrypoint;'
  55. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 8 }}
  56. securityContext:
  57. runAsUser: {{ .Values.runAsUser }}
  58. runAsGroup: {{ .Values.runAsGroup }}
  59. containers:
  60. - name: {{ .Chart.Name }}
  61. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  62. {{ include "common.resources.limitation" . | nindent 10 }}
  63. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
  64. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  65. - name: extrappvolume-{{ $index }}
  66. mountPath: {{ $hostPathConfiguration.mountPath }}
  67. {{ end }}
  68. securityContext:
  69. runAsUser: {{ .Values.runAsUser }}
  70. runAsGroup: {{ .Values.runAsGroup }}
  71. ports:
  72. - name: web
  73. containerPort: 14002
  74. - name: tcp
  75. containerPort: 28967
  76. protocol: TCP
  77. - name: udp
  78. containerPort: 28967
  79. protocol: UDP
  80. env:
  81. {{ $envList := (default list .Values.environmentVariables) }}
  82. {{ $envList = mustAppend $envList (dict "name" "WALLET" "valueFromSecret" true "secretName" "storj-credentials" "secretKey" "wallet") }}
  83. {{ $envList = mustAppend $envList (dict "name" "ADDRESS" "value" (printf "%s:%d" (.Values.domainAddress) (.Values.nodePort | int))) }}
  84. {{ $envList = mustAppend $envList (dict "name" "EMAIL" "value" (printf "%s" (.Values.email))) }}
  85. {{ $envList = mustAppend $envList (dict "name" "STORAGE" "value" (printf "%dGB" (.Values.storageSize | int))) }}
  86. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  87. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  88. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  89. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  90. - name: extrappvolume-{{ $index }}
  91. hostPath:
  92. path: {{ $hostPathConfiguration.hostPath }}
  93. {{ end }}
  94. - name: initial-scripts
  95. configMap:
  96. defaultMode: 0755
  97. name: "initial-scripts"