Add IPFS Chart (#1192)

This commit is contained in:
Yuvi Panda
2017-07-11 21:56:14 +02:00
committed by Reinhard Nägele
parent 1abf42f3ed
commit a78cbd1bbf
8 changed files with 261 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
# 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
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
description: A Helm chart for the Interplanetary File System
name: ipfs
version: 0.1.0
icon: https://raw.githubusercontent.com/ipfs/logo/master/raster-generated/ipfs-logo-128-ice-text.png
home: https://ipfs.io/
keywords:
- ipfs
- distributed-web
sources:
- https://github.com/ipfs/go-ipfs
maintainers:
- name: Yuvi Panda
email: yuvipanda@gmail.com
+68
View File
@@ -0,0 +1,68 @@
# IPFS
> [IPFS](https://ipfs.io/) is a part of the distributed web - a peer-to-peer hypermedia protocol to make the web faster, safer, and more open.
## TL;DR;
```bash
$ helm install stable/ipfs
```
## Introduction
This chart bootstraps a [IPFS](https://ipfs.io) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
$ helm install --name my-release stable/ipfs
```
The command deploys IPFS on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
> **Tip**: List all releases using `helm list`
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```bash
$ helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The following tables lists the configurable parameters of the Memcached chart and their default values.
| Parameter | Description | Default |
|-----------|-------------|---------|
| `replicaCount` | The number of replicas of go-ipfs to run | 1 |
| `service.type` | Type of the service: `ClusterIP`, `LoadBalancer` or `NodePort` | `ClusterIP` |
| `service.nameOverride` | The name to use for the service | The full name of the release |
| `persistence.enabled` | Turn on persistent storage for the IPFS data directory | `true` |
| `persistence.storageClass` | StorageClass to set for the persistent volume claim. | The default storageclass in the cluster|
| `persistence.annotations` | Extra annotations for the persistent volume claim. | `{}` |
| `persistence.accessModes` | List of access modes for use with the persistent volume claim | `["ReadWriteOnce"]` |
| `persistence.size` | Size of the PVC for each IPFS pod, used as persistent cache | `8Gi` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install --name my-release \
--set storage.size="20Gi" \
stable/ipfs
```
The above command sets the disk size to 20Gi.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
$ helm install --name my-release -f values.yaml stable/ipfs
```
> **Tip**: You can use the default [values.yaml](values.yaml) as a base for customization.
+26
View File
@@ -0,0 +1,26 @@
You have successfully installed IPFS in your kubernetes cluster!
You can access the IPFS API from inside your cluster by connecting to port 5001 on
{{ template "servicename" . }}.{{ .Release.Namespace }}
You can also connect to port 8080 on the same hostname for talking to the IPFS Gateway.
If you want to connect to it from your local computer, you can find a URL to connect with the
following (for the gateway service):
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "servicename" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "servicename" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "Use the API Gateway by accessing http://$SERVICE_IP:8080/ipfs/<IPFS-HASH>"
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Use the API Gateway by accessing http://localhost:8080/ipfs/<IPFS-HASH>"
kubectl --namespace {{ .Release.Namespace}} port-forward $POD_NAME 8080:8080
{{- end }}
+31
View File
@@ -0,0 +1,31 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "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).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a name for the service to use.
We allow overrides for name of service, since this service provides an API that could be directly
called by end-users. For example, you could call it 'ipfs' and then all users running in a namespace
could just connect to it by specifying 'ipfs'.
*/}}
{{- define "servicename" -}}
{{- if .Values.service.nameOverride -}}
{{- .Values.service.nameOverride -}}
{{- else -}}
{{- template "fullname" . }}
{{- end -}}
{{- end -}}
+22
View File
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "servicename" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
type: {{ .Values.service.type }}
ports:
- port: 5001
targetPort: 5001
protocol: TCP
name: api
- port: 8080
targetPort: 8080
name: gateway
selector:
app: {{ template "name" . }}
release: {{ .Release.Name }}
+65
View File
@@ -0,0 +1,65 @@
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ template "servicename" . }}
template:
metadata:
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
securityContext:
# The image runs as uid 1000 by default, and needs to be able to write to
# the persistent volume to be able to start.
fsGroup: 1000
runAsUser: 1000
containers:
- name: {{ .Chart.Name }}
image: {{ .Values.image }}
ports:
- containerPort: 5001
name: api
- containerPort: 8080
name: gateway
volumeMounts:
- name: ipfs-storage
mountPath: /data/ipfs
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: ipfs-storage
annotations:
{{- if .Values.persistence.storageClass | quote }}
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
{{- else }}
volume.alpha.kubernetes.io/storage-class: default
{{- end }}
{{- range $key, $value := .Values.persistence.annotations }}
{{ $key }}: {{ $value }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- else }}
volumes:
- name: ipfs-storage
emptyDir: {}
{{- end }}
+14
View File
@@ -0,0 +1,14 @@
replicaCount: 1
image: ipfs/go-ipfs:v0.4.9
service:
type: ClusterIP
resources: {}
persistence:
enabled: true
size: "8Gi"
accessModes:
- ReadWriteOnce