apiVersion: apps/v1 kind: Deployment metadata: namespace: {{ namespace }} name: flumotion-worker-{{ worker.name }} labels: app: flumotion type: worker spec: replicas: 1 selector: matchLabels: app: flumotion type: worker strategy: type: Recreate revisionHistoryLimit: 5 template: metadata: labels: app: flumotion type: worker spec: nodeName: {{ worker.name }} securityContext: runAsUser: 998 fsGroup: 998 containers: %% for subname, sub in worker.subs.items() - name: {{ subname }} image: spreadspace/flumotion:worker-{{ desc.globals.deployment.parameter.image_version }} imagePullPolicy: Always env: - name: WORKER_PASSWORD valueFrom: secretKeyRef: name: flumotion-worker-{{ worker.name }} key: password args: - --verbose - -H {{ desc.globals.manager.host }} - -P {{ desc.globals.manager.port }} - -T {{ desc.globals.manager.transport }} - -n {{ sub.fullname }} - -u {{ worker.name }} - -p $(WORKER_PASSWORD) - -F {{ 7000 + loop.index0 * 10 }}-{{ 7001 + loop.index0 * 10 }} volumeMounts: - name: home mountPath: /srv %% if 'input' in sub.flags %% set _needs_ = { 'decklink_libs': False, 'privileged': False } %% for input_name in worker.flags.input %% if desc.inputs[input_name].type == 'decklink' %% if _needs_.update({'decklink_libs': True, 'privileged': True}) %# jinja variables are weird... https://stackoverflow.com/questions/9486393 %% endif - name: decklink-device-{{ desc.inputs[input_name].properties.device }} mountPath: /dev/blackmagic/dv{{ desc.inputs[input_name].properties.device }} %% endif %% endfor %% if _needs_.decklink_libs - name: decklink-libs subPath: libDeckLinkAPI.so mountPath: /usr/lib/libDeckLinkAPI.so - name: decklink-libs subPath: libDeckLinkPreviewAPI.so mountPath: /usr/lib/libDeckLinkPreviewAPI.so %% endif %% if _needs_.privileged securityContext: privileged: true %% endif %% endif %% endfor volumes: - name: home emptyDir: medium: Memory %% if 'input' in worker.flags %% set _needs_ = { 'decklink_libs': False } %% for input_name in worker.flags.input %% if desc.inputs[input_name].type == 'decklink' %% if _needs_.update({'decklink_libs': True}) %# jinja variables are weird... https://stackoverflow.com/questions/9486393 %% endif - name: decklink-device-{{ desc.inputs[input_name].properties.device }} hostPath: type: File {# CharDevice doesn't work for some reason... #} path: /dev/blackmagic/dv{{ desc.inputs[input_name].properties.device }} %% endif %% endfor %% if _needs_.decklink_libs - name: decklink-libs hostPath: type: Directory path: /usr/lib/ %% endif %% endif