diff --git a/test/ipfs/1.0.0/.helmignore b/test/ipfs/1.0.0/.helmignore new file mode 100644 index 0000000000..a9fe727881 --- /dev/null +++ b/test/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/test/ipfs/1.0.0/Chart.yaml b/test/ipfs/1.0.0/Chart.yaml new file mode 100644 index 0000000000..9cbe207526 --- /dev/null +++ b/test/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/test/ipfs/1.0.0/README.md b/test/ipfs/1.0.0/README.md new file mode 100755 index 0000000000..d6bdd49a12 --- /dev/null +++ b/test/ipfs/1.0.0/README.md @@ -0,0 +1,22 @@ +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` | 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 | `[]` | diff --git a/test/ipfs/1.0.0/app-readme.md b/test/ipfs/1.0.0/app-readme.md new file mode 100644 index 0000000000..dc481d47c8 --- /dev/null +++ b/test/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/test/ipfs/1.0.0/questions.yaml b/test/ipfs/1.0.0/questions.yaml new file mode 100644 index 0000000000..6bba2062d4 --- /dev/null +++ b/test/ipfs/1.0.0/questions.yaml @@ -0,0 +1,197 @@ +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: + protocols: + - "http" + host: + - "$node_ip" + ports: + - "$variable-service.apiPort" + path: "/webui" + +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: "Recreate" + 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: 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" + label: "IPFS Service Configuration" + group: "IPFS Configuration" + schema: + type: dict + required: true + attrs: + - variable: swarmPort + label: "Swarm Port to use for IPFS (Public)" + schema: + type: int + min: 4000 + max: 65535 + 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" + 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 data" + group: "Storage" + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: ipfsStagingHostPath + label: "Specify HostPath for IPFS staging data" + 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/test/ipfs/1.0.0/templates/NOTES.txt b/test/ipfs/1.0.0/templates/NOTES.txt new file mode 100644 index 0000000000..cb1d892a3b --- /dev/null +++ b/test/ipfs/1.0.0/templates/NOTES.txt @@ -0,0 +1,2 @@ +IPFS can be accessed from the following URL: +http://$node_ip:{{ .Values.service.apiPort }}/webui diff --git a/test/ipfs/1.0.0/templates/_helpers.tpl b/test/ipfs/1.0.0/templates/_helpers.tpl new file mode 100644 index 0000000000..3324203697 --- /dev/null +++ b/test/ipfs/1.0.0/templates/_helpers.tpl @@ -0,0 +1,67 @@ +{{/* 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" -}} +{{- print "apps/v1" -}} +{{- end -}} + +{{/* +Return the appropriate apiVersion for statefulset. +*/}} +{{- define "ipfs.statefulset.apiVersion" -}} +{{- print "apps/v1" -}} +{{- 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 -}} diff --git a/test/ipfs/1.0.0/templates/_storage.tpl b/test/ipfs/1.0.0/templates/_storage.tpl new file mode 100644 index 0000000000..994f15f661 --- /dev/null +++ b/test/ipfs/1.0.0/templates/_storage.tpl @@ -0,0 +1,35 @@ +{{/* +Retrieve host path from ix volumes based on dataset name +*/}} +{{- define "retrieveHostPathFromiXVolume" -}} +{{- range $index, $hostPathConfiguration := $.ixVolumes }} +{{- $dsName := base $hostPathConfiguration.hostPath -}} +{{- if eq $.datasetName $dsName -}} +{{- $hostPathConfiguration.hostPath -}} +{{- end -}} +{{- end }} +{{- end -}} + +{{/* +Retrieve host path for ipfs +*/}} +{{- define "configuredHostPathData" -}} +{{- 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 "configuredHostPathStaging" -}} +{{- if .Values.ipfsStagingHostPathEnabled -}} +{{- .Values.ipfsStagingHostPath -}} +{{- else -}} +{{- $volDict := dict "datasetName" $.Values.ipfsStagingVolume.datasetName "ixVolumes" $.Values.ixVolumes -}} +{{- include "retrieveHostPathFromiXVolume" $volDict -}} +{{- end -}} +{{- end -}} diff --git a/test/ipfs/1.0.0/templates/deployment.yaml b/test/ipfs/1.0.0/templates/deployment.yaml new file mode 100644 index 0000000000..fed49db153 --- /dev/null +++ b/test/ipfs/1.0.0/templates/deployment.yaml @@ -0,0 +1,124 @@ +{{ $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 }} + initContainers: + - name: init-init + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + 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 + 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', '1000:100', '/data/ipfs/config'] + 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 + - name: staging + mountPath: /export + ports: + - 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 }} + hostPath: + path: {{ template "configuredHostPathData" . }} + {{- end }} + - name: staging + {{- if .Values.emptyDirVolumes }} + emptyDir: {} + {{- else }} + hostPath: + path: {{ template "configuredHostPathStaging" . }} + {{- end }} diff --git a/test/ipfs/1.0.0/templates/service.yaml b/test/ipfs/1.0.0/templates/service.yaml new file mode 100644 index 0000000000..ad352427e8 --- /dev/null +++ b/test/ipfs/1.0.0/templates/service.yaml @@ -0,0 +1,31 @@ +{{ $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: swarm + port: {{ .Values.service.swarmPort }} + protocol: TCP + 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/test/ipfs/1.0.0/templates/serviceaccount.yaml b/test/ipfs/1.0.0/templates/serviceaccount.yaml new file mode 100644 index 0000000000..05d1db5bbe --- /dev/null +++ b/test/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/test/ipfs/1.0.0/test_values.yaml b/test/ipfs/1.0.0/test_values.yaml new file mode 100644 index 0000000000..7bf4c7840b --- /dev/null +++ b/test/ipfs/1.0.0/test_values.yaml @@ -0,0 +1,23 @@ +## 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: Recreate + +service: + swarmPort: 30941 + apiPort: 30951 + gatewayPort: 30980 + +environment: + +emptyDirVolumes: true + +ipfsDataHostPathEnabled: false +ipfsStagingHostPathEnabled: false diff --git a/test/ipfs/1.0.0/values.yaml b/test/ipfs/1.0.0/values.yaml new file mode 100644 index 0000000000..6c0c07c715 --- /dev/null +++ b/test/ipfs/1.0.0/values.yaml @@ -0,0 +1,21 @@ +## 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: Recreate + +service: + swarmPort: 9401 + apiPort: 9501 + gatewayPort: 9080 + +environment: + +ipfsDataHostPathEnabled: false +ipfsStagingHostPathEnabled: false diff --git a/test/ipfs/item.yaml b/test/ipfs/item.yaml new file mode 100644 index 0000000000..725026bfb1 --- /dev/null +++ b/test/ipfs/item.yaml @@ -0,0 +1,3 @@ +categories: + - storage +icon_url: https://ipfs.io/ipfs/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/ipfs.go.png