diff --git a/charts/media-common/Chart.yaml b/charts/media-common/Chart.yaml index 6f724c57..8772500b 100644 --- a/charts/media-common/Chart.yaml +++ b/charts/media-common/Chart.yaml @@ -2,10 +2,16 @@ apiVersion: v2 name: media-common description: Common dependancy chart for media ecosystem containers type: application -version: 1.0.1 +version: 1.1.0 keywords: - media-common home: https://github.com/k8s-at-home/charts/tree/master/charts/media-common maintainers: - name: DirtyCajunRice email: nick@cajun.pro +dependencies: + - name: media-common-openvpn + repository: https://k8s-at-home.com/charts/ + version: ^1.0.0 + condition: openvpn.enabled + alias: openvpn diff --git a/charts/media-common/README.md b/charts/media-common/README.md index 043d9a94..11f3218c 100644 --- a/charts/media-common/README.md +++ b/charts/media-common/README.md @@ -22,4 +22,9 @@ These values will normally be nested as it is a dependency, for example: ```yaml radarr: -``` \ No newline at end of file +``` + +## Add-ons + +### OpenVPN +It is possible to enable an OpenVPN add-on by setting `openvpn.enabled: true`. For more information refer to [k8s-at-home/media-common-openvpn](https://github.com/k8s-at-home/charts/tree/master/charts/media-common-openvpn) diff --git a/charts/media-common/ci/ct-values.yaml b/charts/media-common/ci/ct-values.yaml index 2e2ef0b2..d4e748eb 100644 --- a/charts/media-common/ci/ct-values.yaml +++ b/charts/media-common/ci/ct-values.yaml @@ -1,6 +1,30 @@ +--- image: organization: linuxserver repository: radarr tag: latest service: port: 7878 + +openvpn: + enabled: true + + image: + repository: dperson/openvpn-client + tag: latest + pullPolicy: IfNotPresent + + scripts: + up: + down: + + networkPolicy: + enabled: false + + livenessProbe: + initialDelaySeconds: 10 + periodSeconds: 10 + exec: + command: + - echo + - success diff --git a/charts/media-common/templates/_helpers.tpl b/charts/media-common/templates/_helpers.tpl index 96638404..b45e490b 100644 --- a/charts/media-common/templates/_helpers.tpl +++ b/charts/media-common/templates/_helpers.tpl @@ -50,3 +50,27 @@ Selector labels app.kubernetes.io/name: {{ include "media-common.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{/* +Additional Containers +*/}} +{{- define "media-common.additionalContainers" -}} +{{- if .Values.additionalContainers }} +{{- toYaml .Values.additionalContainers }} +{{- end }} +{{- if .Values.openvpn.enabled }} +{{ include "media-common.openvpn.container" . }} +{{- end }} +{{- end -}} + +{{/* +Additional Volumes +*/}} +{{- define "media-common.additionalVolumes" -}} +{{- if .Values.additionalVolumes }} +{{- toYaml .Values.additionalVolumes }} +{{- end }} +{{- if .Values.openvpn.enabled }} +{{ include "media-common.openvpn.volume" . }} +{{- end }} +{{- end -}} diff --git a/charts/media-common/templates/addon-openvpn.yaml b/charts/media-common/templates/addon-openvpn.yaml new file mode 100644 index 00000000..43d86634 --- /dev/null +++ b/charts/media-common/templates/addon-openvpn.yaml @@ -0,0 +1,8 @@ +{{- if .Values.openvpn.enabled -}} +--- +{{ include "media-common.openvpn.configmap" . }} +--- +{{ include "media-common.openvpn.secret" . }} +--- +{{ include "media-common.openvpn.networkpolicy" . }} +{{- end -}} \ No newline at end of file diff --git a/charts/media-common/templates/deployment.yaml b/charts/media-common/templates/deployment.yaml index a9139b77..aeb31bfb 100644 --- a/charts/media-common/templates/deployment.yaml +++ b/charts/media-common/templates/deployment.yaml @@ -74,6 +74,7 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} + {{- include "media-common.additionalContainers" . | nindent 8 }} volumes: - name: config {{- if .Values.persistence.config.enabled }} @@ -87,9 +88,7 @@ spec: persistentVolumeClaim: claimName: {{ if .Values.persistence.media.existingClaim }}{{ .Values.persistence.media.existingClaim }}{{- else }}{{ template "media-common.fullname" . }}-media{{- end }} {{- end }} - {{- if .Values.additionalVolumes }} - {{- toYaml .Values.additionalVolumes | nindent 8 }} - {{- end }} + {{- include "media-common.additionalVolumes" . | nindent 8 }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} diff --git a/charts/media-common/templates/statefulset.yaml b/charts/media-common/templates/statefulset.yaml index d3d62468..d004b3a0 100644 --- a/charts/media-common/templates/statefulset.yaml +++ b/charts/media-common/templates/statefulset.yaml @@ -75,6 +75,7 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} + {{- include "media-common.additionalContainers" . | nindent 8 }} volumes: - name: config {{- if .Values.persistence.config.enabled }} @@ -88,9 +89,7 @@ spec: persistentVolumeClaim: claimName: {{ if .Values.persistence.media.existingClaim }}{{ .Values.persistence.media.existingClaim }}{{- else }}{{ template "media-common.fullname" . }}-media{{- end }} {{- end }} - {{- if .Values.additionalVolumes }} - {{- toYaml .Values.additionalVolumes | nindent 8 }} - {{- end }} + {{- include "media-common.additionalVolumes" . | nindent 8 }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} diff --git a/charts/media-common/values.yaml b/charts/media-common/values.yaml index da2dac13..25ce4fc2 100644 --- a/charts/media-common/values.yaml +++ b/charts/media-common/values.yaml @@ -113,10 +113,17 @@ persistence: ## Do not delete the pvc upon helm uninstall skipuninstall: false +additionalContainers: [] + additionalVolumes: [] additionalVolumeMounts: [] +# Enable the OpenVPN add-on here +# See https://github.com/k8s-at-home/charts/tree/master/charts/media-common-openvpn for more details +openvpn: + enabled: false + podSecurityContext: {} # fsGroup: 2000