_ipfs.tpl 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {{- define "ipfs.workload" -}}
  2. workload:
  3. ipfs:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.ipfsNetwork.hostNetwork }}
  9. containers:
  10. ipfs:
  11. enabled: true
  12. primary: true
  13. imageSelector: image
  14. securityContext:
  15. runAsUser: {{ .Values.ipfsRunAs.user }}
  16. runAsGroup: {{ .Values.ipfsRunAs.group }}
  17. {{ with .Values.ipfsConfig.additionalEnvs }}
  18. envList:
  19. {{ range $env := . }}
  20. - name: {{ $env.name }}
  21. value: {{ $env.value }}
  22. {{ end }}
  23. {{ end }}
  24. probes:
  25. liveness:
  26. enabled: true
  27. type: exec
  28. command:
  29. - ipfs
  30. - dag
  31. - stat
  32. # https://github.com/ipfs/kubo/blob/8f638dcbcd875ecff92021e4b62d0af8848022ce/Dockerfile#L116
  33. - /ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
  34. readiness:
  35. enabled: true
  36. type: exec
  37. command:
  38. - ipfs
  39. - dag
  40. - stat
  41. - /ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
  42. startup:
  43. enabled: true
  44. type: exec
  45. command:
  46. - ipfs
  47. - dag
  48. - stat
  49. - /ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn
  50. initContainers:
  51. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  52. "UID" .Values.ipfsRunAs.user
  53. "GID" .Values.ipfsRunAs.group
  54. "type" "install") | nindent 8 }}
  55. # "02" prefix is used to ensure this container runs after the permissions container
  56. 02-init-config:
  57. enabled: true
  58. type: init
  59. imageSelector: image
  60. securityContext:
  61. runAsUser: {{ .Values.ipfsRunAs.user }}
  62. runAsGroup: {{ .Values.ipfsRunAs.group }}
  63. command: /init-config.sh
  64. resources:
  65. limits:
  66. memory: 512Mi
  67. cpu: 1000m
  68. {{/* Service */}}
  69. service:
  70. ipfs:
  71. enabled: true
  72. primary: true
  73. type: NodePort
  74. targetSelector: ipfs
  75. ports:
  76. api:
  77. enabled: true
  78. primary: true
  79. port: {{ .Values.ipfsNetwork.apiPort }}
  80. nodePort: {{ .Values.ipfsNetwork.apiPort }}
  81. targetSelector: ipfs
  82. ipfs-swarm:
  83. enabled: true
  84. type: NodePort
  85. targetSelector: ipfs
  86. ports:
  87. swarm-tcp:
  88. enabled: true
  89. primary: true
  90. port: {{ .Values.ipfsNetwork.swarmPort }}
  91. nodePort: {{ .Values.ipfsNetwork.swarmPort }}
  92. targetSelector: ipfs
  93. swarm-udp:
  94. enabled: true
  95. primary: true
  96. port: {{ .Values.ipfsNetwork.swarmPort }}
  97. nodePort: {{ .Values.ipfsNetwork.swarmPort }}
  98. protocol: udp
  99. targetSelector: ipfs
  100. ipfs-gateway:
  101. enabled: true
  102. type: NodePort
  103. targetSelector: ipfs
  104. ports:
  105. ipfs-gateway:
  106. enabled: true
  107. primary: true
  108. port: {{ .Values.ipfsNetwork.gatewayPort }}
  109. nodePort: {{ .Values.ipfsNetwork.gatewayPort }}
  110. targetSelector: ipfs
  111. {{/* Persistence */}}
  112. persistence:
  113. data:
  114. enabled: true
  115. type: {{ .Values.ipfsStorage.data.type }}
  116. datasetName: {{ .Values.ipfsStorage.data.datasetName | default "" }}
  117. hostPath: {{ .Values.ipfsStorage.data.hostPath | default "" }}
  118. targetSelector:
  119. ipfs:
  120. ipfs:
  121. mountPath: /data/ipfs
  122. 01-permissions:
  123. mountPath: /mnt/directories/data
  124. 02-init-config:
  125. mountPath: /data/ipfs
  126. staging:
  127. enabled: true
  128. type: {{ .Values.ipfsStorage.staging.type }}
  129. datasetName: {{ .Values.ipfsStorage.staging.datasetName | default "" }}
  130. hostPath: {{ .Values.ipfsStorage.staging.hostPath | default "" }}
  131. targetSelector:
  132. ipfs:
  133. ipfs:
  134. mountPath: /export
  135. 01-permissions:
  136. mountPath: /mnt/directories/export
  137. config-script:
  138. enabled: true
  139. type: configmap
  140. objectName: config-script
  141. defaultMode: "0755"
  142. targetSelector:
  143. ipfs:
  144. 02-init-config:
  145. mountPath: /init-config.sh
  146. readOnly: true
  147. subPath: init-config.sh
  148. {{- end -}}