WIP of adding IPFS chart

This commit is contained in:
Kris Moore
2021-01-22 14:52:06 -05:00
parent 5a1cee4cec
commit 96b8da5fb0
14 changed files with 471 additions and 0 deletions

View File

@@ -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

View File

@@ -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

28
charts/ipfs/1.0.0/README.md Executable file
View File

@@ -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 | `""` |

View File

@@ -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.

View File

@@ -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

View File

@@ -0,0 +1,2 @@
Minio can be accessed from the following URL:
http://$node_ip:{{ .Values.service.nodePort }}/

View File

@@ -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 -}}

View File

@@ -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 -}}

View File

@@ -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 }}

View File

@@ -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 }}

View File

@@ -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 }}"

View File

@@ -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

View File

@@ -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:

3
charts/ipfs/item.yaml Normal file
View File

@@ -0,0 +1,3 @@
categories:
- storage
icon_url: https://ipfs.io/ipfs/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/ipfs.go.png