{{/* One ClusterIP service per enabled app container that listens on a port (recyclarr has none in daemon mode, so it gets no service). All containers share gluetun's network namespace, so every one of these services resolves to the same pod IP and they differ only in their port. Their purpose is a stable, per-app cluster-internal DNS name - each ingress points at its own app's service - not network separation between the apps. */}} {{- range $app := include "freesailarr.portApps" $ | fromJsonArray }} --- apiVersion: v1 kind: Service metadata: name: {{ $.Release.Name }}-{{ $.Chart.Name }}-{{ $app.name }}-service spec: selector: app: {{ $.Release.Name }}-{{ $.Chart.Name }}-sfs ports: - protocol: TCP port: {{ int $app.port }} targetPort: {{ $app.name }} name: {{ $app.name }} {{- /* An app with more than one port keeps them in ONE service rather than getting a second object: they belong to the same container and the same pod IP, and only the primary port is ever addressed by an ingress. mediathekarr is the only such app today - 5007 (SABnzbd role, primary) and 5008 (Newznab role). */}} {{- range $extra := $app.extraPorts | default list }} - protocol: TCP port: {{ int $extra.port }} targetPort: {{ $extra.name }} name: {{ $extra.name }} {{- end }} type: ClusterIP {{- end }}