-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,505 additions
and
1 deletion.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
apiVersion: v2 | ||
name: plex-media-server | ||
description: A Helm chart for deploying a PMS server to a kubernetes cluster | ||
|
||
keywords: | ||
- plex | ||
- pms | ||
- Personal Media Server | ||
|
||
home: https://www.plex.tv | ||
icon: https://www.plex.tv/wp-content/themes/plex/assets/img/favicons/plex-152.png | ||
# 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.4.2 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "1.16.0" | ||
|
||
sources: | ||
- https://github.com/plexinc/pms-docker |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# plex-media-server Chart | ||
=========== | ||
|
||
A Helm chart for deploying the Plex Personal Media Server(PMS) server. | ||
|
||
While Plex is responsible for maintaining this Helm chart, we cannot provide support for troubleshooting related to its usage. For community assistance, please visit our [support forums](https://forums.plex.tv/). | ||
|
||
### Installation via Helm | ||
|
||
1. Add the Helm chart repo | ||
|
||
```bash | ||
helm repo add plex https://raw.githubusercontent.com/plexinc/pms-docker/gh-pages | ||
``` | ||
|
||
2. Inspect & modify the default values (optional) | ||
|
||
```bash | ||
helm show values plex/plex-media-server > values.yaml | ||
``` | ||
|
||
3. Install the chart | ||
|
||
```bash | ||
helm upgrade --install plex plex/plex-media-server --values values.yaml | ||
``` | ||
|
||
[Additional details available here](https://www.plex.tv/blog/plex-pro-week-23-a-z-on-k8s-for-plex-media-server/) | ||
|
||
### Sample init Container scripts | ||
|
||
If you already have a different PMS server running elsewhere and wish to migrate it to be running in Kubernetes | ||
the easiest way to do that is to import the existing PMS database through the use of a custom init script. | ||
|
||
**Note: the init script must include a mechanism to exit early if the pms database already exists to prevent from overwriting its contents** | ||
|
||
The following script is an example (using the default `alpine` init container) that will pull | ||
a tar gziped file that contains the pms `Library` directory from some web server. | ||
|
||
```sh | ||
#!/bin/sh | ||
echo "fetching pre-existing pms database to import..." | ||
|
||
if [ -d "/config/Library" ]; then | ||
echo "PMS library already exists, exiting." | ||
exit 0 | ||
fi | ||
|
||
apk --no-cache add curl | ||
curl http://example.com/pms.tgz -o pms.tgz | ||
tar -xvzf pms.tgz -C /config | ||
rm pms.tgz | ||
|
||
echo "Done." | ||
``` | ||
|
||
This next example could be used if you don't have or can't host the existing pms database archive on a web server. | ||
However, this one _does_ require that two commands are run manually once the init container starts up. | ||
|
||
1. Manually copy the pms database into the pod: `kubectl cp pms.tgz <namespace>/<podname>:/pms.tgz.up -c <release name>-pms-chart-pms-init` | ||
2. Once the file is uploaded copy rename it on the pod to the correct name that will be processed `kubectl exec -n <namespace> --stdin --tty <pod> -c <release name>-pms-chart-pms-init h -- mv /pms.tgz.up /pms.tgz` | ||
|
||
The file is being uploaded with a temporary name so that the script does not start trying to unpack the database until it has finished uploading. | ||
|
||
```sh | ||
#!/bin/sh | ||
echo "waiting for pre-existing pms database to uploaded..." | ||
|
||
if [ -d "/config/Library" ]; then | ||
echo "PMS library already exists, exiting." | ||
exit 0 | ||
fi | ||
|
||
# wait for the database archive to be manually copied to the server | ||
while [ ! -f /pms.tgz ]; do sleep 2; done; | ||
|
||
tar -xvzf /pms.tgz -C /config | ||
rm pms.tgz | ||
|
||
echo "Done." | ||
``` | ||
|
||
## Contributing | ||
|
||
Before contributing, please read the [Code of Conduct](../../CODE_OF_CONDUCT.md). | ||
|
||
## License | ||
|
||
[GNU GPLv3](./LICENSE) | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the Pms-chart chart and their default values. | ||
|
||
| Parameter | Description | Default | | ||
| ------------------------ | ----------------------- | -------------- | | ||
| `image.registry` | The registry that should be used to pull the image from | `"index.docker.io"` | | ||
| `image.repository` | The docker repo that will be used for the PMS image | `"plexinc/pms-docker"` | | ||
| `image.tag` | The tag to use | `"latest"` | | ||
| `image.sha` | Optional SHA digest to specify a specific image rather than a specific tag | `""` | | ||
| `image.pullPolicy` | | `"IfNotPresent"` | | ||
| `global.imageRegistry` | The image registry that should be used for all images, this will take precedence over the per image registry. | `""` | | ||
| `ingress.enabled` | If an ingress for the PMS port should be created. | `false` | | ||
| `ingress.ingressClassName` | | `"ingress-nginx"` | | ||
| `ingress.url` | The url that will be used for the ingress, this should be manually configured as the app URL in PMS. | `""` | | ||
| `ingress.annotations` | Extra annotations to add to the ingress. | `{}` | | ||
| `pms.storageClassName` | The storage class that will be used for the PMS configuration directory, if not specified the default will be used | `null` | | ||
| `pms.configStorage` | The amount of storage space that is allocated to the config volume, this will probably need to be much higher if thumbnails are enabled. | `"2Gi"` | | ||
| `pms.resources` | | `{}` | | ||
| `initContainer.image.registry` | The registry that should be used to pull the image from | `"index.docker.io"` | | ||
| `initContainer.image.repository` | The docker repo that will be used for the init image to run the setup scripts| `"alpine"` | | ||
| `initContainer.image.tag` | The tag to use | `"3.18.0"` | | ||
| `initContainer.image.sha` | Optional SHA digest to specify a specific image rather than a specific tag | `""` | | ||
| `initContainer.image.pullPolicy` | | `"IfNotPresent"` | | ||
| `initContainer.script` | An optional script that will be run by the init container, it can be used on the first run to stop pms from starting when importing a pre-exiting database | `""` | | ||
| `runtimeClassName` | Specify your own runtime class name eg use gpu | `""` | | ||
| `rclone.enabled` | If rclone should be used to mount volumes | `false` | | ||
| `rclone.image.registry` | The registry that should be used to pull the image from | `"index.docker.io"` | | ||
| `rclone.image.repository` | The docker repo that will be used for the rclone container | `"rclone/rclone"` | | ||
| `rclone.image.tag` | The version of rclone to use | `"1.62.2"` | | ||
| `rclone.image.sha` | Optional SHA digest to specify a specific image rather than a specific tag | `""` | | ||
| `rclone.image.pullPolicy` | | `"IfNotPresent"` | | ||
| `rclone.configSecret` | The name of the Kubernetes secret that contains the rclone config to use. This secret is not created by this chart | `""` | | ||
| `rclone.remotes` | A list of remotes to mount using rclone. In the format of `"<remote-name>:<remote-path>"`, the remote-name must be in the rclone config file and its also used to determine the mount path within the PMS container | `[]` | | ||
| `rclone.readOnly` | If the rclone volumes should be mounted as readonly | `true` | | ||
| `rclone.additionalArgs` | Optional additional arguments given to the rclone mount command | `[]` | | ||
| `rclone.resources` | | `{}` | | ||
| `imagePullSecrets` | | `[]` | | ||
| `nameOverride` | | `""` | | ||
| `fullnameOverride` | | `""` | | ||
| `serviceAccount.create` | | `true` | | ||
| `serviceAccount.automountServiceAccountToken` | | `false` | | ||
| `serviceAccount.annotations` | | `{}` | | ||
| `serviceAccount.name` | | `""` | | ||
| `statefulSet.annotations` | | `{}` | | ||
| `service.type` | | `"ClusterIP"` | | ||
| `service.port` | The port number that will be used for exposing the PMS port from the service | `32400` | | ||
| `service.annotations` | | `{}` | | ||
| `nodeSelector` | | `{}` | | ||
| `tolerations` | | `[]` | | ||
| `affinity` | | `{}` | | ||
| `priorityClassName` | | `""` | | ||
| `commonLabels` | Labels that will be added to all resources created by the chart | `{}` | | ||
| `extraEnv` | Environment variables that will be added to the PMS container | `{}` | | ||
| `extraVolumeMounts` | Additional volume mount configuration blocks for the pms container | `[]` | | ||
| `extraVolumes` | Extra volume configurations | `[]` | | ||
| `extraContainers` | Extra contain configuration blocks that will be run alongside the PMS container _after_ the init container finishes | `[]` | | ||
|
||
--- | ||
_Documentation generated by [Frigate](https://frigate.readthedocs.io)._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Thank you for installing {{ .Chart.Name }}. | ||
|
||
Your release is named {{ .Release.Name }}. | ||
|
||
To learn more about the release, try: | ||
|
||
$ helm status {{ .Release.Name }} | ||
$ helm get all {{ .Release.Name }} | ||
|
||
|
||
Mount path for remote is available at {{ .Values.rclone.path }} | ||
You can use this as a volume within your other pods to view the file system for your remote. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "pms-chart.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 "pms-chart.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 "pms-chart.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
The image to use for pms | ||
*/}} | ||
{{- define "pms-chart.image" -}} | ||
{{- if .Values.image.sha }} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.image.repository (default ("latest") .Values.image.tag) .Values.image.sha }} | ||
{{- else }} | ||
{{- printf "%s/%s:%s@%s" .Values.image.registry .Values.image.repository (default ("latest") .Values.image.tag) .Values.image.sha }} | ||
{{- end }} | ||
{{- else }} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.image.repository (default ( "latest") .Values.image.tag) }} | ||
{{- else }} | ||
{{- printf "%s/%s:%s" .Values.image.registry .Values.image.repository (default ( "latest") .Values.image.tag) }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
The image to use for the init containers | ||
*/}} | ||
{{- define "pms-chart.init_image" -}} | ||
{{- if .Values.initContainer.image.sha }} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.initContainer.image.repository (default ("latest") .Values.initContainer.image.tag) .Values.initContainer.image.sha }} | ||
{{- else }} | ||
{{- printf "%s/%s:%s@%s" .Values.initContainer.image.registry .Values.initContainer.image.repository (default ("latest") .Values.initContainer.image.tag) .Values.initContainer.image.sha }} | ||
{{- end }} | ||
{{- else }} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.initContainer.image.repository (default ( "latest") .Values.initContainer.image.tag) }} | ||
{{- else }} | ||
{{- printf "%s/%s:%s" .Values.initContainer.image.registry .Values.initContainer.image.repository (default ( "latest") .Values.initContainer.image.tag) }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
The image to use for rclone | ||
*/}} | ||
{{- define "pms-chart.rclone_image" -}} | ||
{{- if .Values.rclone.image.sha }} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- printf "%s/%s:%s@%s" .Values.global.imageRegistry .Values.rclone.image.repository (default ("latest") .Values.rclone.image.tag) .Values.rclone.image.sha }} | ||
{{- else }} | ||
{{- printf "%s/%s:%s@%s" .Values.rclone.image.registry .Values.rclone.image.repository (default ("latest") .Values.rclone.image.tag) .Values.rclone.image.sha }} | ||
{{- end }} | ||
{{- else }} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- printf "%s/%s:%s" .Values.global.imageRegistry .Values.rclone.image.repository (default ( "latest") .Values.rclone.image.tag) }} | ||
{{- else }} | ||
{{- printf "%s/%s:%s" .Values.rclone.image.registry .Values.rclone.image.repository (default ( "latest") .Values.rclone.image.tag) }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "pms-chart.labels" -}} | ||
app: {{ template "pms-chart.name" . }} | ||
helm.sh/chart: {{ include "pms-chart.chart" . }} | ||
{{ include "pms-chart.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- if .Values.commonLabels}} | ||
{{ toYaml .Values.commonLabels }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "pms-chart.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "pms-chart.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "pms-chart.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "pms-chart.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
11 changes: 11 additions & 0 deletions
11
charts/plex-media-server/templates/configmap-init-script.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{- if .Values.initContainer.script -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "pms-chart.fullname" . }}-init-script | ||
labels: | ||
{{- include "pms-chart.labels" . | nindent 4 }} | ||
data: | ||
init.sh: | | ||
{{ .Values.initContainer.script | indent 4 }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ include "pms-chart.fullname" . }}-ingress | ||
labels: | ||
name: {{ include "pms-chart.fullname" . }}-ingress | ||
{{ include "pms-chart.labels" . | indent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{ toYaml . | indent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.ingressClassName }} | ||
ingressClassName: {{ .Values.ingress.ingressClassName }} | ||
{{- end }} | ||
rules: | ||
- host: {{ trimPrefix "https://" .Values.ingress.url }} | ||
http: | ||
paths: | ||
- path: '/' | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: {{ include "pms-chart.fullname" . }} | ||
port: | ||
number: 32400 | ||
tls: | ||
- hosts: | ||
- {{ trimPrefix "https://" .Values.ingress.url }} | ||
secretName: {{ include "pms-chart.fullname" . }}-ingress-lets-encrypt | ||
{{- end -}} |
Oops, something went wrong.