deployment.yaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: {{ include "plex.fullname" . }}
  5. labels:
  6. {{- include "plex.labels" . | nindent 4 }}
  7. spec:
  8. replicas: 1
  9. revisionHistoryLimit: 3
  10. strategy:
  11. type: {{ .Values.strategyType }}
  12. selector:
  13. matchLabels:
  14. {{- include "plex.selectorLabels" . | nindent 6 }}
  15. template:
  16. metadata:
  17. labels:
  18. {{- include "plex.selectorLabels" . | nindent 8 }}
  19. annotations:
  20. rollme: {{ randAlphaNum 5 | quote }}
  21. spec:
  22. {{- if .Values.hostNetwork }}
  23. hostNetwork: {{ .Values.hostNetwork }}
  24. dnsPolicy: ClusterFirstWithHostNet
  25. {{- end }}
  26. containers:
  27. - name: {{ .Chart.Name }}
  28. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  29. imagePullPolicy: {{ .Values.image.pullPolicy }}
  30. ports:
  31. - name: pms
  32. protocol: TCP
  33. containerPort: 32400
  34. {{- if .Values.hostNetwork }}
  35. hostPort: {{ .Values.plexServiceTCP.port }}
  36. {{- end }}
  37. - name: plex-dlna
  38. protocol: TCP
  39. containerPort: 32469
  40. - name: plex-dlna-udp
  41. protocol: UDP
  42. containerPort: 1900
  43. - name: plex-gdm1
  44. protocol: UDP
  45. containerPort: 32410
  46. - name: plex-gdm2
  47. protocol: UDP
  48. containerPort: 32412
  49. - name: plex-gdm3
  50. protocol: UDP
  51. containerPort: 32413
  52. - name: plex-gdm4
  53. protocol: UDP
  54. containerPort: 32414
  55. env:
  56. - name: TZ
  57. value: "{{ .Values.timezone }}"
  58. # TODO: move this to a secret?
  59. - name: PLEX_CLAIM
  60. value: "{{ .Values.claimToken }}"
  61. # plex env vars
  62. - name: PMS_INTERNAL_ADDRESS
  63. value: http://{{ template "plex.fullname" . }}:32400
  64. - name: PMS_IMAGE
  65. value: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  66. - name: KUBE_NAMESPACE
  67. valueFrom:
  68. fieldRef:
  69. fieldPath: metadata.namespace
  70. {{- if .Values.proxy.enabled }}
  71. {{- if .Values.proxy.http }}
  72. - name: "HTTP_PROXY"
  73. value: "{{.Values.proxy.http}}"
  74. {{- end }}
  75. {{- if .Values.proxy.https }}
  76. - name: "HTTPS_PROXY"
  77. value: "{{.Values.proxy.https}}"
  78. {{- end }}
  79. {{- end }}
  80. {{- if .Values.advertiseIp }}
  81. - name: "ADVERTISE_IP"
  82. value: "{{.Values.advertiseIp}}"
  83. {{- end }}
  84. {{- if .Values.allowedNetworks }}
  85. - name: "ALLOWED_NETWORKS"
  86. value: "{{include "joinListWithComma" .Values.allowedNetworks}}"
  87. {{- end }}
  88. # Extra ENV Values supplied by user
  89. {{- range $key, $value := .Values.extraEnv }}
  90. - name: {{ $key }}
  91. value: {{ $value }}
  92. {{- end }}
  93. readinessProbe:
  94. httpGet:
  95. path: /identity
  96. port: 32400
  97. failureThreshold: 5
  98. periodSeconds: 15
  99. livenessProbe:
  100. httpGet:
  101. path: /identity
  102. port: 32400
  103. failureThreshold: 5
  104. periodSeconds: 15
  105. startupProbe:
  106. httpGet:
  107. path: /identity
  108. port: 32400
  109. initialDelaySeconds: 5
  110. failureThreshold: 40
  111. periodSeconds: 15
  112. volumeMounts:
  113. - name: data
  114. mountPath: /data
  115. - name: config
  116. mountPath: /config
  117. - name: transcode
  118. mountPath: /transcode
  119. - name: shared
  120. mountPath: /shared
  121. - name: shared-logs
  122. mountPath: "/config/Library/Application Support/Plex Media Server/Logs"
  123. {{- if .Values.gpuConfiguration }}
  124. resources:
  125. limits:
  126. {{- toYaml .Values.gpuConfiguration | nindent 14 }}
  127. {{- end }}
  128. volumes:
  129. - name: data
  130. {{- if .Values.emptyDirVolumes }}
  131. emptyDir: {}
  132. {{- else }}
  133. hostPath:
  134. path: {{ template "configuredHostPathData" . }}
  135. {{- end }}
  136. - name: config
  137. {{- if .Values.emptyDirVolumes }}
  138. emptyDir: {}
  139. {{- else }}
  140. hostPath:
  141. path: {{ template "configuredHostPathConfig" . }}
  142. {{- end }}
  143. - name: transcode
  144. {{- if .Values.emptyDirVolumes }}
  145. emptyDir: {}
  146. {{- else }}
  147. hostPath:
  148. path: {{ template "configuredHostPathTranscode" . }}
  149. {{- end }}
  150. - name: shared
  151. emptyDir: {}
  152. - name: shared-logs
  153. emptyDir: {}