deployment.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. {{ include "common.storage.hostPathValidate" .Values }}
  2. apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
  3. kind: Deployment
  4. metadata:
  5. name: {{ template "common.names.fullname" . }}-storj
  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. terminationGracePeriodSeconds: {{ .Values.terminationGracePeriod | default 30 }}
  31. initContainers:
  32. - name: generate-identity
  33. image: "alpine/curl:latest"
  34. securityContext:
  35. runAsUser: 0
  36. runAsGroup: 0
  37. command:
  38. - ./init_script/init_config.sh
  39. env:
  40. {{ $envListIdentity := (default list) }}
  41. {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "DEFAULT_CERT_PATH" "value" (printf "%s/ca.cert" .Values.identityCreationMountPath)) }}
  42. {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "DEFAULT_IDENTITY_CERT_PATH" "value" (printf "%s/identity.cert" .Values.identityCreationMountPath)) }}
  43. {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "AUTH_KEY" "valueFromSecret" true "secretName" "storj-credentials" "secretKey" "authToken") }}
  44. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envListIdentity) | nindent 12 }}
  45. volumeMounts:
  46. - name: initial-scripts
  47. mountPath: /init_script/
  48. - name: identity
  49. mountPath: {{ .Values.identityCreationMountPath }}
  50. - name: setup
  51. {{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
  52. command:
  53. - /bin/sh
  54. - -c
  55. - 'test ! -f {{ .Values.appVolumeMounts.data.mountPath }}/config.yaml && export SETUP="true"; /entrypoint;'
  56. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 8 }}
  57. securityContext:
  58. runAsUser: {{ .Values.runAsUser }}
  59. runAsGroup: {{ .Values.runAsGroup }}
  60. containers:
  61. - name: {{ .Chart.Name }}
  62. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  63. {{ include "common.resources.limitation" . | nindent 10 }}
  64. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
  65. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  66. - name: extrappvolume-{{ $index }}
  67. mountPath: {{ $hostPathConfiguration.mountPath }}
  68. {{ end }}
  69. securityContext:
  70. runAsUser: {{ .Values.runAsUser }}
  71. runAsGroup: {{ .Values.runAsGroup }}
  72. ports:
  73. - name: web
  74. containerPort: 14002
  75. - name: tcp
  76. containerPort: 28967
  77. protocol: TCP
  78. - name: udp
  79. containerPort: 28967
  80. protocol: UDP
  81. {{- $walletFeats := list -}}
  82. {{- if .Values.zksync }}
  83. {{- $walletFeats = mustAppend $walletFeats "zksync" -}}
  84. {{- end -}}
  85. {{ if .Values.zksyncEra }}
  86. {{- $walletFeats = mustAppend $walletFeats "zksync-era" -}}
  87. {{- end -}}
  88. {{- if $walletFeats }}
  89. args:
  90. - --operator.wallet-features={{ join "," $walletFeats }}
  91. {{ end }}
  92. env:
  93. {{ $envList := (default list .Values.environmentVariables) }}
  94. {{ $envList = mustAppend $envList (dict "name" "WALLET" "valueFromSecret" true "secretName" "storj-credentials" "secretKey" "wallet") }}
  95. {{ $envList = mustAppend $envList (dict "name" "ADDRESS" "value" (printf "%s:%d" (.Values.domainAddress) (.Values.nodePort | int))) }}
  96. {{ $envList = mustAppend $envList (dict "name" "EMAIL" "value" (printf "%s" (.Values.email))) }}
  97. {{ $envList = mustAppend $envList (dict "name" "STORAGE" "value" (printf "%dGB" (.Values.storageSize | int))) }}
  98. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  99. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  100. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  101. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  102. - name: extrappvolume-{{ $index }}
  103. hostPath:
  104. path: {{ $hostPathConfiguration.hostPath }}
  105. {{ end }}
  106. - name: initial-scripts
  107. configMap:
  108. defaultMode: 0755
  109. name: "initial-scripts"