Skip to content

Commit

Permalink
🧁 Feature/etherpad 🧁 (#31)
Browse files Browse the repository at this point in the history
* πŸ₯ add etherpad chart πŸ₯
* πŸ₯ linting πŸ₯
  • Loading branch information
eformat authored Apr 24, 2020
1 parent e52f7de commit d7f1b2c
Show file tree
Hide file tree
Showing 9 changed files with 323 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/etherpad/.helmignore
Original file line number Diff line number Diff line change
@@ -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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions charts/etherpad/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: etherpad
description: A Helm chart for etherpad lite
type: application
version: 0.0.1
appVersion: latest
home: https://github.com/rht-labs/helm-charts
maintainers:
- name: eformat
52 changes: 52 additions & 0 deletions charts/etherpad/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "etherpad.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 "etherpad.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 "etherpad.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "etherpad.labels" -}}
helm.sh/chart: {{ include "etherpad.chart" . }}
{{ include "etherpad.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "etherpad.selectorLabels" -}}
app.kubernetes.io/name: {{ include "etherpad.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
70 changes: 70 additions & 0 deletions charts/etherpad/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "etherpad.fullname" . }}
labels:
{{- include "etherpad.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "etherpad.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "etherpad.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- env:
- name: TITLE
value: {{ .Values.defaultTitle }}
- name: DEFAULT_PAD_TEXT
value: {{ .Values.defaultText }}
name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}/{{ .Chart.Name }}:{{ .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 9001
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: etherpad-data
mountPath: {{ .Values.persistence.mountPath }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: etherpad-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (printf "%s" (include "etherpad.fullname" .)) }}
{{- else }}
emptyDir: {}
{{- end }}
41 changes: 41 additions & 0 deletions charts/etherpad/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "etherpad.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "etherpad.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
27 changes: 27 additions & 0 deletions charts/etherpad/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "etherpad.fullname" . }}
labels:
{{- include "etherpad.labels" . | nindent 4 }}
{{ if .Values.persistence.annotations}}
annotations:
{{- range $key, $value := .Values.persistence.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
29 changes: 29 additions & 0 deletions charts/etherpad/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if .Values.route.enabled -}}
{{- $fullName := include "etherpad.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
openshift.io/host.generated: "true"
name: {{ $fullName }}
labels:
{{- include "etherpad.labels" . | nindent 4 }}
spec:
host: {{ .Values.route.host | quote }}
port:
targetPort: {{ .Values.route.targetPort | default "8080-tcp" }}
to:
kind: Service
name: {{ $fullName }}
weight: 100
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
status:
ingress:
- conditions:
- status: 'True'
type: Admitted
{{ end }}
15 changes: 15 additions & 0 deletions charts/etherpad/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "etherpad.fullname" . }}
labels:
{{- include "etherpad.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "etherpad.selectorLabels" . | nindent 4 }}
57 changes: 57 additions & 0 deletions charts/etherpad/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Default values for etherpad.
replicaCount: 1

defaultTitle: "Labs Etherpad"
defaultText: "✍️ Assign yourself a user and share your ideas! ✍️"

image:
repository: etherpad
pullPolicy: IfNotPresent

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

podSecurityContext: {}
securityContext: {}

service:
type: ClusterIP
port: 9001

ingress:
enabled: false
hosts:
- name: etherpad.organization.com
annotations: {}

route:
enabled: true
host: null
targetPort: http

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

persistence:
enabled: true
annotations: {}
storageClass:
accessMode: ReadWriteOnce
size: 1Gi
mountPath: /opt/etherpad-lite/var

0 comments on commit d7f1b2c

Please sign in to comment.