deployment.yaml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {{ include "common.storage.hostPathValidate" .Values }}
  2. apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
  3. kind: Deployment
  4. metadata:
  5. name: {{ template "common.names.fullname" . }}-plex
  6. labels:
  7. app.kubernetes.io/name: {{ template "common.names.name" . }}
  8. app.kubernetes.io/instance: {{ .Release.Name }}
  9. spec:
  10. replicas: {{ (default 1 .Values.replicas) }}
  11. strategy:
  12. type: Recreate
  13. selector:
  14. matchLabels:
  15. app.kubernetes.io/name: {{ template "common.names.name" . }}
  16. app.kubernetes.io/instance: {{ .Release.Name }}
  17. template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
  18. spec:
  19. hostNetwork: {{ .Values.hostNetwork }}
  20. {{- if .Values.hostNetwork }}
  21. dnsPolicy: ClusterFirstWithHostNet
  22. {{- end }}
  23. hostname: {{ template "common.names.fullname" . }}
  24. {{- if hasKey .Values "global" }}
  25. {{- if hasKey .Values.global "ixChartContext" }}
  26. {{- if .Values.global.ixChartContext.addNvidiaRuntimeClass }}
  27. runtimeClassName: {{ .Values.global.ixChartContext.nvidiaRuntimeClassName }}
  28. {{- end }}
  29. {{- end }}
  30. {{- end }}
  31. containers:
  32. - name: {{ .Chart.Name }}
  33. {{ include "common.resources.limitation" . | nindent 10 }}
  34. {{ if .Values.enablePlexPass }}
  35. {{ include "common.containers.imageConfig" .Values.plexpassImage | nindent 10 }}
  36. {{ else }}
  37. {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
  38. {{ end }}
  39. volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
  40. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  41. - name: extrappvolume-{{ $index }}
  42. mountPath: {{ $hostPathConfiguration.mountPath }}
  43. {{ if $hostPathConfiguration.readOnly }}
  44. readOnly: {{ $hostPathConfiguration.readOnly }}
  45. {{ end }}
  46. {{ end }}
  47. ports:
  48. - name: pms
  49. protocol: TCP
  50. containerPort: 32400
  51. {{- if .Values.hostNetwork }}
  52. hostPort: {{ .Values.plexServiceTCP.port }}
  53. {{- else }}
  54. hostPort: null
  55. {{- end }}
  56. - name: plex-dlna
  57. protocol: TCP
  58. containerPort: 32469
  59. {{- if not .Values.hostNetwork }}
  60. hostPort: null
  61. {{- end }}
  62. - name: plex-dlna-udp
  63. protocol: UDP
  64. containerPort: 1900
  65. {{- if not .Values.hostNetwork }}
  66. hostPort: null
  67. {{- end }}
  68. - name: plex-gdm1
  69. protocol: UDP
  70. containerPort: 32410
  71. {{- if not .Values.hostNetwork }}
  72. hostPort: null
  73. {{- end }}
  74. - name: plex-gdm2
  75. protocol: UDP
  76. containerPort: 32412
  77. {{- if not .Values.hostNetwork }}
  78. hostPort: null
  79. {{- end }}
  80. - name: plex-gdm3
  81. protocol: UDP
  82. containerPort: 32413
  83. {{- if not .Values.hostNetwork }}
  84. hostPort: null
  85. {{- end }}
  86. - name: plex-gdm4
  87. protocol: UDP
  88. containerPort: 32414
  89. {{- if not .Values.hostNetwork }}
  90. hostPort: null
  91. {{- end }}
  92. env:
  93. - name: KUBE_NAMESPACE
  94. valueFrom:
  95. fieldRef:
  96. fieldPath: metadata.namespace
  97. - name: POD_IP
  98. valueFrom:
  99. fieldRef:
  100. fieldPath: status.podIP
  101. {{ $envList := (default list .Values.environmentVariables) }}
  102. {{ if and .Values.gpuConfiguration (hasKey .Values.gpuConfiguration "nvidia.com/gpu") (gt (get .Values.gpuConfiguration "nvidia.com/gpu" | toDecimal) 0) }}
  103. {{ $envList = mustAppend $envList (dict "name" "NVIDIA_DRIVER_CAPABILITIES" "value" "all") }}
  104. {{ end }}
  105. {{ $envList = mustAppend $envList (dict "name" "TZ" "value" .Values.timezone) }}
  106. {{ $envList = mustAppend $envList (dict "name" "PLEX_CLAIM" "value" .Values.claimToken) }}
  107. {{ $envList = mustAppend $envList (dict "name" "PMS_INTERNAL_ADDRESS" "value" (printf "http://%s:32400" (include "common.names.fullname" .))) }}
  108. {{ $envList = mustAppend $envList (dict "name" "PMS_IMAGE" "value" (printf "%s:%s" .Values.image.repository .Values.image.tag))}}
  109. {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
  110. readinessProbe:
  111. tcpSocket:
  112. port: 32400
  113. initialDelaySeconds: 10
  114. periodSeconds: 10
  115. timeoutSeconds: 5
  116. failureThreshold: 5
  117. successThreshold: 2
  118. livenessProbe:
  119. tcpSocket:
  120. port: 32400
  121. initialDelaySeconds: 10
  122. periodSeconds: 10
  123. timeoutSeconds: 5
  124. failureThreshold: 5
  125. successThreshold: 1
  126. startupProbe:
  127. tcpSocket:
  128. port: 32400
  129. initialDelaySeconds: 10
  130. periodSeconds: 5
  131. timeoutSeconds: 2
  132. failureThreshold: 60
  133. successThreshold: 1
  134. {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
  135. volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
  136. {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
  137. - name: extrappvolume-{{ $index }}
  138. hostPath:
  139. path: {{ $hostPathConfiguration.hostPath }}
  140. {{ end }}