From 96b8da5fb02f1c40ad36fa7208fc61b224933019 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Fri, 22 Jan 2021 14:52:06 -0500 Subject: [PATCH 01/11] WIP of adding IPFS chart --- charts/ipfs/1.0.0/.helmignore | 23 +++ charts/ipfs/1.0.0/Chart.yaml | 14 ++ charts/ipfs/1.0.0/README.md | 28 +++ charts/ipfs/1.0.0/app-readme.md | 1 + charts/ipfs/1.0.0/questions.yaml | 160 ++++++++++++++++++ charts/ipfs/1.0.0/templates/NOTES.txt | 2 + charts/ipfs/1.0.0/templates/_helpers.tpl | 84 +++++++++ charts/ipfs/1.0.0/templates/_storage.tpl | 35 ++++ charts/ipfs/1.0.0/templates/deployment.yaml | 57 +++++++ charts/ipfs/1.0.0/templates/service.yaml | 21 +++ .../ipfs/1.0.0/templates/serviceaccount.yaml | 9 + charts/ipfs/1.0.0/test_values.yaml | 18 ++ charts/ipfs/1.0.0/values.yaml | 16 ++ charts/ipfs/item.yaml | 3 + 14 files changed, 471 insertions(+) create mode 100644 charts/ipfs/1.0.0/.helmignore create mode 100644 charts/ipfs/1.0.0/Chart.yaml create mode 100755 charts/ipfs/1.0.0/README.md create mode 100644 charts/ipfs/1.0.0/app-readme.md create mode 100644 charts/ipfs/1.0.0/questions.yaml create mode 100644 charts/ipfs/1.0.0/templates/NOTES.txt create mode 100644 charts/ipfs/1.0.0/templates/_helpers.tpl create mode 100644 charts/ipfs/1.0.0/templates/_storage.tpl create mode 100644 charts/ipfs/1.0.0/templates/deployment.yaml create mode 100644 charts/ipfs/1.0.0/templates/service.yaml create mode 100644 charts/ipfs/1.0.0/templates/serviceaccount.yaml create mode 100644 charts/ipfs/1.0.0/test_values.yaml create mode 100644 charts/ipfs/1.0.0/values.yaml create mode 100644 charts/ipfs/item.yaml diff --git a/charts/ipfs/1.0.0/.helmignore b/charts/ipfs/1.0.0/.helmignore new file mode 100644 index 0000000000..a9fe727881 --- /dev/null +++ b/charts/ipfs/1.0.0/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +# OWNERS file for Kubernetes +OWNERS \ No newline at end of file diff --git a/charts/ipfs/1.0.0/Chart.yaml b/charts/ipfs/1.0.0/Chart.yaml new file mode 100644 index 0000000000..9cbe207526 --- /dev/null +++ b/charts/ipfs/1.0.0/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +description: Global, Versioned, peer-to-peer filesystem. +name: ipfs +version: 1.0.0 +appVersion: master +keywords: +- storage +- p2p +home: https://ipfs.io +icon: https://ipfs.io/ipfs/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/ipfs.go.png +sources: +- https://github.com/ipfs/go-ipfs +- https://hub.docker.com/r/ipfs/go-ipfs +upstream_version: 0.8.0-rc1 diff --git a/charts/ipfs/1.0.0/README.md b/charts/ipfs/1.0.0/README.md new file mode 100755 index 0000000000..8b158db531 --- /dev/null +++ b/charts/ipfs/1.0.0/README.md @@ -0,0 +1,28 @@ +IPFS +===== + +[IPFS](https://ipfs.io) is a global, versioned, peer-to-peer filesystem. It combines good ideas from previous systems such Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bittorrent swarm, exchanging git objects. IPFS provides an interface as simple as the HTTP web, but with permanence built in. You can also mount the world at /ipfs. + +Introduction +------------ + +This chart bootstraps IPFS deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + + +Configuration +------------- + +The following table lists the configurable parameters of the IPFS chart and their default values. + +| Parameter | Description | Default | +|:-------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------| +| `image.repository` | Image repository | `ipfs/go-ipfs` | +| `image.tag` | MinIO image tag. Possible values listed [here](https://hub.docker.com/r/ipfs/go-ipfs/tags). | `v0.8.0-rc1` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `extraArgs` | Additional command line arguments to pass to the IPFS server | `[]` | +| `persistence.enabled` | Use persistent volume to store data | `true` | +| `persistence.size` | Size of persistent volume claim | `500Gi` | +| `persistence.existingClaim` | Use an existing PVC to persist data | `nil` | +| `persistence.storageClass` | Storage class name of PVC | `nil` | +| `persistence.accessMode` | ReadWriteOnce or ReadOnly | `ReadWriteOnce` | +| `persistence.subPath` | Mount a sub directory of the persistent volume if set | `""` | diff --git a/charts/ipfs/1.0.0/app-readme.md b/charts/ipfs/1.0.0/app-readme.md new file mode 100644 index 0000000000..dc481d47c8 --- /dev/null +++ b/charts/ipfs/1.0.0/app-readme.md @@ -0,0 +1 @@ +[IPFS](https://ipfs.io) is a global, versioned, peer-to-peer filesystem. It combines good ideas from previous systems such Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bittorrent swarm, exchanging git objects. IPFS provides an interface as simple as the HTTP web, but with permanence built in. You can also mount the world at /ipfs. diff --git a/charts/ipfs/1.0.0/questions.yaml b/charts/ipfs/1.0.0/questions.yaml new file mode 100644 index 0000000000..329a32ae1e --- /dev/null +++ b/charts/ipfs/1.0.0/questions.yaml @@ -0,0 +1,160 @@ +groups: + - name: "Container Images" + description: "Image to be used for container" + - name: "Storage" + description: "Configure Storage for IPFS" + +portals: + web_portal: + protocols: + - "http" + host: + - "$node_ip" + ports: + - "$variable-service.nodePort" + +questions: + # Image related + - variable: image + description: "Docker Image Details" + label: "Docker Image" + group: "Container Images" + schema: + type: dict + required: true + attrs: + - variable: repository + description: "Docker image repository" + label: "Image repository" + schema: + type: string + default: "ipfs/go-ipfs" + required: true + - variable: tag + description: "Tag to use for specified image" + label: "Image Tag" + schema: + type: string + default: "v0.8.0-rc1" + - variable: pullPolicy + description: "Docker Image Pull Policy" + label: "Image Pull Policy" + schema: + type: string + default: "IfNotPresent" + enum: + - value: "IfNotPresent" + description: "Only pull image if not present on host" + - value: "Always" + description: "Always pull image even if present on host" + - value: "Never" + description: "Never pull image even if it's not present on host" + + - variable: updateStrategy + label: "IPFS update strategy" + group: "Workload Configuration" + schema: + type: string + default: "RollingUpdate" + enum: + - value: "RollingUpdate" + description: "Create new pods and then kill old ones" + - value: "Recreate" + description: "Kill existing pods before creating new ones" + + - variable: environment + label: "IPFS image environment" + group: "IPFS Configuration" + schema: + type: dict + additional_attrs: true + attrs: [] + + - variable: service + description: "IPFS Service Configuration" + label: "IPFS Service Configuration" + group: "IPFS Configuration" + schema: + type: dict + required: true + attrs: + - variable: nodePort + label: "Node Port to use for IPFS" + schema: + type: int + min: 9000 + max: 65535 + default: 9080 + required: true + + - variable: ipfsDataHostPathEnabled + label: "Configure Host Path for IPFS data" + group: "Storage" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: ipfsDataHostPath + label: "Specify HostPath for IPFS data" + schema: + type: hostpath + + - variable: ipfsDataVolume + label: "Configure iXVolume" + group: "Storage" + schema: + type: dict + $ref: + - "normalize/ixVolume" + show_if: [["ipfsDataHostPathEnabled", "=", false]] + attrs: + - variable: mountPath + label: "Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/data/ipfs" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-ipfs-data" + editable: false + + - variable: ipfsStagingHostPathEnabled + label: "Configure Host Path for IPFS staging" + group: "Storage" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: ipfsStagingHostPath + label: "Specify HostPath for IPFS staging" + schema: + type: hostpath + + - variable: ipfsStagingVolume + label: "Configure iXVolume" + group: "Storage" + schema: + type: dict + $ref: + - "normalize/ixVolume" + show_if: [["ipfsStagingHostPathEnabled", "=", false]] + attrs: + - variable: mountPath + label: "Mount Path" + description: "Path where the volume will be mounted inside the pod" + schema: + type: path + editable: false + default: "/export" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-ipfs-staging" + editable: false diff --git a/charts/ipfs/1.0.0/templates/NOTES.txt b/charts/ipfs/1.0.0/templates/NOTES.txt new file mode 100644 index 0000000000..88e8e93ef8 --- /dev/null +++ b/charts/ipfs/1.0.0/templates/NOTES.txt @@ -0,0 +1,2 @@ +Minio can be accessed from the following URL: +http://$node_ip:{{ .Values.service.nodePort }}/ diff --git a/charts/ipfs/1.0.0/templates/_helpers.tpl b/charts/ipfs/1.0.0/templates/_helpers.tpl new file mode 100644 index 0000000000..800e260911 --- /dev/null +++ b/charts/ipfs/1.0.0/templates/_helpers.tpl @@ -0,0 +1,84 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ipfs.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "ipfs.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "ipfs.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for deployment. +*/}} +{{- define "ipfs.deployment.apiVersion" -}} +{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.Version -}} +{{- print "apps/v1beta2" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "ipfs.statefulset.apiVersion" -}} +{{- if semverCompare "<1.17-0" .Capabilities.KubeVersion.Version -}} +{{- print "apps/v1beta2" -}} +{{- else -}} +{{- print "apps/v1" -}} +{{- end -}} +{{- end -}} + +{{/* +Determine secret name. +*/}} +{{- define "ipfs.secretName" -}} +{{- include "ipfs.fullname" . -}} +{{- end -}} + +{{/* +Determine service account name for deployment or statefulset. +*/}} +{{- define "ipfs.serviceAccountName" -}} +{{- (include "ipfs.fullname" .) | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Determine name for scc role and rolebinding +*/}} +{{- define "ipfs.sccRoleName" -}} +{{- printf "%s-%s" "scc" (include "ipfs.fullname" .) | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Properly format optional additional arguments to IPFS binary +*/}} +{{- define "ipfs.extraArgs" -}} +{{- range .Values.extraArgs -}} +{{ " " }}{{ . }} +{{- end -}} +{{- end -}} diff --git a/charts/ipfs/1.0.0/templates/_storage.tpl b/charts/ipfs/1.0.0/templates/_storage.tpl new file mode 100644 index 0000000000..a29ec5a4ad --- /dev/null +++ b/charts/ipfs/1.0.0/templates/_storage.tpl @@ -0,0 +1,35 @@ +{{/* +Retrieve host path from ix volumes based on dataset name +*/}} +{{- define "retrieveDataPathFromiXVolume" -}} +{{- range $index, $hostPathConfiguration := $.ixVolumes }} +{{- $dsName := base $hostPathConfiguration.hostPath -}} +{{- if eq $.datasetName $dsName -}} +{{- $hostPathConfiguration.hostPath -}} +{{- end -}} +{{- end }} +{{- end -}} + +{{/* +Retrieve host path for ipfs +*/}} +{{- define "configuredDataHostPath" -}} +{{- if .Values.ipfsDataHostPathEnabled -}} +{{- .Values.ipfsDataHostPath -}} +{{- else -}} +{{- $volDict := dict "datasetName" $.Values.ipfsDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} +{{- end -}} +{{- end -}} + +{{/* +Retrieve host path for ipfs +*/}} +{{- define "configuredStagingHostPath" -}} +{{- if .Values.ipfsStagingHostPathEnabled -}} +{{- .Values.ipfsStagingHostPath -}} +{{- else -}} +{{- $volDict := dict "datasetName" $.Values.ipfsStagingVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} +{{- end -}} +{{- end -}} diff --git a/charts/ipfs/1.0.0/templates/deployment.yaml b/charts/ipfs/1.0.0/templates/deployment.yaml new file mode 100644 index 0000000000..df04c5118d --- /dev/null +++ b/charts/ipfs/1.0.0/templates/deployment.yaml @@ -0,0 +1,57 @@ +{{ $scheme := "http" }} +apiVersion: {{ template "ipfs.deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "ipfs.fullname" . }} + labels: + app: {{ template "ipfs.name" . }} + chart: {{ template "ipfs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + strategy: + type: {{ .Values.updateStrategy }} + selector: + matchLabels: + app: {{ template "ipfs.name" . }} + release: {{ .Release.Name }} + template: + metadata: + name: {{ template "ipfs.fullname" . }} + labels: + app: {{ template "ipfs.name" . }} + release: {{ .Release.Name }} + spec: + serviceAccountName: {{ include "ipfs.serviceAccountName" . | quote }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + volumeMounts: + - name: data + mountPath: /data/ipfs + volumeMounts: + - name: staging + mountPath: /export + ports: + - name: {{ $scheme }} + containerPort: 9080 + {{- range $key, $val := .Values.environment }} + - name: {{ $key }} + value: {{ $val | quote }} + {{- end}} + volumes: + - name: data + {{- if .Values.emptyDirVolumes }} + emptyDir: {} + {{- else }} + hostPath: + path: {{ template "configuredDataHostPath" . }} + {{- end }} + - name: staging + {{- if .Values.emptyDirVolumes }} + emptyDir: {} + {{- else }} + hostPath: + path: {{ template "configuredStagingHostPath" . }} + {{- end }} diff --git a/charts/ipfs/1.0.0/templates/service.yaml b/charts/ipfs/1.0.0/templates/service.yaml new file mode 100644 index 0000000000..9039bbb7a5 --- /dev/null +++ b/charts/ipfs/1.0.0/templates/service.yaml @@ -0,0 +1,21 @@ +{{ $scheme := "http" }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "ipfs.fullname" . }} + labels: + app: {{ template "ipfs.name" . }} + chart: {{ template "ipfs.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: "NodePort" + ports: + - name: {{ $scheme }} + port: {{ .Values.service.nodePort }} + protocol: TCP + nodePort: {{ .Values.service.nodePort }} + targetPort: 9080 + selector: + app: {{ template "ipfs.name" . }} + release: {{ .Release.Name }} diff --git a/charts/ipfs/1.0.0/templates/serviceaccount.yaml b/charts/ipfs/1.0.0/templates/serviceaccount.yaml new file mode 100644 index 0000000000..05d1db5bbe --- /dev/null +++ b/charts/ipfs/1.0.0/templates/serviceaccount.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ipfs.serviceAccountName" . | quote }} + namespace: {{ .Release.Namespace | quote }} + labels: + app: {{ template "ipfs.name" . }} + chart: {{ template "ipfs.chart" . }} + release: "{{ .Release.Name }}" diff --git a/charts/ipfs/1.0.0/test_values.yaml b/charts/ipfs/1.0.0/test_values.yaml new file mode 100644 index 0000000000..4239f4bdb1 --- /dev/null +++ b/charts/ipfs/1.0.0/test_values.yaml @@ -0,0 +1,18 @@ +## Set default image, imageTag, and imagePullPolicy. mode is used to indicate the +## +image: + repository: ipfs/go-ipfs + tag: v0.8.0-rc1 + pullPolicy: IfNotPresent + +## Additional arguments to pass to minio binary +extraArgs: [] + +updateStrategy: RollingUpdate + +service: + nodePort: 9080 + +environment: + +emptyDirVolumes: true diff --git a/charts/ipfs/1.0.0/values.yaml b/charts/ipfs/1.0.0/values.yaml new file mode 100644 index 0000000000..e30aa32195 --- /dev/null +++ b/charts/ipfs/1.0.0/values.yaml @@ -0,0 +1,16 @@ +## Set default image, imageTag, and imagePullPolicy. mode is used to indicate the +## +image: + repository: ipfs/go-ipfs + tag: v0.8.0-rc1 + pullPolicy: IfNotPresent + +## Additional arguments to pass to ipfs binary +extraArgs: [] + +updateStrategy: RollingUpdate + +service: + nodePort: 9080 + +environment: diff --git a/charts/ipfs/item.yaml b/charts/ipfs/item.yaml new file mode 100644 index 0000000000..725026bfb1 --- /dev/null +++ b/charts/ipfs/item.yaml @@ -0,0 +1,3 @@ +categories: + - storage +icon_url: https://ipfs.io/ipfs/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/ipfs.go.png From e5a7976ba5a4c2472ba4af03acd7200eef057c88 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Sat, 23 Jan 2021 11:21:58 -0500 Subject: [PATCH 02/11] Update ipfs chart, works on fresh install now, and on restart. Enables setting options on each startup so that the WebUI is functional --- charts/ipfs/1.0.0/questions.yaml | 38 +++++++-- charts/ipfs/1.0.0/templates/_storage.tpl | 4 +- charts/ipfs/1.0.0/templates/deployment.yaml | 91 ++++++++++++++++++--- charts/ipfs/1.0.0/templates/service.yaml | 18 +++- charts/ipfs/1.0.0/test_values.yaml | 9 +- charts/ipfs/1.0.0/values.yaml | 9 +- 6 files changed, 139 insertions(+), 30 deletions(-) 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 From 556bd1d7f52dcea5537bd43a9c7a5a8f1df43d2a Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Sat, 23 Jan 2021 11:38:08 -0500 Subject: [PATCH 03/11] Fix a bug when using non host mounts --- charts/ipfs/1.0.0/templates/_storage.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/ipfs/1.0.0/templates/_storage.tpl b/charts/ipfs/1.0.0/templates/_storage.tpl index fb9be148db..994f15f661 100644 --- a/charts/ipfs/1.0.0/templates/_storage.tpl +++ b/charts/ipfs/1.0.0/templates/_storage.tpl @@ -1,7 +1,7 @@ {{/* Retrieve host path from ix volumes based on dataset name */}} -{{- define "retrieveDataPathFromiXVolume" -}} +{{- define "retrieveHostPathFromiXVolume" -}} {{- range $index, $hostPathConfiguration := $.ixVolumes }} {{- $dsName := base $hostPathConfiguration.hostPath -}} {{- if eq $.datasetName $dsName -}} From da3cecaa3f04c8d7714480fbad2cd6bb380bdd22 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Sat, 23 Jan 2021 12:59:26 -0500 Subject: [PATCH 04/11] Make CI happy --- charts/ipfs/1.0.0/templates/deployment.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/ipfs/1.0.0/templates/deployment.yaml b/charts/ipfs/1.0.0/templates/deployment.yaml index 2496d13269..78db80cf12 100644 --- a/charts/ipfs/1.0.0/templates/deployment.yaml +++ b/charts/ipfs/1.0.0/templates/deployment.yaml @@ -109,16 +109,16 @@ spec: {{- end}} volumes: - name: data - {{- if ne (include "configuredHostPathData" .) "" }} + {{- if .Values.emptyDirVolumes }} + emptyDir: {} + {{- else }} hostPath: path: {{ template "configuredHostPathData" . }} - {{- else }} - emptyDir: {} {{- end }} - name: staging - {{- if ne (include "configuredHostPathStaging" .) "" }} + {{- if .Values.emptyDirVolumes }} + emptyDir: {} + {{- else }} hostPath: path: {{ template "configuredHostPathStaging" . }} - {{- else }} - emptyDir: {} {{- end }} From 1e333b07cd056f60b3eb518ff66375745d16c71b Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Sat, 23 Jan 2021 13:02:40 -0500 Subject: [PATCH 05/11] Use acceptable port range for testing... --- charts/ipfs/1.0.0/test_values.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/ipfs/1.0.0/test_values.yaml b/charts/ipfs/1.0.0/test_values.yaml index e84aed331a..7bf4c7840b 100644 --- a/charts/ipfs/1.0.0/test_values.yaml +++ b/charts/ipfs/1.0.0/test_values.yaml @@ -11,9 +11,9 @@ extraArgs: [] updateStrategy: Recreate service: - swarmPort: 9401 - apiPort: 9501 - gatewayPort: 9080 + swarmPort: 30941 + apiPort: 30951 + gatewayPort: 30980 environment: From 66f4846665bc9a1792935e75df6c1fdd0243079b Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Sat, 23 Jan 2021 18:24:15 -0500 Subject: [PATCH 06/11] Small performance improvement. No need to chown the entire directory after the first init. --- charts/ipfs/1.0.0/templates/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/ipfs/1.0.0/templates/deployment.yaml b/charts/ipfs/1.0.0/templates/deployment.yaml index 78db80cf12..fed49db153 100644 --- a/charts/ipfs/1.0.0/templates/deployment.yaml +++ b/charts/ipfs/1.0.0/templates/deployment.yaml @@ -26,7 +26,7 @@ spec: 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'] + command: ['/bin/sh', '-c', '[ ! -e /data/ipfs/config ] && (/usr/local/bin/ipfs init ; chown -R 1000:100 /data/ipfs) ; exit 0'] imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: data @@ -80,7 +80,7 @@ spec: mountPath: /export - name: init-chown image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - command: ['chown', '-R', '1000:100', '/data/ipfs'] + command: ['chown', '1000:100', '/data/ipfs/config'] imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: data From 08cb423c92ba99590c055af8276ba81413cffda6 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Mon, 25 Jan 2021 09:08:50 -0500 Subject: [PATCH 07/11] Switch to list type for Environment, so that UI can render properly --- charts/ipfs/1.0.0/questions.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/charts/ipfs/1.0.0/questions.yaml b/charts/ipfs/1.0.0/questions.yaml index 5348c1b7c0..6bba2062d4 100644 --- a/charts/ipfs/1.0.0/questions.yaml +++ b/charts/ipfs/1.0.0/questions.yaml @@ -71,9 +71,24 @@ questions: label: "IPFS image environment" group: "IPFS Configuration" schema: - type: dict - additional_attrs: true - attrs: [] + type: list + default: [] + items: + - variable: environmentVariable + label: "Environment Variable" + schema: + type: dict + attrs: + - variable: name + label: "Name" + schema: + type: string + required: true + - variable: value + label: "Value" + schema: + type: string + required: true - variable: service description: "IPFS Service Configuration" From cdadc841de34464b275b95f1aa8ad81935e57251 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Mon, 25 Jan 2021 09:10:42 -0500 Subject: [PATCH 08/11] Cleanup some old leftovers in the README --- charts/ipfs/1.0.0/README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/charts/ipfs/1.0.0/README.md b/charts/ipfs/1.0.0/README.md index 8b158db531..d6bdd49a12 100755 --- a/charts/ipfs/1.0.0/README.md +++ b/charts/ipfs/1.0.0/README.md @@ -17,12 +17,6 @@ The following table lists the configurable parameters of the IPFS chart and thei | Parameter | Description | Default | |:-------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------| | `image.repository` | Image repository | `ipfs/go-ipfs` | -| `image.tag` | MinIO image tag. Possible values listed [here](https://hub.docker.com/r/ipfs/go-ipfs/tags). | `v0.8.0-rc1` | +| `image.tag` | IPFS image tag. Possible values listed [here](https://hub.docker.com/r/ipfs/go-ipfs/tags). | `v0.8.0-rc1` | | `image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `extraArgs` | Additional command line arguments to pass to the IPFS server | `[]` | -| `persistence.enabled` | Use persistent volume to store data | `true` | -| `persistence.size` | Size of persistent volume claim | `500Gi` | -| `persistence.existingClaim` | Use an existing PVC to persist data | `nil` | -| `persistence.storageClass` | Storage class name of PVC | `nil` | -| `persistence.accessMode` | ReadWriteOnce or ReadOnly | `ReadWriteOnce` | -| `persistence.subPath` | Mount a sub directory of the persistent volume if set | `""` | +| `extraArgs` | Additional command line arguments to pass to the IPFS server | `[]` | From 1ed68b60b693358c8188be2ff60e9c41f9e2e473 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Mon, 25 Jan 2021 09:12:00 -0500 Subject: [PATCH 09/11] Fix up NOTES.txt to show proper webui link --- charts/ipfs/1.0.0/templates/NOTES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/ipfs/1.0.0/templates/NOTES.txt b/charts/ipfs/1.0.0/templates/NOTES.txt index 88e8e93ef8..cb1d892a3b 100644 --- a/charts/ipfs/1.0.0/templates/NOTES.txt +++ b/charts/ipfs/1.0.0/templates/NOTES.txt @@ -1,2 +1,2 @@ -Minio can be accessed from the following URL: -http://$node_ip:{{ .Values.service.nodePort }}/ +IPFS can be accessed from the following URL: +http://$node_ip:{{ .Values.service.apiPort }}/webui From 18086737bd316aab5b60d67dccb870ccf2351cd9 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Mon, 25 Jan 2021 09:13:49 -0500 Subject: [PATCH 10/11] Get rid of some unneeded API version checks, remove extraArgs which we ended up not using --- charts/ipfs/1.0.0/templates/_helpers.tpl | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/charts/ipfs/1.0.0/templates/_helpers.tpl b/charts/ipfs/1.0.0/templates/_helpers.tpl index 800e260911..3324203697 100644 --- a/charts/ipfs/1.0.0/templates/_helpers.tpl +++ b/charts/ipfs/1.0.0/templates/_helpers.tpl @@ -35,23 +35,15 @@ Create chart name and version as used by the chart label. Return the appropriate apiVersion for deployment. */}} {{- define "ipfs.deployment.apiVersion" -}} -{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.Version -}} -{{- print "apps/v1beta2" -}} -{{- else -}} {{- print "apps/v1" -}} {{- end -}} -{{- end -}} {{/* Return the appropriate apiVersion for statefulset. */}} {{- define "ipfs.statefulset.apiVersion" -}} -{{- if semverCompare "<1.17-0" .Capabilities.KubeVersion.Version -}} -{{- print "apps/v1beta2" -}} -{{- else -}} {{- print "apps/v1" -}} {{- end -}} -{{- end -}} {{/* Determine secret name. @@ -73,12 +65,3 @@ Determine name for scc role and rolebinding {{- define "ipfs.sccRoleName" -}} {{- printf "%s-%s" "scc" (include "ipfs.fullname" .) | trunc 63 | trimSuffix "-" -}} {{- end -}} - -{{/* -Properly format optional additional arguments to IPFS binary -*/}} -{{- define "ipfs.extraArgs" -}} -{{- range .Values.extraArgs -}} -{{ " " }}{{ . }} -{{- end -}} -{{- end -}} From a0363dcb40ddeb91ee7a49a404f2469c30e4f157 Mon Sep 17 00:00:00 2001 From: Kris Moore Date: Mon, 25 Jan 2021 09:18:53 -0500 Subject: [PATCH 11/11] Move ipfs to 'test' train --- {charts => test}/ipfs/1.0.0/.helmignore | 0 {charts => test}/ipfs/1.0.0/Chart.yaml | 0 {charts => test}/ipfs/1.0.0/README.md | 0 {charts => test}/ipfs/1.0.0/app-readme.md | 0 {charts => test}/ipfs/1.0.0/questions.yaml | 0 {charts => test}/ipfs/1.0.0/templates/NOTES.txt | 0 {charts => test}/ipfs/1.0.0/templates/_helpers.tpl | 0 {charts => test}/ipfs/1.0.0/templates/_storage.tpl | 0 {charts => test}/ipfs/1.0.0/templates/deployment.yaml | 0 {charts => test}/ipfs/1.0.0/templates/service.yaml | 0 {charts => test}/ipfs/1.0.0/templates/serviceaccount.yaml | 0 {charts => test}/ipfs/1.0.0/test_values.yaml | 0 {charts => test}/ipfs/1.0.0/values.yaml | 0 {charts => test}/ipfs/item.yaml | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename {charts => test}/ipfs/1.0.0/.helmignore (100%) rename {charts => test}/ipfs/1.0.0/Chart.yaml (100%) rename {charts => test}/ipfs/1.0.0/README.md (100%) rename {charts => test}/ipfs/1.0.0/app-readme.md (100%) rename {charts => test}/ipfs/1.0.0/questions.yaml (100%) rename {charts => test}/ipfs/1.0.0/templates/NOTES.txt (100%) rename {charts => test}/ipfs/1.0.0/templates/_helpers.tpl (100%) rename {charts => test}/ipfs/1.0.0/templates/_storage.tpl (100%) rename {charts => test}/ipfs/1.0.0/templates/deployment.yaml (100%) rename {charts => test}/ipfs/1.0.0/templates/service.yaml (100%) rename {charts => test}/ipfs/1.0.0/templates/serviceaccount.yaml (100%) rename {charts => test}/ipfs/1.0.0/test_values.yaml (100%) rename {charts => test}/ipfs/1.0.0/values.yaml (100%) rename {charts => test}/ipfs/item.yaml (100%) diff --git a/charts/ipfs/1.0.0/.helmignore b/test/ipfs/1.0.0/.helmignore similarity index 100% rename from charts/ipfs/1.0.0/.helmignore rename to test/ipfs/1.0.0/.helmignore diff --git a/charts/ipfs/1.0.0/Chart.yaml b/test/ipfs/1.0.0/Chart.yaml similarity index 100% rename from charts/ipfs/1.0.0/Chart.yaml rename to test/ipfs/1.0.0/Chart.yaml diff --git a/charts/ipfs/1.0.0/README.md b/test/ipfs/1.0.0/README.md similarity index 100% rename from charts/ipfs/1.0.0/README.md rename to test/ipfs/1.0.0/README.md diff --git a/charts/ipfs/1.0.0/app-readme.md b/test/ipfs/1.0.0/app-readme.md similarity index 100% rename from charts/ipfs/1.0.0/app-readme.md rename to test/ipfs/1.0.0/app-readme.md diff --git a/charts/ipfs/1.0.0/questions.yaml b/test/ipfs/1.0.0/questions.yaml similarity index 100% rename from charts/ipfs/1.0.0/questions.yaml rename to test/ipfs/1.0.0/questions.yaml diff --git a/charts/ipfs/1.0.0/templates/NOTES.txt b/test/ipfs/1.0.0/templates/NOTES.txt similarity index 100% rename from charts/ipfs/1.0.0/templates/NOTES.txt rename to test/ipfs/1.0.0/templates/NOTES.txt diff --git a/charts/ipfs/1.0.0/templates/_helpers.tpl b/test/ipfs/1.0.0/templates/_helpers.tpl similarity index 100% rename from charts/ipfs/1.0.0/templates/_helpers.tpl rename to test/ipfs/1.0.0/templates/_helpers.tpl diff --git a/charts/ipfs/1.0.0/templates/_storage.tpl b/test/ipfs/1.0.0/templates/_storage.tpl similarity index 100% rename from charts/ipfs/1.0.0/templates/_storage.tpl rename to test/ipfs/1.0.0/templates/_storage.tpl diff --git a/charts/ipfs/1.0.0/templates/deployment.yaml b/test/ipfs/1.0.0/templates/deployment.yaml similarity index 100% rename from charts/ipfs/1.0.0/templates/deployment.yaml rename to test/ipfs/1.0.0/templates/deployment.yaml diff --git a/charts/ipfs/1.0.0/templates/service.yaml b/test/ipfs/1.0.0/templates/service.yaml similarity index 100% rename from charts/ipfs/1.0.0/templates/service.yaml rename to test/ipfs/1.0.0/templates/service.yaml diff --git a/charts/ipfs/1.0.0/templates/serviceaccount.yaml b/test/ipfs/1.0.0/templates/serviceaccount.yaml similarity index 100% rename from charts/ipfs/1.0.0/templates/serviceaccount.yaml rename to test/ipfs/1.0.0/templates/serviceaccount.yaml diff --git a/charts/ipfs/1.0.0/test_values.yaml b/test/ipfs/1.0.0/test_values.yaml similarity index 100% rename from charts/ipfs/1.0.0/test_values.yaml rename to test/ipfs/1.0.0/test_values.yaml diff --git a/charts/ipfs/1.0.0/values.yaml b/test/ipfs/1.0.0/values.yaml similarity index 100% rename from charts/ipfs/1.0.0/values.yaml rename to test/ipfs/1.0.0/values.yaml diff --git a/charts/ipfs/item.yaml b/test/ipfs/item.yaml similarity index 100% rename from charts/ipfs/item.yaml rename to test/ipfs/item.yaml