Commit 931ba4be authored by Waqar Ahmed's avatar Waqar Ahmed

Update charts train for 21.02 release

parent 1396e6d7
apiVersion: v1
description: Global, Versioned, peer-to-peer filesystem.
name: ipfs
version: 1.0.1
appVersion: master
keywords:
- storage
- p2p
home: https://ipfs.io
icon: https://ipfs.io/ipfs/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/ipfs.go.png
sources:
- https://github.com/ipfs/go-ipfs
- https://hub.docker.com/r/ipfs/go-ipfs
upstream_version: 0.8.0-rc1
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
IPFS
=====
[IPFS](https://ipfs.io) is a global, versioned, peer-to-peer filesystem. It combines good ideas from previous systems such Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bittorrent swarm, exchanging git objects. IPFS provides an interface as simple as the HTTP web, but with permanence built in. You can also mount the world at /ipfs.
Introduction
------------
This chart bootstraps IPFS deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
Configuration
-------------
The following table lists the configurable parameters of the IPFS chart and their default values.
| Parameter | Description | Default |
|:-------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------|
| `image.repository` | Image repository | `ipfs/go-ipfs` |
| `image.tag` | IPFS image tag. Possible values listed [here](https://hub.docker.com/r/ipfs/go-ipfs/tags). | `v0.8.0-rc1` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `extraArgs` | Additional command line arguments to pass to the IPFS server | `[]` |
[IPFS](https://ipfs.io) is a global, versioned, peer-to-peer filesystem. It combines good ideas from previous systems such Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bittorrent swarm, exchanging git objects. IPFS provides an interface as simple as the HTTP web, but with permanence built in. You can also mount the world at /ipfs.
## Set default image, imageTag, and imagePullPolicy. mode is used to indicate the
##
image:
repository: ipfs/go-ipfs
tag: v0.8.0-rc1
pullPolicy: IfNotPresent
## Additional arguments to pass to ipfs binary
extraArgs: []
updateStrategy: Recreate
service:
swarmPort: 9401
apiPort: 9501
gatewayPort: 9080
environment:
appVolumeMounts:
staging:
emptyDir: true
mountPath: "/export"
data:
emptyDir: true
mountPath: "/data/ipfs"
groups:
- name: "Container Images"
description: "Image to be used for container"
- name: "Workload Configuration"
description: "Configure Storage for IPFS"
- name: "Storage"
description: "Configure Storage for IPFS"
- name: "IPFS Configuration"
description: "Configure Storage for IPFS"
portals:
web_portal:
protocols:
- "http"
host:
- "$node_ip"
ports:
- "$variable-service.apiPort"
path: "/webui"
questions:
# Image related
- variable: image
description: "Docker Image Details"
label: "Docker Image"
group: "Container Images"
schema:
type: dict
required: true
attrs:
- variable: repository
description: "Docker image repository"
label: "Image repository"
schema:
type: string
default: "ipfs/go-ipfs"
required: true
- variable: tag
description: "Tag to use for specified image"
label: "Image Tag"
schema:
type: string
default: "v0.8.0-rc1"
- variable: pullPolicy
description: "Docker Image Pull Policy"
label: "Image Pull Policy"
schema:
type: string
default: "IfNotPresent"
enum:
- value: "IfNotPresent"
description: "Only pull image if not present on host"
- value: "Always"
description: "Always pull image even if present on host"
- value: "Never"
description: "Never pull image even if it's not present on host"
- variable: updateStrategy
label: "IPFS update strategy"
group: "Workload Configuration"
schema:
type: string
default: "Recreate"
enum:
- value: "RollingUpdate"
description: "Create new pods and then kill old ones"
- value: "Recreate"
description: "Kill existing pods before creating new ones"
- variable: environmentVariables
label: "IPFS image environment"
group: "IPFS Configuration"
schema:
type: list
default: []
items:
- variable: environmentVariable
label: "Environment Variable"
schema:
type: dict
attrs:
- variable: name
label: "Name"
schema:
type: string
- variable: value
label: "Value"
schema:
type: string
- variable: service
description: "IPFS Service Configuration"
label: "IPFS Service Configuration"
group: "IPFS Configuration"
schema:
type: dict
required: true
attrs:
- variable: swarmPort
label: "Swarm Port to use for IPFS (Public)"
schema:
type: int
min: 9000
max: 65535
default: 9401
required: true
- variable: apiPort
label: "API Port to use for IPFS (local)"
schema:
type: int
min: 9000
max: 65535
default: 9501
required: true
- variable: gatewayPort
label: "Gateway Port to use for IPFS (local)"
schema:
type: int
min: 9000
max: 65535
default: 9880
required: true
- variable: appVolumeMounts
label: "IPFS Storage"
group: "Storage"
schema:
type: dict
attrs:
- variable: staging
label: "Staging Volume"
schema:
type: dict
attrs:
- variable: datasetName
label: "IPFS Staging Volume Dataset Name"
schema:
type: string
hidden: true
$ref:
- "normalize/ixVolume"
show_if: [["hostPathEnabled", "=", false]]
default: "ix-ipfs-staging"
editable: false
- variable: mountPath
label: "IPFS Staging Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
hidden: true
editable: false
default: "/export"
- variable: hostPathEnabled
label: "Enable Host Path for IPFS Staging Volume"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Host Path for IPFS Staging Volume"
schema:
type: hostpath
required: true
- variable: data
label: "Data Volume"
schema:
type: dict
attrs:
- variable: datasetName
label: "IPFS Data Volume Name"
schema:
type: string
hidden: true
$ref:
- "normalize/ixVolume"
show_if: [["hostPathEnabled", "=", false]]
default: "ix-ipfs-data"
editable: false
- variable: mountPath
label: "IPFS Data Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
hidden: true
editable: false
default: "/data/ipfs"
- variable: hostPathEnabled
label: "Enable Host Path for IPFS Data Volume"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Host Path for IPFS Data Volume"
schema:
type: hostpath
required: true
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
digest: sha256:6ab46f958de11ae6a24d8f7e18417aa9852a8d968d5b0cc94ffa4700449931d6
generated: "2021-02-04T01:15:55.312886+05:00"
IPFS can be accessed from the following URL:
http://$node_ip:{{ .Values.service.apiPort }}/webui
apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{ include "common.labels" . | nindent 4 }}
spec:
strategy:
type: {{ .Values.updateStrategy }}
selector:
matchLabels: {{ include "common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{ include "common.labels.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "common.names.serviceAccountName" . | quote }}
initContainers:
- name: init-init
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
command: ['/bin/sh', '-c', '[ ! -e /data/ipfs/config ] && (/usr/local/bin/ipfs init ; chown -R 1000:100 /data/ipfs) ; exit 0']
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
- name: init-api
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
command: ['/usr/local/bin/ipfs', 'config', 'Addresses.API', "/ip4/0.0.0.0/tcp/9501"]
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
- name: init-gateway
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
command: ['/usr/local/bin/ipfs', 'config', 'Addresses.Gateway', "/ip4/0.0.0.0/tcp/9080"]
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
- name: init-swarm
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
command: ['/usr/local/bin/ipfs', 'config', '--json', 'Addresses.Swarm', "[\"/ip4/0.0.0.0/tcp/9401\",\"/ip4/0.0.0.0/tcp/9401/quic\"]" ]
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
- name: init-access-origin
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Origin', "[\"*\"]" ]
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
- name: init-access-methods
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
command: ['/usr/local/bin/ipfs', 'config', '--json', 'API.HTTPHeaders.Access-Control-Allow-Methods', "[\"PUT\",\"POST\"]" ]
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
- name: init-chown
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
command: ['chown', '1000:100', '/data/ipfs/config']
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
containers:
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
ports:
- name: swarm
containerPort: 9401
- name: api
containerPort: 9501
- name: gateway
containerPort: 9880
{{ include "common.containers.allEnvironmentVariables" .Values | nindent 10 }}
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
{{ $svc := .Values.service }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "swarm" "port" $svc.swarmPort "nodePort" $svc.swarmPort "targetPort" 9401) }}
{{ $ports = mustAppend $ports (dict "name" "api" "port" $svc.apiPort "nodePort" $svc.apiPort "targetPort" 9501) }}
{{ $ports = mustAppend $ports (dict "name" "gateway" "port" $svc.gatewayPort "nodePort" $svc.gatewayPort "targetPort" 9880) }}
{{ $params := . }}
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
{{ include "common.classes.service" $params }}
{{ include "common.serviceaccount" . }}
## Set default image, imageTag, and imagePullPolicy. mode is used to indicate the
##
image:
repository: ipfs/go-ipfs
tag: v0.8.0-rc1
pullPolicy: IfNotPresent
## Additional arguments to pass to minio binary
extraArgs: []
updateStrategy: Recreate
service:
swarmPort: 30941
apiPort: 30951
gatewayPort: 30980
environmentVariables: []
emptyDirVolumes: true
appVolumeMounts:
staging:
emptyDir: true
mountPath: "/export"
data:
emptyDir: true
mountPath: "/data/ipfs"
categories:
- storage
icon_url: https://ipfs.io/ipfs/QmVk7srrwahXLNmcDYvyUEJptyoxpndnRa57YJ11L4jV26/ipfs.go.png
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
digest: sha256:6ab46f958de11ae6a24d8f7e18417aa9852a8d968d5b0cc94ffa4700449931d6
generated: "2021-02-04T01:15:55.365517+05:00"
...@@ -15,9 +15,14 @@ type: application ...@@ -15,9 +15,14 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # 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. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 2012.0.0 version: 2102.0.0
# This is the version number of the application being deployed. This version number should be # 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 # 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. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: v1 appVersion: v1
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
...@@ -22,7 +22,6 @@ their default values. ...@@ -22,7 +22,6 @@ their default values.
| `image.tag` | The image tag to pull from | `latest` | | `image.tag` | The image tag to pull from | `latest` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` | | `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `updateStrategy` | Upgrade Policy | `RollingUpdate` | | `updateStrategy` | Upgrade Policy | `RollingUpdate` |
| `restartPolicy` | Restart Policy for containers in workload | `Always` |
| `jobRestartPolicy` | Restart Policy for job type workload ( only applicable if `workloadType` is `Job`/`CronJob` | `OnFailure` | | `jobRestartPolicy` | Restart Policy for job type workload ( only applicable if `workloadType` is `Job`/`CronJob` | `OnFailure` |
| `containerCommand` | Commands to execute inside container overriding image CMD default | `null` | | `containerCommand` | Commands to execute inside container overriding image CMD default | `null` |
| `containerArgs` | Specify arguments for container command | `null` | | `containerArgs` | Specify arguments for container command | `null` |
......
...@@ -7,7 +7,6 @@ image: ...@@ -7,7 +7,6 @@ image:
tag: "latest" tag: "latest"
# Restart / Update policy # Restart / Update policy
restartPolicy: Always
updateStrategy: RollingUpdate updateStrategy: RollingUpdate
# Container CMD / entrypoint # Container CMD / entrypoint
......
...@@ -99,21 +99,6 @@ questions: ...@@ -99,21 +99,6 @@ questions:
description: "Kill existing pods before creating new ones" description: "Kill existing pods before creating new ones"
# Restart Policy # Restart Policy
- variable: restartPolicy
description: "Restart Policy for workload"
label: "Restart Policy"
group: "Restart Policy"
schema:
type: string
show_if: [["workloadType", "=", "Deployment"]]
default: "Always"
enum:
- value: "Always"
description: "Always restart containers in a pod if they exit"
- value: "OnFailure"
description: "Only restart containers if they exit with a failure"
- value: "Never"
description: "Never restart containers if they exit"
- variable: jobRestartPolicy - variable: jobRestartPolicy
description: "Restart Policy for workload" description: "Restart Policy for workload"
label: "Restart Policy" label: "Restart Policy"
......
...@@ -39,7 +39,7 @@ Get Restart policy based on workload type ...@@ -39,7 +39,7 @@ Get Restart policy based on workload type
*/}} */}}
{{- define "restartPolicy" -}} {{- define "restartPolicy" -}}
{{- if eq (include "workloadIsDeployment" .) "true" }} {{- if eq (include "workloadIsDeployment" .) "true" }}
{{- printf "%s" .Values.restartPolicy }} {{- print "Always" }}
{{- else }} {{- else }}
{{- printf "%s" .Values.jobRestartPolicy }} {{- printf "%s" .Values.jobRestartPolicy }}
{{- end }} {{- end }}
......
...@@ -7,7 +7,6 @@ image: ...@@ -7,7 +7,6 @@ image:
tag: latest tag: latest
# Restart / Update policy # Restart / Update policy
restartPolicy: Always
updateStrategy: RollingUpdate updateStrategy: RollingUpdate
# Container CMD / entrypoint # Container CMD / entrypoint
......
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "minio.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 "minio.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 "minio.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for deployment.
*/}}
{{- define "minio.deployment.apiVersion" -}}
{{- if semverCompare "<1.9-0" .Capabilities.KubeVersion.Version -}}
{{- print "apps/v1beta2" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for statefulset.
*/}}
{{- define "minio.statefulset.apiVersion" -}}
{{- if semverCompare "<1.17-0" .Capabilities.KubeVersion.Version -}}
{{- print "apps/v1beta2" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Determine secret name.
*/}}
{{- define "minio.secretName" -}}
{{- include "minio.fullname" . -}}
{{- end -}}
{{/*
Determine service account name for deployment or statefulset.
*/}}
{{- define "minio.serviceAccountName" -}}
{{- (include "minio.fullname" .) | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Determine name for scc role and rolebinding
*/}}
{{- define "minio.sccRoleName" -}}
{{- printf "%s-%s" "scc" (include "minio.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Properly format optional additional arguments to Minio binary
*/}}
{{- define "minio.extraArgs" -}}
{{- range .Values.extraArgs -}}
{{ " " }}{{ . }}
{{- end -}}
{{- end -}}
{{/*
Retrieve host path from ix volumes based on dataset name
*/}}
{{- define "retrieveHostPathFromiXVolume" -}}
{{- range $index, $hostPathConfiguration := $.ixVolumes }}
{{- $dsName := base $hostPathConfiguration.hostPath -}}
{{- if eq $.datasetName $dsName -}}
{{- $hostPathConfiguration.hostPath -}}
{{- end -}}
{{- end }}
{{- end -}}
{{/*
Retrieve host path for minio
*/}}
{{- define "configuredMinioHostPath" -}}
{{- if .Values.minioHostPathEnabled -}}
{{- .Values.minioHostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.minioDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{ $scheme := "http" }}
apiVersion: {{ template "minio.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "minio.fullname" . }}
labels:
app: {{ template "minio.name" . }}
chart: {{ template "minio.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
strategy:
type: {{ .Values.updateStrategy }}
selector:
matchLabels:
app: {{ template "minio.name" . }}
release: {{ .Release.Name }}
template:
metadata:
name: {{ template "minio.fullname" . }}
labels:
app: {{ template "minio.name" . }}
release: {{ .Release.Name }}
annotations:
checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
spec:
serviceAccountName: {{ include "minio.serviceAccountName" . | quote }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/sh"
- "-ce"
- "/usr/bin/docker-entrypoint.sh minio server /export {{- template "minio.extraArgs" . }}"
volumeMounts:
- name: export
mountPath: /export
ports:
- name: {{ $scheme }}
containerPort: 9000
env:
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ template "minio.secretName" . }}
key: accesskey
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ template "minio.secretName" . }}
key: secretkey
{{- range $key, $val := .Values.environment }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end}}
volumes:
- name: export
{{- if .Values.emptyDirVolumes }}
emptyDir: {}
{{- else }}
hostPath:
path: {{ template "configuredMinioHostPath" . }}
{{- end }}
- name: minio-user
secret:
secretName: {{ template "minio.secretName" . }}
{{ $scheme := "http" }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "minio.fullname" . }}
labels:
app: {{ template "minio.name" . }}
chart: {{ template "minio.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: "NodePort"
ports:
- name: {{ $scheme }}
port: {{ .Values.service.nodePort }}
protocol: TCP
nodePort: {{ .Values.service.nodePort }}
targetPort: 9000
selector:
app: {{ template "minio.name" . }}
release: {{ .Release.Name }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "minio.serviceAccountName" . | quote }}
namespace: {{ .Release.Namespace | quote }}
labels:
app: {{ template "minio.name" . }}
chart: {{ template "minio.chart" . }}
release: "{{ .Release.Name }}"
# 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
# OWNERS file for Kubernetes
OWNERS
\ No newline at end of file
apiVersion: v1 apiVersion: v1
description: High Performance, Kubernetes Native Object Storage description: High Performance, Kubernetes Native Object Storage
name: minio name: minio
version: 1.0.0 version: 1.1.0
appVersion: master appVersion: master
keywords: keywords:
- storage - storage
...@@ -13,3 +13,7 @@ sources: ...@@ -13,3 +13,7 @@ sources:
- https://github.com/minio/minio - https://github.com/minio/minio
- https://github.com/minio/charts - https://github.com/minio/charts
upstream_version: 8.0.5 upstream_version: 8.0.5
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
...@@ -15,3 +15,8 @@ service: ...@@ -15,3 +15,8 @@ service:
environment: environment:
## Please refer for comprehensive list https://docs.minio.io/docs/minio-server-configuration-guide.html ## Please refer for comprehensive list https://docs.minio.io/docs/minio-server-configuration-guide.html
appVolumeMounts:
export:
emptyDir: true
mountPath: "/export"
#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
values.update({
'appVolumeMounts': {
'export': {
'hostPathEnabled': values['minioHostPathEnabled'],
**({'hostPath': values['minioHostPath']} if values.get('minioHostPath') else {})
},
},
})
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))
...@@ -81,6 +81,7 @@ questions: ...@@ -81,6 +81,7 @@ questions:
- variable: accessKey - variable: accessKey
label: "Access Key" label: "Access Key"
group: "Minio Configuration" group: "Minio Configuration"
description: "Enter the S3 access ID"
schema: schema:
type: string type: string
private: true private: true
...@@ -91,6 +92,7 @@ questions: ...@@ -91,6 +92,7 @@ questions:
- variable: secretKey - variable: secretKey
label: "Secret Key" label: "Secret Key"
group: "Minio Configuration" group: "Minio Configuration"
description: "Enter the S3 secret access key"
schema: schema:
type: string type: string
private: true private: true
...@@ -98,13 +100,26 @@ questions: ...@@ -98,13 +100,26 @@ questions:
min_length: 8 min_length: 8
max_length: 40 max_length: 40
- variable: environment - variable: environmentVariables
label: "Minio image environment" label: "Minio image environment"
group: "Minio Configuration" group: "Minio Configuration"
schema: schema:
type: dict type: list
additional_attrs: true default: []
attrs: [] items:
- variable: environmentVariable
label: "Environment Variable"
schema:
type: dict
attrs:
- variable: name
label: "Name"
schema:
type: string
- variable: value
label: "Value"
schema:
type: string
- variable: service - variable: service
description: "Minio Service Configuration" description: "Minio Service Configuration"
...@@ -123,38 +138,44 @@ questions: ...@@ -123,38 +138,44 @@ questions:
default: 9000 default: 9000
required: true required: true
- variable: minioHostPathEnabled - variable: appVolumeMounts
label: "Configure Host Path for Minio data" label: "Minio Storage"
group: "Storage"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: minioHostPath
label: "Specify HostPath for Minio data"
schema:
type: hostpath
- variable: minioDataVolume
label: "Configure iXVolume"
group: "Storage" group: "Storage"
schema: schema:
type: dict type: dict
$ref:
- "normalize/ixVolume"
show_if: [["minioHostPathEnabled", "=", false]]
attrs: attrs:
- variable: mountPath - variable: export
label: "Mount Path" label: "Data Volume"
description: "Path where the volume will be mounted inside the pod"
schema: schema:
type: path type: dict
editable: false attrs:
default: "/export" - variable: datasetName
- variable: datasetName label: "Minio Data Volume Name"
label: "Dataset Name" schema:
schema: type: string
type: string hidden: true
default: "ix-minio" $ref:
editable: false - "normalize/ixVolume"
show_if: [["hostPathEnabled", "=", false]]
default: "ix-minio"
editable: false
- variable: mountPath
label: "Minio Data Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
hidden: true
editable: false
default: "/export"
- variable: hostPathEnabled
label: "Enable Host Path for Minio Data Volume"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Host Path for Minio Data Volume"
schema:
type: hostpath
required: true
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
digest: sha256:6ab46f958de11ae6a24d8f7e18417aa9852a8d968d5b0cc94ffa4700449931d6
generated: "2021-02-04T01:15:55.416388+05:00"
{{/*
Determine secret name.
*/}}
{{- define "minio.secretName" -}}
{{- include "common.names.fullname" . -}}
{{- end -}}
{{ $scheme := "http" }}
apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "common.names.fullname" . }}
labels:
app: {{ template "common.names.name" . }}
chart: {{ template "common.names.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ (default 1 .Values.replicas) }}
strategy:
type: {{ (default "Recreate" .Values.updateStrategy ) }}
selector:
matchLabels:
app: {{ template "common.names.name" . }}
release: {{ .Release.Name }}
template:
metadata:
name: {{ template "common.names.fullname" . }}
labels:
app: {{ template "common.names.name" . }}
release: {{ .Release.Name }}
{{- include "common.labels.selectorLabels" . | nindent 8 }}
annotations: {{ include "common.annotations" . | nindent 8 }}
spec:
serviceAccountName: {{ include "common.names.serviceAccountName" . | quote }}
containers:
- name: {{ .Chart.Name }}
{{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
{{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
command:
- "/bin/sh"
- "-ce"
- "/usr/bin/docker-entrypoint.sh minio server /export {{ (.Values.extraArgs | default list) | join " " }}"
ports:
- name: {{ $scheme }}
containerPort: 9000
env:
{{ $secretName := (include "minio.secretName" .) }}
{{ $envList := (default list .Values.environment) }}
{{ $envList = mustAppend $envList (dict "name" "MINIO_ACCESS_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "accesskey") }}
{{ $envList = mustAppend $envList (dict "name" "MINIO_SECRET_KEY" "valueFromSecret" true "secretName" $secretName "secretKey" "secretkey") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
...@@ -2,11 +2,7 @@ apiVersion: v1 ...@@ -2,11 +2,7 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "minio.secretName" . }} name: {{ template "minio.secretName" . }}
labels: labels: {{ include "common.labels" . | nindent 4 }}
app: {{ template "minio.name" . }}
chart: {{ template "minio.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque type: Opaque
data: data:
accesskey: {{ if .Values.accessKey }}{{ .Values.accessKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 20 | b64enc | quote }}{{ end }} accesskey: {{ if .Values.accessKey }}{{ .Values.accessKey | toString | b64enc | quote }}{{ else }}{{ randAlphaNum 20 | b64enc | quote }}{{ end }}
......
{{ $svc := .Values.service }}
{{ $selectors := list }}
{{ $selectors = mustAppend $selectors (dict "key" "app" "value" (include "common.names.name" .) ) }}
{{ $selectors = mustAppend $selectors (dict "key" "release" "value" .Release.Name ) }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "http" "port" $svc.nodePort "nodePort" $svc.nodePort "targetPort" 9000) }}
{{ $params := . }}
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
{{ $_1 := set .Values "extraSelectorLabels" $selectors }}
{{ include "common.classes.service" $params }}
{{ include "common.serviceaccount" . }}
...@@ -11,9 +11,13 @@ extraArgs: [] ...@@ -11,9 +11,13 @@ extraArgs: []
updateStrategy: RollingUpdate updateStrategy: RollingUpdate
service: service:
nodePort: 32000 nodePort: 32001
environment: environmentVariables: []
## Please refer for comprehensive list https://docs.minio.io/docs/minio-server-configuration-guide.html ## Please refer for comprehensive list https://docs.minio.io/docs/minio-server-configuration-guide.html
emptyDirVolumes: true emptyDirVolumes: true
appVolumeMounts:
export:
emptyDir: true
mountPath: "/export"
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "nextcloud.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 "nextcloud.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 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).
*/}}
{{- define "nextcloud.mariadb.fullname" -}}
{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified redis app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "nextcloud.redis.fullname" -}}
{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nextcloud.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Retrieve host path from ix volumes based on dataset name
*/}}
{{- define "retrieveHostPathFromiXVolume" -}}
{{- range $index, $hostPathConfiguration := $.ixVolumes }}
{{- $dsName := base $hostPathConfiguration.hostPath -}}
{{- if eq $.datasetName $dsName -}}
{{- $hostPathConfiguration.hostPath -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve host path defined in volume
*/}}
{{- define "configuredHostPath" -}}
{{- if .Values.emptyDirVolumes -}}
{{- printf "" -}}
{{- else if .Values.nextcloudDataHostPathEnabled -}}
{{- required "Please specify a host path for nextcloud" .Values.nextcloudHostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.nextcloudDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve backup postgresql host path defined in volume
*/}}
{{- define "configuredBackupPostgresHostPath" -}}
{{- if .Values.emptyDirVolumes -}}
{{- printf "" -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.postgresBackupVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve postgresql data host path defined in volume
*/}}
{{- define "configuredPostgresHostPath" -}}
{{- if .Values.emptyDirVolumes -}}
{{- printf "" -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.postgresDataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "nextcloud.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Nextcloud service account
*/}}
{{- define "nextcloud.serviceAccountName" -}}
{{- printf "%s-service-account" .Release.Name -}}
{{- end -}}
{{/*
Retrieve previous chart version from which we are upgrading to a newer chart version
*/}}
{{- define "tn.chart.old_version" -}}
{{- if .Values.ixChartContext.is_upgrade -}}
{{- .Values.ixChartContext.upgradeMetadata.oldChartVersion -}}
{{- else -}}
{{- fail "A chart upgrade is not taking place" -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve new chart version to which we are upgrading from an old chart version
*/}}
{{- define "tn.chart.new_version" -}}
{{- if .Values.ixChartContext.is_upgrade -}}
{{- .Values.ixChartContext.upgradeMetadata.newChartVersion -}}
{{- else -}}
{{- fail "A chart upgrade is not taking place" -}}
{{- end -}}
{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "nextcloud.fullname" . }}-postgres
labels:
helm.sh/chart: {{ include "nextcloud.chart" . }}
{{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: database
spec:
replicas: 1
strategy:
type: {{ .Values.nextcloud.strategy }}
selector:
matchLabels:
{{- include "nextcloud.postgres.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: database
template:
metadata:
labels:
{{- include "nextcloud.postgres.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: database
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
containers:
- name: {{ .Chart.Name }}-postgres
image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: db-details
key: db-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: db-details
key: db-password
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
- name: postgres-backup
mountPath: /postgres_backups
ports:
- name: postgres-tcp
containerPort: 5432
protocol: TCP
volumes:
- name: postgres-data
{{- if ne (include "configuredPostgresHostPath" .) "" }}
hostPath:
path: {{ template "configuredPostgresHostPath" . }}
{{- else }}
emptyDir: {}
{{- end }}
- name: postgres-backup
{{- if ne (include "configuredBackupPostgresHostPath" .) "" }}
hostPath:
path: {{ template "configuredBackupPostgresHostPath" . }}
{{- else }}
emptyDir: {}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "nextcloud.fullname" . }}-postgres
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres
helm.sh/chart: {{ include "nextcloud.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: app
spec:
type: ClusterIP
ports:
- port: 5432
protocol: TCP
name: postgres-tcp
selector:
{{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "nextcloud.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: app
spec:
type: NodePort
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
nodePort: {{ default "" .Values.service.nodePort}}
selector:
{{- include "nextcloud.selectorLabels" . | nindent 4 }}
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
digest: sha256:6ab46f958de11ae6a24d8f7e18417aa9852a8d968d5b0cc94ffa4700449931d6
generated: "2021-02-04T01:15:55.262077+05:00"
apiVersion: v2 apiVersion: v2
name: nextcloud name: nextcloud
version: 1.1.0 version: 1.2.0
appVersion: 19.0.3 appVersion: 19.0.3
description: A file sharing server that puts the control and security of your own data back into your hands. description: A file sharing server that puts the control and security of your own data back into your hands.
keywords: keywords:
...@@ -15,3 +15,8 @@ sources: ...@@ -15,3 +15,8 @@ sources:
- https://github.com/nextcloud/docker - https://github.com/nextcloud/docker
- https://github.com/nextcloud/helm - https://github.com/nextcloud/helm
upstream_version: 2.3.2 upstream_version: 2.3.2
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
...@@ -13,16 +13,18 @@ nextcloud: ...@@ -13,16 +13,18 @@ nextcloud:
datadir: /var/www/html/data datadir: /var/www/html/data
strategy: "Recreate" strategy: "Recreate"
postgresql:
backupVolume:
mountPath: "/postgres_backups"
datasetName: "ix-postgres_backups"
dataVolume:
mountPath: "/var/lib/postgresql/data"
datasetName: "ix-postgres_data"
service: service:
nodePort: 31000 nodePort: 9001
emptyDirVolumes: true appVolumeMounts:
ixChartContext: {} nextcloud-data:
emptyDir: true
mountPath: "/var/www"
postgresAppVolumeMounts:
postgres-data:
emptyDir: true
mountPath: "/var/lib/postgresql/data"
postgres-backup:
emptyDir: true
mountPath: "/postgres_backups"
#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
values.update({
'appVolumeMounts': {
'nextcloud-data': {
'hostPathEnabled': values['nextcloudDataHostPathEnabled'],
**({'hostPath': values['nextcloudHostPath']} if values.get('nextcloudHostPath') else {})
},
},
'updateStrategy': values.get('nextcloud').get('strategy', 'Recreate'),
})
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))
...@@ -9,6 +9,8 @@ groups: ...@@ -9,6 +9,8 @@ groups:
description: "Configure nextcloud container parameters" description: "Configure nextcloud container parameters"
- name: "Postgresql Configuration" - name: "Postgresql Configuration"
description: "Configure Postgresql for nextcloud" description: "Configure Postgresql for nextcloud"
- name: "Scaling/Upgrade Policy"
description: "Configure how pods are replaced when configuration is upgraded"
portals: portals:
web_portal: web_portal:
...@@ -74,12 +76,14 @@ questions: ...@@ -74,12 +76,14 @@ questions:
- "definitions/nodeIP" - "definitions/nodeIP"
- variable: username - variable: username
label: "Username" label: "Username"
description: "Name of the Nextcloud admin user"
schema: schema:
type: string type: string
default: "admin" default: "admin"
required: true required: true
- variable: password - variable: password
label: "Password" label: "Password"
description: "Password for the Nextcloud admin user"
schema: schema:
type: string type: string
private: true private: true
...@@ -87,20 +91,25 @@ questions: ...@@ -87,20 +91,25 @@ questions:
required: true required: true
- variable: datadir - variable: datadir
label: "Nextcloud data directory" label: "Nextcloud data directory"
description: "Configures the data directory where nextcloud stores all files from the users"
schema: schema:
type: path type: path
default: "/var/www/html/data" default: "/var/www/html/data"
required: true required: true
- variable: strategy
label: "Nextcloud update strategy" # Update strategy
schema: - variable: updateStrategy
type: string description: "Upgrade Policy"
default: "Recreate" label: "Update Strategy"
enum: group: "Scaling/Upgrade Policy"
- value: "RollingUpdate" schema:
description: "Create new pods and then kill old ones" type: string
- value: "Recreate" default: "Recreate"
description: "Kill existing pods before creating new ones" enum:
- value: "RollingUpdate"
description: "Create new pods and then kill old ones"
- value: "Recreate"
description: "Kill existing pods before creating new ones"
- variable: service - variable: service
description: "Nextcloud Service Configuration" description: "Nextcloud Service Configuration"
...@@ -119,80 +128,92 @@ questions: ...@@ -119,80 +128,92 @@ questions:
default: 9001 default: 9001
required: true required: true
- variable: nextcloudDataHostPathEnabled - variable: appVolumeMounts
label: "Configure Host Path for Nextcloud data" label: "Nextcloud Storage"
group: "Storage"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: nextcloudHostPath
label: "Specify HostPath for Nextcloud data"
schema:
type: hostpath
- variable: nextcloudDataVolume
label: "Configure iXVolume"
group: "Storage"
schema:
type: dict
$ref:
- "normalize/ixVolume"
show_if: [["nextcloudDataHostPathEnabled", "=", false]]
attrs:
- variable: mountPath
label: "Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/var/www"
- variable: datasetName
label: "Dataset Name"
schema:
type: string
default: "ix-nextcloud_data"
editable: false
- variable: postgresBackupVolume
label: "Postgres Backup Volume"
group: "Storage" group: "Storage"
schema: schema:
type: dict type: dict
$ref:
- "normalize/ixVolume"
attrs: attrs:
- variable: mountPath - variable: nextcloud-data
label: "Mount Path" label: "Nextcloud Data Volume"
schema: schema:
type: path type: dict
editable: false attrs:
default: "/postgres_backups" - variable: datasetName
- variable: datasetName label: "Nextcloud Data Volume Name"
label: "Dataset Name" schema:
schema: type: string
type: string hidden: true
default: "ix-postgres_backups" $ref:
editable: false - "normalize/ixVolume"
show_if: [["hostPathEnabled", "=", false]]
default: "ix-nextcloud_data"
editable: false
- variable: mountPath
label: "Nextcloud Data Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
hidden: true
editable: false
default: "/var/www"
- variable: hostPathEnabled
label: "Enable Host Path for Nextcloud Data Volume"
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: hostPath
label: "Host Path for Nextcloud Data Volume"
schema:
type: hostpath
required: true
- variable: postgresDataVolume - variable: postgresAppVolumeMounts
label: "Postgresql Data Volume" label: "Postgres Storage"
group: "Storage" group: "Storage"
schema: schema:
type: dict type: dict
$ref: hidden: true
- "normalize/ixVolume"
attrs: attrs:
- variable: mountPath - variable: postgres-data
label: "Mount Path" label: "Postgres Data Volume"
schema: schema:
type: path type: dict
editable: false attrs:
default: "/var/lib/postgresql/data" - variable: datasetName
- variable: datasetName label: "Postgres Data Volume Name"
label: "Dataset Name" schema:
schema: type: string
type: string $ref:
default: "ix-postgres_data" - "normalize/ixVolume"
editable: false default: "ix-postgres_data"
editable: false
- variable: mountPath
label: "Postgresql Data Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/var/lib/postgresql/data"
- variable: postgres-backup
label: "Postgres Backup Volume"
schema:
type: dict
attrs:
- variable: datasetName
label: "Postgres Backup Volume Name"
schema:
type: string
$ref:
- "normalize/ixVolume"
default: "ix-postgres_backups"
editable: false
- variable: mountPath
label: "Postgresql Backup Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/postgres_backups"
...@@ -5,18 +5,12 @@ Get Nextloud Postgres Database Name ...@@ -5,18 +5,12 @@ Get Nextloud Postgres Database Name
{{- print "nextcloud" -}} {{- print "nextcloud" -}}
{{- end -}} {{- end -}}
{{/*
Postgres Selector labels
*/}}
{{- define "nextcloud.postgres.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres
app.kubernetes.io/instance: {{ .Release.Name }}-postgres
{{- end }}
{{- define "postgres.imageName" -}} {{- define "postgres.imageName" -}}
{{- print "postgres:13.1" -}} {{- print "postgres:13.1" -}}
{{- end -}} {{- end -}}
{{/* {{/*
Retrieve postgres backup name Retrieve postgres backup name
This will return a unique name based on revision and chart numbers specified. This will return a unique name based on revision and chart numbers specified.
...@@ -26,3 +20,30 @@ This will return a unique name based on revision and chart numbers specified. ...@@ -26,3 +20,30 @@ This will return a unique name based on revision and chart numbers specified.
{{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}} {{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
{{- end }} {{- end }}
{{/*
Retrieve postgres credentials for environment variables configuration
*/}}
{{- define "postgres.envVariableConfiguration" -}}
{{ $envList := list }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) }}
{{- end -}}
{{/*
Retrieve postgres volume configuration
*/}}
{{- define "postgres.volumeConfiguration" -}}
{{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts "emptyDirVolumes" .Values.emptyDirVolumes "ixVolumes" .Values.ixVolumes) | nindent 0 }}
{{- end -}}
{{/*
Retrieve postgres volume mounts configuration
*/}}
{{- define "postgres.volumeMountsConfiguration" -}}
{{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts ) | nindent 0 }}
{{- end -}}
{{- if .Values.ixChartContext.isUpgrade -}} {{- if .Values.ixChartContext.isUpgrade -}}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
...@@ -14,44 +16,24 @@ spec: ...@@ -14,44 +16,24 @@ spec:
name: "pre-upgrade-hook2" name: "pre-upgrade-hook2"
spec: spec:
restartPolicy: Never restartPolicy: Never
serviceAccountName: "{{ template "nextcloud.serviceAccountName" . }}" serviceAccountName: "{{ template "common.names.serviceAccountName" . }}"
containers: containers:
- name: {{ .Chart.Name }}-postgres-backup - name: {{ .Chart.Name }}-postgres-backup
image: {{ template "postgres.imageName" . }} image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
env: env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
- name: POSTGRES_USER - name: BACKUP_NAME
valueFrom: value: {{ template "postgres.backupName" . }}
secretKeyRef: volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
name: db-details
key: db-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: db-details
key: db-password
- name: BACKUP_NAME
value: {{ template "postgres.backupName" . }}
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
- name: postgres-backup
mountPath: /postgres_backups
- name: backup-script-configmap - name: backup-script-configmap
mountPath: /bin/backup_entrypoint.sh mountPath: /bin/backup_entrypoint.sh
readOnly: true readOnly: true
subPath: entrypoint.sh subPath: entrypoint.sh
command: command:
- "/bin/backup_entrypoint.sh" - "/bin/backup_entrypoint.sh"
volumes: volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
- name: postgres-data - name: backup-script-configmap
hostPath: configMap:
path: {{ template "configuredPostgresHostPath" . }} defaultMode: 0700
- name: postgres-backup name: "postgres-backup-hook-config-map"
hostPath:
path: {{ template "configuredBackupPostgresHostPath" . }}
- name: backup-script-configmap
configMap:
defaultMode: 0700
name: "postgres-backup-hook-config-map"
{{- end -}} {{- end -}}
apiVersion: apps/v1 {{ $postgres_values := (. | mustDeepCopy) }}
kind: Deployment {{ $_ := set $postgres_values "common" (dict "nameSuffix" "postgres") }}
metadata: {{ include "common.deployment.common_config" . | nindent 0 }}
name: {{ template "nextcloud.fullname" . }} spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
labels: template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: app
{{- if .Values.deploymentAnnotations }}
annotations:
{{ toYaml .Values.deploymentAnnotations | indent 4 }}
{{- end }}
spec:
replicas: 1
strategy:
type: {{ .Values.nextcloud.strategy }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: app
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: app
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec: spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end }}
initContainers: initContainers:
- name: init-postgresdb - name: init-postgresdb
image: {{ template "postgres.imageName" . }} image: {{ template "postgres.imageName" . }}
command: ['sh', '-c', "until pg_isready -h {{ template "nextcloud.fullname" . }}-postgres; do echo waiting for postgres; sleep 2; done"] command: ['sh', '-c', "until pg_isready -h {{ template "common.names.fullname" $postgres_values }}; do echo waiting for postgres; sleep 2; done"]
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" {{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
imagePullPolicy: {{ .Values.image.pullPolicy }} env: {{ include "postgres.envVariableConfiguration" $postgres_values | nindent 10 }}
env: {{ $envList := list }}
- name: POSTGRES_HOST {{ $secretName := (include "common.names.fullname" .) }}
value: {{ template "nextcloud.fullname" . }}-postgres:5432 {{ $envList = mustAppend $envList (dict "name" "POSTGRES_HOST" "value" (printf "%s:5432" (include "common.names.fullname" $postgres_values))) }}
- name: POSTGRES_DB {{ $envList = mustAppend $envList (dict "name" "POSTGRES_DB" "value" (include "postgres.DatabaseName" .)) }}
value: {{ template "postgres.DatabaseName" . }} {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_DATA_DIR" "value" .Values.nextcloud.datadir) }}
- name: POSTGRES_USER {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_TRUSTED_DOMAINS" "value" .Values.nextcloud.host) }}
valueFrom: {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-username") }}
secretKeyRef: {{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-password") }}
name: db-details {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
key: db-user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: db-details
key: db-password
- name: NEXTCLOUD_ADMIN_USER
valueFrom:
secretKeyRef:
name: {{ template "nextcloud.fullname" . }}
key: nextcloud-username
- name: NEXTCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "nextcloud.fullname" . }}
key: nextcloud-password
- name: NEXTCLOUD_TRUSTED_DOMAINS
value: {{ .Values.nextcloud.host }}
- name: NEXTCLOUD_DATA_DIR
value: {{ .Values.nextcloud.datadir | quote }}
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: 80
...@@ -100,14 +48,7 @@ spec: ...@@ -100,14 +48,7 @@ spec:
- name: nextcloud-data - name: nextcloud-data
mountPath: /var/www/html/themes mountPath: /var/www/html/themes
subPath: "themes" subPath: "themes"
volumes: {{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
- name: nextcloud-data
{{- if ne (include "configuredHostPath" .) "" }}
hostPath:
path: {{ template "configuredHostPath" . }}
{{- else }}
emptyDir: {}
{{- end }}
# Will mount configuration files as www-data (id: 33) for nextcloud # Will mount configuration files as www-data (id: 33) for nextcloud
securityContext: securityContext:
fsGroup: 33 fsGroup: 33
{{- if .Values.ixChartContext.isUpgrade -}} {{- if .Values.ixChartContext.isUpgrade -}}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
...@@ -14,9 +16,9 @@ spec: ...@@ -14,9 +16,9 @@ spec:
name: "pre-upgrade-hook1" name: "pre-upgrade-hook1"
spec: spec:
restartPolicy: Never restartPolicy: Never
serviceAccountName: "{{ template "nextcloud.serviceAccountName" . }}" serviceAccountName: "{{ template "common.names.serviceAccountName" . }}"
containers: containers:
- name: kubectl - name: kubectl
image: "bitnami/kubectl:1.19" image: "bitnami/kubectl:1.19"
command: ["kubectl", "delete" , "deployment", "{{ template "nextcloud.fullname" . }}", "{{ template "nextcloud.fullname" . }}-postgres"] command: ["kubectl", "delete" , "deployment", "{{ template "common.names.fullname" . }}", "{{ template "common.names.fullname" $values }}"]
{{- end -}} {{- end -}}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
{{ include "common.deployment.common_config" $values | nindent 0 }}
spec: {{ include "common.deployment.common_spec" $values | nindent 2 }}
template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }}
spec:
containers:
- name: {{ .Chart.Name }}-postgres
image: {{ template "postgres.imageName" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
ports:
- name: postgres-tcp
containerPort: 5432
protocol: TCP
volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "postgres-tcp" "port" 5432 "targetPort" 5432) }}
{{ $values := (. | mustDeepCopy) }}
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
{{ $_1 := set $values "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
{{ include "common.classes.service" $values }}
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: {{ template "nextcloud.fullname" . }} name: {{ template "common.names.fullname" . }}
labels: labels: {{ include "common.labels" . | nindent 4 }}
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
helm.sh/chart: {{ include "nextcloud.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque type: Opaque
data: data:
nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }} nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }}
......
{{ $svc := .Values.service }}
{{ $ports := list }}
{{ $ports = mustAppend $ports (dict "name" "http" "port" 80 "nodePort" $svc.nodePort) }}
{{ $params := . }}
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
{{ include "common.classes.service" $params }}
apiVersion: v1 {{ include "common.serviceaccount" . | nindent 0 }}
kind: ServiceAccount
metadata:
name: "{{ template "nextcloud.serviceAccountName" . }}"
namespace: {{ .Release.Namespace }}
--- ---
...@@ -12,7 +8,7 @@ metadata: ...@@ -12,7 +8,7 @@ metadata:
name: "{{ .Release.Name }}-service-account-role-binding" name: "{{ .Release.Name }}-service-account-role-binding"
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: "{{ template "nextcloud.serviceAccountName" . }}" name: "{{ template "common.names.serviceAccountName" . }}"
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
roleRef: roleRef:
kind: Role kind: Role
......
...@@ -11,7 +11,33 @@ nextcloud: ...@@ -11,7 +11,33 @@ nextcloud:
username: admin username: admin
password: changeme password: changeme
datadir: /var/www/html/data datadir: /var/www/html/data
strategy: "Recreate"
updateStrategy: "Recreate"
postgresql:
backupVolume:
mountPath: "/postgres_backups"
datasetName: "ix-postgres_backups"
dataVolume:
mountPath: "/var/lib/postgresql/data"
datasetName: "ix-postgres_data"
service: service:
nodePort: 9001 nodePort: 31000
emptyDirVolumes: true
ixChartContext: {}
environmentVariables: []
appVolumeMounts:
nextcloud-data:
emptyDir: true
mountPath: "/var/www"
postgresAppVolumeMounts:
postgres-data:
emptyDir: true
mountPath: "/var/lib/postgresql/data"
postgres-backup:
emptyDir: true
mountPath: "/postgres_backups"
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "plex.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 "plex.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 "plex.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "plex.labels" -}}
helm.sh/chart: {{ include "plex.chart" . }}
{{ include "plex.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "plex.selectorLabels" -}}
app.kubernetes.io/name: {{ include "plex.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "plex.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "plex.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
abstract: |
Joins a list of values into a comma separated string
values: |
test:
- foo
- bar
usage: |
{{ include "joinListWithComma" .Values.test }}
return: |
foo,bar
*/}}
{{- define "joinListWithComma" -}}
{{- $local := dict "first" true -}}
{{- range $k, $v := . -}}{{- if not $local.first -}},{{- end -}}{{- $v -}}{{- $_ := set $local "first" false -}}{{- end -}}
{{- end -}}
\ No newline at end of file
{{/*
Retrieve host path from ix volumes based on dataset name
*/}}
{{- define "retrieveHostPathFromiXVolume" -}}
{{- range $index, $hostPathConfiguration := $.ixVolumes }}
{{- $dsName := base $hostPathConfiguration.hostPath -}}
{{- if eq $.datasetName $dsName -}}
{{- $hostPathConfiguration.hostPath -}}
{{- end -}}
{{- end }}
{{- end -}}
{{/*
Retrieve host path for transcode
Let's please remove the redundancy
*/}}
{{- define "configuredHostPathTranscode" -}}
{{- if .Values.transcodeHostPathEnabled -}}
{{- .Values.transcodeHostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.transcodeVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve host path for data
Let's please remove the redundancy
*/}}
{{- define "configuredHostPathData" -}}
{{- if .Values.dataHostPathEnabled -}}
{{- .Values.dataHostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.dataVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
{{/*
Retrieve host path for transcode
Let's please remove the redundancy
*/}}
{{- define "configuredHostPathConfig" -}}
{{- if .Values.configHostPathEnabled -}}
{{- .Values.configHostPath -}}
{{- else -}}
{{- $volDict := dict "datasetName" $.Values.configVolume.datasetName "ixVolumes" $.Values.ixVolumes -}}
{{- include "retrieveHostPathFromiXVolume" $volDict -}}
{{- end -}}
{{- end -}}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.hostNetwork }}
name: {{ include "plex.fullname" . }}-tcp-cluster-ip
{{- else }}
name: {{ include "plex.fullname" . }}-tcp
{{- end }}
labels:
{{- include "plex.labels" . | nindent 4 }}
spec:
{{- if .Values.hostNetwork }}
type: ClusterIP
{{- else }}
type: NodePort
{{- end }}
ports:
- name: pms
port: {{ .Values.plexServiceTCP.port }}
protocol: TCP
targetPort: pms
{{- if eq .Values.hostNetwork false }}
nodePort: {{.Values.plexServiceTCP.port}}
{{- end }}
- name: http
port: 80
targetPort: pms
- name: https
port: 443
targetPort: pms
- name: plex-dlna
port: 1900
targetPort: plex-dlna
selector:
{{- include "plex.selectorLabels" . | nindent 4 }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "plex.fullname" . }}-udp
labels:
{{- include "plex.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- name: plex-dlna-udp
port: 1900
protocol: UDP
targetPort: plex-dlna-udp
- name: plex-gdm1
port: 32410
protocol: UDP
targetPort: plex-gdm1
- name: plex-gdm2
port: 32412
protocol: UDP
targetPort: plex-gdm2
- name: plex-gdm3
port: 32413
protocol: UDP
targetPort: plex-gdm3
- name: plex-gdm4
port: 32414
protocol: UDP
targetPort: plex-gdm4
selector:
{{- include "plex.selectorLabels" . | nindent 4 }}
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
digest: sha256:6ab46f958de11ae6a24d8f7e18417aa9852a8d968d5b0cc94ffa4700449931d6
generated: "2021-02-04T01:15:55.470042+05:00"
...@@ -2,7 +2,7 @@ apiVersion: v2 ...@@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 1.20.2.3402 appVersion: 1.20.2.3402
description: Plex Media Server description: Plex Media Server
name: plex name: plex
version: 1.0.0 version: 1.1.0
keywords: keywords:
- plex - plex
home: https://plex.tv/ home: https://plex.tv/
...@@ -11,3 +11,8 @@ sources: ...@@ -11,3 +11,8 @@ sources:
- https://hub.docker.com/r/plexinc/pms-docker/ - https://hub.docker.com/r/plexinc/pms-docker/
- https://github.com/k8s-at-home/charts/tree/master/charts/plex - https://github.com/k8s-at-home/charts/tree/master/charts/plex
upstream_version: 2.1.0 upstream_version: 2.1.0
dependencies:
- name: common
repository: file://../../../library/common/2101.0.0
version: 2101.0.0
...@@ -50,17 +50,13 @@ timezone: "Etc/UTC" ...@@ -50,17 +50,13 @@ timezone: "Etc/UTC"
# TMPDIR: /transcode # TMPDIR: /transcode
# upgrade strategy type (e.g. Recreate or RollingUpdate) # upgrade strategy type (e.g. Recreate or RollingUpdate)
strategyType: Recreate updateStrategy: Recreate
plexServiceTCP: plexServiceTCP:
port: 32400 port: 32400
hostNetwork: false hostNetwork: false
transcodeHostPathEnabled: false
dataHostPathEnabled: false
configHostPathEnabled: false
proxy: proxy:
# This allows to set a proxy environment variable, which PMS uses to fetch the token and assets like movie cover # This allows to set a proxy environment variable, which PMS uses to fetch the token and assets like movie cover
enabled: false enabled: false
...@@ -69,4 +65,20 @@ proxy: ...@@ -69,4 +65,20 @@ proxy:
# noproxy: "localhost,127.0.0.1,10.96.0.0/12,10.244.0.0/12" # noproxy: "localhost,127.0.0.1,10.96.0.0/12,10.244.0.0/12"
gpuConfiguration: {} gpuConfiguration: {}
emptyDirVolumes: true
appVolumeMounts:
transcode:
emptyDir: true
mountPath: "/transcode"
data:
emptyDir: true
mountPath: "/data"
config:
emptyDir: true
mountPath: "/config"
shared:
emptyDir: true
mountPath: "shared"
shared-logs:
emptyDir: true
mountPath: "/config/Library/Application Support/Plex Media Server/Logs"
#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
values.update({
'appVolumeMounts': {
'transcode': {
'hostPathEnabled': values['transcodeHostPathEnabled'],
**({'hostPath': values['transcodeHostPath']} if values.get('transcodeHostPath') else {})
},
'config': {
'hostPathEnabled': values['configHostPathEnabled'],
**({'hostPath': values['configHostPath']} if values.get('configHostPath') else {})
},
'data': {
'hostPathEnabled': values['dataHostPathEnabled'],
**({'hostPath': values['dataHostPath']} if values.get('dataHostPath') else {})
},
},
'updateStrategy': values.get('strategyType', 'Recreate'),
})
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))
apiVersion: apps/v1 {{ include "common.deployment.common_config" . | nindent 0 }}
kind: Deployment spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
metadata: template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
name: {{ include "plex.fullname" . }}
labels:
{{- include "plex.labels" . | nindent 4 }}
spec:
replicas: 1
revisionHistoryLimit: 3
strategy:
type: {{ .Values.strategyType }}
selector:
matchLabels:
{{- include "plex.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "plex.selectorLabels" . | nindent 8 }}
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec: spec:
{{- if .Values.hostNetwork }} {{- if .Values.hostNetwork }}
hostNetwork: {{ .Values.hostNetwork }} hostNetwork: {{ .Values.hostNetwork }}
...@@ -25,8 +8,9 @@ spec: ...@@ -25,8 +8,9 @@ spec:
{{- end }} {{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
imagePullPolicy: {{ .Values.image.pullPolicy }} {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 10 }}
{{ include "common.containers.gpuConfiguration" .Values | nindent 10 }}
ports: ports:
- name: pms - name: pms
protocol: TCP protocol: TCP
...@@ -53,43 +37,16 @@ spec: ...@@ -53,43 +37,16 @@ spec:
protocol: UDP protocol: UDP
containerPort: 32414 containerPort: 32414
env: env:
- name: TZ - name: KUBE_NAMESPACE
value: "{{ .Values.timezone }}" valueFrom:
# TODO: move this to a secret? fieldRef:
- name: PLEX_CLAIM fieldPath: metadata.namespace
value: "{{ .Values.claimToken }}" {{ $envList := (default list .Values.environmentVariables) }}
# plex env vars {{ $envList = mustAppend $envList (dict "name" "TZ" "value" .Values.timezone) }}
- name: PMS_INTERNAL_ADDRESS {{ $envList = mustAppend $envList (dict "name" "PLEX_CLAIM" "value" .Values.claimToken) }}
value: http://{{ template "plex.fullname" . }}:32400 {{ $envList = mustAppend $envList (dict "name" "PMS_INTERNAL_ADDRESS" "value" (printf "http://%s:32400" (include "common.names.fullname" .))) }}
- name: PMS_IMAGE {{ $envList = mustAppend $envList (dict "name" "PMS_IMAGE" "value" (printf "%s:%s" .Values.image.repository .Values.image.tag))}}
value: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
- name: KUBE_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.proxy.enabled }}
{{- if .Values.proxy.http }}
- name: "HTTP_PROXY"
value: "{{.Values.proxy.http}}"
{{- end }}
{{- if .Values.proxy.https }}
- name: "HTTPS_PROXY"
value: "{{.Values.proxy.https}}"
{{- end }}
{{- end }}
{{- if .Values.advertiseIp }}
- name: "ADVERTISE_IP"
value: "{{.Values.advertiseIp}}"
{{- end }}
{{- if .Values.allowedNetworks }}
- name: "ALLOWED_NETWORKS"
value: "{{include "joinListWithComma" .Values.allowedNetworks}}"
{{- end }}
# Extra ENV Values supplied by user
{{- range $key, $value := .Values.extraEnv }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /identity path: /identity
...@@ -109,45 +66,4 @@ spec: ...@@ -109,45 +66,4 @@ spec:
initialDelaySeconds: 5 initialDelaySeconds: 5
failureThreshold: 40 failureThreshold: 40
periodSeconds: 15 periodSeconds: 15
volumeMounts: {{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
- name: data
mountPath: /data
- name: config
mountPath: /config
- name: transcode
mountPath: /transcode
- name: shared
mountPath: /shared
- name: shared-logs
mountPath: "/config/Library/Application Support/Plex Media Server/Logs"
{{- if .Values.gpuConfiguration }}
resources:
limits:
{{- toYaml .Values.gpuConfiguration | nindent 14 }}
{{- end }}
volumes:
- name: data
{{- if .Values.emptyDirVolumes }}
emptyDir: {}
{{- else }}
hostPath:
path: {{ template "configuredHostPathData" . }}
{{- end }}
- name: config
{{- if .Values.emptyDirVolumes }}
emptyDir: {}
{{- else }}
hostPath:
path: {{ template "configuredHostPathConfig" . }}
{{- end }}
- name: transcode
{{- if .Values.emptyDirVolumes }}
emptyDir: {}
{{- else }}
hostPath:
path: {{ template "configuredHostPathTranscode" . }}
{{- end }}
- name: shared
emptyDir: {}
- name: shared-logs
emptyDir: {}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment