diff --git a/charts/ipfs/1.0.0/questions.yaml b/charts/ipfs/1.0.0/questions.yaml index 329a32ae1e..5348c1b7c0 100644 --- a/charts/ipfs/1.0.0/questions.yaml +++ b/charts/ipfs/1.0.0/questions.yaml @@ -1,8 +1,12 @@ groups: - name: "Container Images" description: "Image to be used for container" + - name: "Workload Configuration" + description: "Configure Storage for IPFS" - name: "Storage" description: "Configure Storage for IPFS" + - name: "IPFS Configuration" + description: "Configure Storage for IPFS" portals: web_portal: @@ -11,7 +15,8 @@ portals: host: - "$node_ip" ports: - - "$variable-service.nodePort" + - "$variable-service.apiPort" + path: "/webui" questions: # Image related @@ -55,7 +60,7 @@ questions: group: "Workload Configuration" schema: type: string - default: "RollingUpdate" + default: "Recreate" enum: - value: "RollingUpdate" description: "Create new pods and then kill old ones" @@ -78,14 +83,31 @@ questions: type: dict required: true attrs: - - variable: nodePort - label: "Node Port to use for IPFS" + - variable: swarmPort + label: "Swarm Port to use for IPFS (Public)" schema: type: int - min: 9000 + min: 4000 max: 65535 - default: 9080 + default: 9401 required: true + - variable: apiPort + label: "API Port to use for IPFS (local)" + schema: + type: int + min: 4000 + max: 65535 + default: 9501 + required: true + - variable: gatewayPort + label: "Gateway Port to use for IPFS (local)" + schema: + type: int + min: 4000 + max: 65535 + default: 9880 + required: true + - variable: ipfsDataHostPathEnabled label: "Configure Host Path for IPFS data" @@ -124,7 +146,7 @@ questions: editable: false - variable: ipfsStagingHostPathEnabled - label: "Configure Host Path for IPFS staging" + label: "Configure Host Path for IPFS staging data" group: "Storage" schema: type: boolean @@ -132,7 +154,7 @@ questions: show_subquestions_if: true subquestions: - variable: ipfsStagingHostPath - label: "Specify HostPath for IPFS staging" + label: "Specify HostPath for IPFS staging data" schema: type: hostpath diff --git a/charts/ipfs/1.0.0/templates/_storage.tpl b/charts/ipfs/1.0.0/templates/_storage.tpl index a29ec5a4ad..fb9be148db 100644 --- a/charts/ipfs/1.0.0/templates/_storage.tpl +++ b/charts/ipfs/1.0.0/templates/_storage.tpl @@ -13,7 +13,7 @@ Retrieve host path from ix volumes based on dataset name {{/* Retrieve host path for ipfs */}} -{{- define "configuredDataHostPath" -}} +{{- define "configuredHostPathData" -}} {{- if .Values.ipfsDataHostPathEnabled -}} {{- .Values.ipfsDataHostPath -}} {{- else -}} @@ -25,7 +25,7 @@ Retrieve host path for ipfs {{/* Retrieve host path for ipfs */}} -{{- define "configuredStagingHostPath" -}} +{{- define "configuredHostPathStaging" -}} {{- if .Values.ipfsStagingHostPathEnabled -}} {{- .Values.ipfsStagingHostPath -}} {{- else -}} diff --git a/charts/ipfs/1.0.0/templates/deployment.yaml b/charts/ipfs/1.0.0/templates/deployment.yaml index df04c5118d..2496d13269 100644 --- a/charts/ipfs/1.0.0/templates/deployment.yaml +++ b/charts/ipfs/1.0.0/templates/deployment.yaml @@ -23,35 +23,102 @@ spec: release: {{ .Release.Name }} spec: serviceAccountName: {{ include "ipfs.serviceAccountName" . | quote }} + initContainers: + - name: init-init + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ['/bin/sh', '-c', '[ ! -e /data/ipfs/config ] && /usr/local/bin/ipfs init ; exit 0'] + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + - name: staging + mountPath: /export + - name: init-api + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ['/usr/local/bin/ipfs', 'config', 'Addresses.API', "/ip4/0.0.0.0/tcp/{{ .Values.service.apiPort}}"] + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + - name: staging + mountPath: /export + - name: init-gateway + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ['/usr/local/bin/ipfs', 'config', 'Addresses.Gateway', "/ip4/0.0.0.0/tcp/{{ .Values.service.gatewayPort}}"] + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + - name: staging + mountPath: /export + - name: init-swarm + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + 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\"]" ] + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + - name: staging + mountPath: /export + - name: init-access-origin + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Origin', "[\"*\"]" ] + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + - name: staging + mountPath: /export + - name: init-access-methods + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Methods', "[\"PUT\",\"POST\"]" ] + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + - name: staging + mountPath: /export + - name: init-chown + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ['chown', '-R', '1000:100', '/data/ipfs'] + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + - name: staging + mountPath: /export containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: data - mountPath: /data/ipfs - volumeMounts: + mountPath: /data/ipfs - name: staging mountPath: /export ports: - - name: {{ $scheme }} - containerPort: 9080 + - name: swarm + containerPort: 9401 + - name: api + containerPort: 9501 + - name: gateway + containerPort: 9880 {{- range $key, $val := .Values.environment }} - name: {{ $key }} value: {{ $val | quote }} {{- end}} volumes: - name: data - {{- if .Values.emptyDirVolumes }} - emptyDir: {} - {{- else }} + {{- if ne (include "configuredHostPathData" .) "" }} hostPath: - path: {{ template "configuredDataHostPath" . }} + path: {{ template "configuredHostPathData" . }} + {{- else }} + emptyDir: {} {{- end }} - name: staging - {{- if .Values.emptyDirVolumes }} - emptyDir: {} - {{- else }} + {{- if ne (include "configuredHostPathStaging" .) "" }} hostPath: - path: {{ template "configuredStagingHostPath" . }} + path: {{ template "configuredHostPathStaging" . }} + {{- else }} + emptyDir: {} {{- end }} diff --git a/charts/ipfs/1.0.0/templates/service.yaml b/charts/ipfs/1.0.0/templates/service.yaml index 9039bbb7a5..ad352427e8 100644 --- a/charts/ipfs/1.0.0/templates/service.yaml +++ b/charts/ipfs/1.0.0/templates/service.yaml @@ -11,11 +11,21 @@ metadata: spec: type: "NodePort" ports: - - name: {{ $scheme }} - port: {{ .Values.service.nodePort }} + - name: swarm + port: {{ .Values.service.swarmPort }} protocol: TCP - nodePort: {{ .Values.service.nodePort }} - targetPort: 9080 + nodePort: {{ .Values.service.swarmPort }} + targetPort: 9401 + - name: api + port: {{ .Values.service.apiPort }} + protocol: TCP + nodePort: {{ .Values.service.apiPort }} + targetPort: 9501 + - name: gateway + port: {{ .Values.service.gatewayPort }} + protocol: TCP + nodePort: {{ .Values.service.gatewayPort }} + targetPort: 9880 selector: app: {{ template "ipfs.name" . }} release: {{ .Release.Name }} diff --git a/charts/ipfs/1.0.0/test_values.yaml b/charts/ipfs/1.0.0/test_values.yaml index 4239f4bdb1..e84aed331a 100644 --- a/charts/ipfs/1.0.0/test_values.yaml +++ b/charts/ipfs/1.0.0/test_values.yaml @@ -8,11 +8,16 @@ image: ## Additional arguments to pass to minio binary extraArgs: [] -updateStrategy: RollingUpdate +updateStrategy: Recreate service: - nodePort: 9080 + swarmPort: 9401 + apiPort: 9501 + gatewayPort: 9080 environment: emptyDirVolumes: true + +ipfsDataHostPathEnabled: false +ipfsStagingHostPathEnabled: false diff --git a/charts/ipfs/1.0.0/values.yaml b/charts/ipfs/1.0.0/values.yaml index e30aa32195..6c0c07c715 100644 --- a/charts/ipfs/1.0.0/values.yaml +++ b/charts/ipfs/1.0.0/values.yaml @@ -8,9 +8,14 @@ image: ## Additional arguments to pass to ipfs binary extraArgs: [] -updateStrategy: RollingUpdate +updateStrategy: Recreate service: - nodePort: 9080 + swarmPort: 9401 + apiPort: 9501 + gatewayPort: 9080 environment: + +ipfsDataHostPathEnabled: false +ipfsStagingHostPathEnabled: false