Skip to content

Commit

Permalink
Merge pull request #27 from ccremer/emby
Browse files Browse the repository at this point in the history
[emby] Add Embyserver chart
  • Loading branch information
ccremer authored Aug 6, 2020
2 parents fa0f4c6 + ee03fcb commit 0ae8852
Show file tree
Hide file tree
Showing 20 changed files with 1,218 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ helm install ccremer/<chart_name>

## List of Charts

* [emby](emby/README.md)
* [fronius-exporter](fronius-exporter/README.md)
* [kubernetes-zfs-provisioner](kubernetes-zfs-provisioner/README.md)
* [znapzend](znapzend/README.md)
Expand Down
26 changes: 26 additions & 0 deletions emby/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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/

# Unit tests
test/
24 changes: 24 additions & 0 deletions emby/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
name: emby
description: A Helm chart for Emby media server

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
# type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

sources:
- https://github.com/MediaBrowser/Emby
- https://github.com/MediaBrowser/Emby.Build

icon: https://avatars3.githubusercontent.com/u/3607473?s=200&v=4
53 changes: 53 additions & 0 deletions emby/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
emby
====
A Helm chart for Emby media server

Current chart version is `0.1.0`





## Chart Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| additionalVolumeMounts | list | `[]` | Add custom volume mounts to the deployment |
| additionalVolumes | list | `[]` | Add custom volumes to the deployment (may need to match `additionalVolumeMounts`) |
| affinity | object | `{}` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | Container image pull policy |
| image.registry | string | `"docker.io"` | Container image registry |
| image.repository | string | `"emby/embyserver"` | Location of the container image |
| image.tag | string | `"4.5.0.16"` | Container image tag |
| imagePullSecrets | list | `[]` | List of image pull secrets if you use a privately hosted image |
| ingress.annotations | object | `{}` | Additional annotations for the Ingress object |
| ingress.enabled | bool | `false` | Control whether ingress is created |
| ingress.hosts | list | `[]` | See Kubernetes Docs for a guide to setup TLS on Ingress |
| ingress.tls | list | `[]` | |
| livenessProbe.enabled | bool | `true` | Whether to enable the liveness probe |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| persistence.annotations | object | `{}` | Additional annotations to add to the PVC |
| persistence.enabled | bool | `false` | Whether to enable the PVC and mount |
| persistence.mountPath | string | `"/config"` | |
| persistence.selector | object | `{}` | PV selector |
| persistence.size | string | `"3Gi"` | Requested storage size |
| persistence.storageClass | string | `""` | Storage Class name of the PV |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| readinessProbe.enabled | bool | `true` | Whether to enable the readiness probe |
| replicaCount | int | `1` | |
| resources.limits.memory | string | `"768Mi"` | |
| resources.requests.cpu | string | `"30m"` | |
| resources.requests.memory | string | `"256Mi"` | |
| securityContext | object | `{}` | |
| service.httpNodePort | int | `0` | http Node port number if `service.type` is `NodePort` |
| service.httpPort | int | `8096` | Service http port number |
| service.httpsNodePort | int | `0` | https Node port number if `service.type` is `NodePort` |
| service.httpsPort | int | `8920` | Service https port number |
| service.type | string | `"ClusterIP"` | Service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and `create` is `true`, a name is generated using the fullname template |
| tolerations | list | `[]` | |
21 changes: 21 additions & 0 deletions emby/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "emby.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 --namespace {{ .Release.Namespace }} svc -w {{ include "emby.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "emby.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
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.kubernetes.io/name={{ include "emby.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
63 changes: 63 additions & 0 deletions emby/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "emby.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 "emby.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 "emby.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "emby.selectorLabels" -}}
app.kubernetes.io/name: {{ include "emby.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "emby.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "emby.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
85 changes: 85 additions & 0 deletions emby/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "emby.fullname" . }}
labels:
{{- include "emby.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "emby.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "emby.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "emby.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 8096
- name: https
containerPort: 8920
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /
port: http
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /
port: http
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if or .Values.persistence.enabled .Values.additionalVolumeMounts }}
volumeMounts:
{{- if .Values.persistence.enabled }}
- mountPath: {{ .Values.persistence.mountPath }}
name: config
{{- end }}
{{- with .Values.additionalVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if or .Values.persistence.enabled .Values.additionalVolumes }}
volumes:
{{- if .Values.persistence.enabled }}
- name: config
persistentVolumeClaim:
claimName: {{ include "emby.fullname" . }}-config
{{- end }}
{{- with .Values.additionalVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
41 changes: 41 additions & 0 deletions emby/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "emby.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 "emby.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 }}
24 changes: 24 additions & 0 deletions emby/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "emby.fullname" . }}-config
labels:
{{- include "emby.labels" . | nindent 4 }}
{{- with .Values.persistence.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- ReadWriteOnce
- ReadOnlyMany
resources:
requests:
storage: {{ .Values.persistence.size }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- with .Values.persistence.selector }}
selector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
25 changes: 25 additions & 0 deletions emby/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "emby.fullname" . }}
labels:
{{- include "emby.labels" . | nindent 4 }}
spec:
{{- with .Values.service }}
type: {{ .type }}
ports:
- port: {{ .httpPort }}
targetPort: http
name: http
{{- with .httpNodePort }}
nodePort: {{ . }}
{{- end }}
- port: {{ .httpsPort }}
targetPort: https
name: https
{{- with .httpsNodePort }}
nodePort: {{ . }}
{{- end }}
{{- end }}
selector:
{{- include "emby.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions emby/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "emby.serviceAccountName" . }}
labels:
{{- include "emby.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 0ae8852

Please sign in to comment.