initial helm package

This commit is contained in:
Jimmy Zelinskie 2016-11-28 12:58:27 -05:00
parent baef1c17c3
commit a48b9a50c3
8 changed files with 163 additions and 0 deletions

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

10
contrib/helm/chihaya/Chart.yaml Executable file
View file

@ -0,0 +1,10 @@
apiVersion: v1
name: chihaya
home: https://chihaya.io
version: 0.1.0
description: A Helm chart for running the Chihaya BitTorrent tracker on Kubernetes.
sources:
- https://github.com/chihaya/chihaya
maintainers:
- name: Jimmy Zelinskie
email: jimmyzelinskie@gmail.com

View file

@ -0,0 +1,6 @@
You can port forward a local port to Prometheus or the HTTP tracker by running:
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
# Prometheus port
kubectl port-forward $POD_NAME 8080:{{ $v := .Values.config.chihaya.prometheus_addr | split ":" }}{{ $v._1 }}
# HTTP tracker port
kubectl port-forward $POD_NAME 8080:{{ $v := .Values.config.chihaya.http.addr | split ":" }}{{ $v._1 }}

View file

@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 24 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 24 -}}
{{- end -}}

View file

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
data:
config.yaml: |
{{ toYaml .Values.config | indent 4 }}

View file

@ -0,0 +1,41 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
replicas: {{ .Values.replicaCount }}
template:
metadata:
labels:
app: {{ template "fullname" . }}
spec:
volumes:
- name: config
configMap:
name: {{ template "fullname" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "--config=/etc/chihaya/config.yaml"
ports:
- name: bittorrent-http
containerPort: {{ $v := .Values.config.chihaya.http.addr | split ":" }}{{ $v._1 }}
protocol: TCP
- name: bittorrent-udp
containerPort: {{ $v := .Values.config.chihaya.udp.addr | split ":" }}{{ $v._1 }}
protocol: UDP
- name: metrics
containerPort: {{ $v := .Values.config.chihaya.prometheus_addr | split ":" }}{{ $v._1 }}
livenessProbe:
httpGet:
path: /
port: {{ $v := .Values.config.chihaya.prometheus_addr | split ":" }}{{ $v._1 }}
volumeMounts:
- name: config
mountPath: /etc/chihaya
resources:
{{ toYaml .Values.resources | indent 10 }}

View file

@ -0,0 +1,27 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/"
prometheus.io/port: {{ $v := .Values.config.chihaya.prometheus_addr | split ":" }}{{ $v._1 | quote }}
spec:
type: {{ .Values.service.type }}
ports:
- name: bittorrent-http
port: {{ $v := .Values.config.chihaya.http.addr | split ":" }}{{ $v._1 }}
targetPort: {{ $v := .Values.config.chihaya.http.addr | split ":" }}{{ $v._1 }}
protocol: TCP
- name: bittorrent-udp
port: {{ $v := .Values.config.chihaya.udp.addr | split ":" }}{{ $v._1 }}
targetPort: {{ $v := .Values.config.chihaya.udp.addr | split ":" }}{{ $v._1 }}
protocol: UDP
- name: metrics
port: {{ $v := .Values.config.chihaya.prometheus_addr | split ":" }}{{ $v._1 }}
targetPort: {{ $v := .Values.config.chihaya.prometheus_addr | split ":" }}{{ $v._1 }}
protocol: TCP
selector:
app: {{ template "fullname" . }}

View file

@ -0,0 +1,33 @@
replicaCount: 1
image:
repository: quay.io/jzelinskie/chihaya
tag: v2.0.0-rc.1
pullPolicy: IfNotPresent
service:
name: chihaya
type: ClusterIP
resources:
limits:
cpu: 100m
memory: 1Gi
config:
chihaya:
announce_interval: 15m
prometheus_addr: 0.0.0.0:6880
http:
addr: 0.0.0.0:6881
allow_ip_spoofing: true
real_ip_header: X-Forwarded-For
read_timeout: 5s
write_timeout: 5s
request_timeout: 5s
udp:
addr: 0.0.0.0:6881
allow_ip_spoofing: true
max_clock_skew: 10s
private_key: "/K8AybyuKkob03fZJb+3Fu87eVcBNWsvVyDDxGd3wfvVGix10j6iGDEyS/ELPvQIIZvUPl2PnyfnpG6g1YJ/sw=="
storage:
gc_interval: 14m
peer_lifetime: 15m
shards: 16
max_numwant: 50