Merge pull request #7 from steigr/feature/helm-chart

Added helm-chart
This commit is contained in:
Björn Busse 2018-03-14 03:33:03 +01:00 committed by GitHub
commit aa326013c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 207 additions and 0 deletions

21
charts/goircd/.helmignore Normal file
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

5
charts/goircd/Chart.yaml Normal file
View File

@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: minimalistic simple Internet Relay Chat (IRC) server
name: goircd
version: 0.1.0

View File

@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "goircd.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 "goircd.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "goircd.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "goircd.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit irc://127.0.0.1:6667 to use your application"
kubectl port-forward $POD_NAME 6667:6667
{{- end }}

View File

@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "goircd.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 "goircd.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 "goircd.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "goircd.fullname" . }}
data:
BIND: ":{{ .Values.service.internalPort }}"
HEALTHCHECK: {{ .Values.config.healthcheck | quote }}
HOSTNAME: {{ .Values.config.hostname | quote }}
METRICS: {{ .Values.config.metrics | quote }}
MOTD: |
{{ .Values.config.motd }}

View File

@ -0,0 +1,67 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "goircd.fullname" . }}
labels:
app: {{ template "goircd.name" . }}
chart: {{ template "goircd.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "goircd.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "goircd.name" . }}
release: {{ .Release.Name }}
spec:
volumes:
- name: config
configMap:
name: {{ template "goircd.fullname" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- -motd
- /config/MOTD
envFrom:
- configMapRef:
name: {{ template "goircd.fullname" . }}
volumeMounts:
- name: config
mountPath: /config
ports:
- name: irc
containerPort: {{ .Values.service.internalPort }}
protocol: TCP
- name: health
containerPort: {{ .Values.image.healthcheckPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /live
port: health
readinessProbe:
httpGet:
path: /ready
port: health
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "goircd.fullname" . }}
labels:
app: {{ template "goircd.name" . }}
chart: {{ template "goircd.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.externalPort }}
targetPort: irc
protocol: TCP
name: irc
selector:
app: {{ template "goircd.name" . }}
release: {{ .Release.Name }}

37
charts/goircd/values.yaml Normal file
View File

@ -0,0 +1,37 @@
# Default values for goircd.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
config:
healthcheck: true
hostname: irc.example.com
metrics: true
motd: |
Hello kubernetes with helm
image:
repository: quay.io/goircd/goircd
tag: latest
pullPolicy: IfNotPresent
healthcheckPort: 8086
service:
type: ClusterIP
internalPort: 6667
externalPort: 6967
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi
nodeSelector: {}
tolerations: []
affinity: {}