110 lines
2.7 KiB
YAML
110 lines
2.7 KiB
YAML
{{ range $k, $v := .Values.linuxserverServices }}
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: {{$k}}-envs
|
|
data:
|
|
PUID: "1000"
|
|
PGID: "1000"
|
|
TZ: {{ $.Values.global.timezone }}
|
|
{{- range $envName, $envValue := ($v.envVars | default (dict )) }}
|
|
{{ $envName }}: "{{$envValue}}"
|
|
{{ end }}
|
|
|
|
---
|
|
kind: Service
|
|
apiVersion: v1
|
|
metadata:
|
|
name: {{ $k }}
|
|
spec:
|
|
selector:
|
|
app: {{ $k }}
|
|
type: ClusterIP
|
|
ports:
|
|
{{ range $portName, $portValue := $v.ports.tcp }}
|
|
- port: {{ $portValue }}
|
|
targetPort: {{ $portValue }}
|
|
name: "{{ $portName }}"
|
|
protocol: TCP
|
|
{{ end }}
|
|
{{- if $v.ports.udp -}}
|
|
{{ range $portName, $portValue := $v.ports.udp }}
|
|
- port: {{ $portValue }}
|
|
targetPort: {{ $portValue }}
|
|
name: "{{ $portName }}-udp"
|
|
protocol: UDP
|
|
{{ end }}
|
|
{{- end }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{$k}}
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app: {{$k}}
|
|
replicas: 1
|
|
revisionHistoryLimit: 2
|
|
updateStrategy:
|
|
type: RollingUpdate
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
finalizers:
|
|
- kubernetes.io/pvc-protection
|
|
name: config
|
|
spec:
|
|
storageClassName: {{ $.Values.global.nfs.storageClass }}
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
{{- $v.configVolumesResources | toYaml | nindent 10 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{$k}}
|
|
spec:
|
|
affinity:
|
|
nodeAffinity:
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 1
|
|
preference:
|
|
matchExpressions:
|
|
- key: homelab/capacity
|
|
operator: In
|
|
values:
|
|
- med
|
|
- low
|
|
containers:
|
|
- name: {{$k}}
|
|
image: "{{ $v.repo }}:{{ $v.tag }}"
|
|
imagePullPolicy: Always
|
|
envFrom:
|
|
- configMapRef:
|
|
name: {{$k}}-envs
|
|
resources:
|
|
{{- $v.podResources | toYaml | nindent 12 }}
|
|
ports:
|
|
{{ range $portName, $portValue := $v.ports.tcp }}
|
|
- containerPort: {{ $portValue }}
|
|
protocol: TCP
|
|
{{ end }}
|
|
{{- if $v.ports.udp -}}
|
|
{{ range $portName, $portValue := $v.ports.udp }}
|
|
- containerPort: {{ $portValue }}
|
|
protocol: UDP
|
|
{{ end }}
|
|
{{ end }}
|
|
volumeMounts:
|
|
- name: config
|
|
mountPath: /config
|
|
- name: torrents
|
|
mountPath: /torrents
|
|
volumes:
|
|
- name: torrents
|
|
nfs:
|
|
server: "{{ $.Values.global.nfs.server }}"
|
|
path: "{{ $.Values.global.nfs.additionalShares.torrents }}"
|
|
readOnly: false
|
|
{{ end }} |