_ipfs.tpl 4.4 KB

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