deployment.yaml 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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: {{ include "common.labels" . | nindent 4 }}
  7. spec:
  8. strategy:
  9. type: {{ .Values.updateStrategy }}
  10. selector:
  11. matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }}
  12. template:
  13. metadata:
  14. name: {{ template "common.names.fullname" . }}
  15. labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
  16. spec:
  17. serviceAccountName: {{ include "common.names.serviceAccountName" . | quote }}
  18. initContainers:
  19. - name: init-init
  20. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  21. command: ['/bin/sh', '-c', '[ ! -e /data/ipfs/config ] && (/usr/local/bin/ipfs init ; chown -R 1000:100 /data/ipfs) ; exit 0']
  22. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  23. - name: init-api
  24. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  25. command: ['/usr/local/bin/ipfs', 'config', 'Addresses.API', "/ip4/0.0.0.0/tcp/9501"]
  26. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  27. - name: init-gateway
  28. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  29. command: ['/usr/local/bin/ipfs', 'config', 'Addresses.Gateway', "/ip4/0.0.0.0/tcp/9080"]
  30. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  31. - name: init-swarm
  32. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  33. command: ['/usr/local/bin/ipfs', 'config', '--json', 'Addresses.Swarm', "[\"/ip4/0.0.0.0/tcp/9401\",\"/ip4/0.0.0.0/tcp/9401/quic\"]" ]
  34. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  35. - name: init-access-origin
  36. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  37. command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Origin', "[\"*\"]" ]
  38. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  39. - name: init-access-methods
  40. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  41. command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Methods', "[\"PUT\",\"POST\"]" ]
  42. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  43. - name: init-chown
  44. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  45. command: ['chown', '1000:100', '/data/ipfs/config']
  46. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  47. containers:
  48. - name: {{ .Chart.Name }}
  49. {{ include "common.resources.limitation" . | nindent 10 }}
  50. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  51. {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
  52. ports:
  53. - name: swarm
  54. containerPort: 9401
  55. - name: api
  56. containerPort: 9501
  57. - name: gateway
  58. containerPort: 9880
  59. {{ include "common.containers.allEnvironmentVariables" .Values | nindent 10 }}
  60. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  61. {{ include "common.storage.allAppVolumes" .Values | nindent 6 }}