deployment.yaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. {{ $scheme := "http" }}
  2. apiVersion: {{ template "ipfs.deployment.apiVersion" . }}
  3. kind: Deployment
  4. metadata:
  5. name: {{ template "ipfs.fullname" . }}
  6. labels:
  7. app: {{ template "ipfs.name" . }}
  8. chart: {{ template "ipfs.chart" . }}
  9. release: {{ .Release.Name }}
  10. heritage: {{ .Release.Service }}
  11. spec:
  12. strategy:
  13. type: {{ .Values.updateStrategy }}
  14. selector:
  15. matchLabels:
  16. app: {{ template "ipfs.name" . }}
  17. release: {{ .Release.Name }}
  18. template:
  19. metadata:
  20. name: {{ template "ipfs.fullname" . }}
  21. labels:
  22. app: {{ template "ipfs.name" . }}
  23. release: {{ .Release.Name }}
  24. spec:
  25. serviceAccountName: {{ include "ipfs.serviceAccountName" . | quote }}
  26. initContainers:
  27. - name: init-init
  28. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  29. command: ['/bin/sh', '-c', '[ ! -e /data/ipfs/config ] && (/usr/local/bin/ipfs init ; chown -R 1000:100 /data/ipfs) ; exit 0']
  30. imagePullPolicy: {{ .Values.image.pullPolicy }}
  31. volumeMounts:
  32. - name: data
  33. mountPath: /data/ipfs
  34. - name: staging
  35. mountPath: /export
  36. - name: init-api
  37. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  38. command: ['/usr/local/bin/ipfs', 'config', 'Addresses.API', "/ip4/0.0.0.0/tcp/{{ .Values.service.apiPort}}"]
  39. imagePullPolicy: {{ .Values.image.pullPolicy }}
  40. volumeMounts:
  41. - name: data
  42. mountPath: /data/ipfs
  43. - name: staging
  44. mountPath: /export
  45. - name: init-gateway
  46. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  47. command: ['/usr/local/bin/ipfs', 'config', 'Addresses.Gateway', "/ip4/0.0.0.0/tcp/{{ .Values.service.gatewayPort}}"]
  48. imagePullPolicy: {{ .Values.image.pullPolicy }}
  49. volumeMounts:
  50. - name: data
  51. mountPath: /data/ipfs
  52. - name: staging
  53. mountPath: /export
  54. - name: init-swarm
  55. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  56. command: ['/usr/local/bin/ipfs', 'config', '--json', 'Addresses.Swarm', "[\"/ip4/0.0.0.0/tcp/{{ .Values.service.swarmPort}}\",\"/ip4/0.0.0.0/tcp/{{ .Values.service.swarmPort}}/quic\"]" ]
  57. imagePullPolicy: {{ .Values.image.pullPolicy }}
  58. volumeMounts:
  59. - name: data
  60. mountPath: /data/ipfs
  61. - name: staging
  62. mountPath: /export
  63. - name: init-access-origin
  64. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  65. command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Origin', "[\"*\"]" ]
  66. imagePullPolicy: {{ .Values.image.pullPolicy }}
  67. volumeMounts:
  68. - name: data
  69. mountPath: /data/ipfs
  70. - name: staging
  71. mountPath: /export
  72. - name: init-access-methods
  73. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  74. command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Methods', "[\"PUT\",\"POST\"]" ]
  75. imagePullPolicy: {{ .Values.image.pullPolicy }}
  76. volumeMounts:
  77. - name: data
  78. mountPath: /data/ipfs
  79. - name: staging
  80. mountPath: /export
  81. - name: init-chown
  82. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  83. command: ['chown', '1000:100', '/data/ipfs/config']
  84. imagePullPolicy: {{ .Values.image.pullPolicy }}
  85. volumeMounts:
  86. - name: data
  87. mountPath: /data/ipfs
  88. - name: staging
  89. mountPath: /export
  90. containers:
  91. - name: {{ .Chart.Name }}
  92. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  93. imagePullPolicy: {{ .Values.image.pullPolicy }}
  94. volumeMounts:
  95. - name: data
  96. mountPath: /data/ipfs
  97. - name: staging
  98. mountPath: /export
  99. ports:
  100. - name: swarm
  101. containerPort: 9401
  102. - name: api
  103. containerPort: 9501
  104. - name: gateway
  105. containerPort: 9880
  106. {{- range $key, $val := .Values.environment }}
  107. - name: {{ $key }}
  108. value: {{ $val | quote }}
  109. {{- end}}
  110. volumes:
  111. - name: data
  112. {{- if .Values.emptyDirVolumes }}
  113. emptyDir: {}
  114. {{- else }}
  115. hostPath:
  116. path: {{ template "configuredHostPathData" . }}
  117. {{- end }}
  118. - name: staging
  119. {{- if .Values.emptyDirVolumes }}
  120. emptyDir: {}
  121. {{- else }}
  122. hostPath:
  123. path: {{ template "configuredHostPathStaging" . }}
  124. {{- end }}