From 9e81bbd8db0658def59694b9d5e29e461c759e1d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 10 Feb 2018 19:17:08 +0100 Subject: make use of new and revised worker flags for inputs --- src/examples/elevate2018.yml | 26 ++++++------ src/flufigut.py | 46 +++++++++++----------- .../kubernetes/flumotion-worker-deploy.yml.j2 | 36 +++++++++++++---- 3 files changed, 65 insertions(+), 43 deletions(-) diff --git a/src/examples/elevate2018.yml b/src/examples/elevate2018.yml index daa4abe..64605e7 100644 --- a/src/examples/elevate2018.yml +++ b/src/examples/elevate2018.yml @@ -97,16 +97,16 @@ streams: burst-on-connect: 5 hostname: "elevate-live%i.spreadspace.org" repeater: True -records: - av: - mux: avr - format: rec - profile: rec - directory: /srv/recording/elevate-2018 - filename: "%Y-%m-%d %H-%M-%S" - audio: - mux: audio-orig - format: ogg - profile: high - directory: /srv/recording/elevate-2018 - filename: "%Y-%m-%d %H-%M-%S" +# records: +# av: +# mux: avr +# format: rec +# profile: rec +# directory: /srv/recording/elevate-2018 +# filename: "%Y-%m-%d %H-%M-%S" +# audio: +# mux: audio-orig +# format: ogg +# profile: high +# directory: /srv/recording/elevate-2018 +# filename: "%Y-%m-%d %H-%M-%S" diff --git a/src/flufigut.py b/src/flufigut.py index aa5d2ce..d0de644 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -707,29 +707,29 @@ if __name__ == '__main__': print("- " + c) sys.exit(1) - print("****************************************************") - print("** atmosphere **") - print("**") - __pp.pprint(p.atmosphere) - print("**") - print("**************************") - print("** planet **") - print("**") - __pp.pprint(p.flow) - print("**") - print("**************************") - print("** _workers_ **") - print("**") - __pp.pprint(p.workers) - print("**") - print("****************************************************") - - # k8s = K8sDeployment(d, p) - # print("wiping exisiting namespace ...") - # k8s.wipe() - # print("deploying new planet ...") - # k8s.deploy('../templates') - # print("done.") + # print("****************************************************") + # print("** atmosphere **") + # print("**") + # __pp.pprint(p.atmosphere) + # print("**") + # print("**************************") + # print("** planet **") + # print("**") + # __pp.pprint(p.flow) + # print("**") + # print("**************************") + # print("** _workers_ **") + # print("**") + # __pp.pprint(p.workers) + # print("**") + # print("****************************************************") + + k8s = K8sDeployment(d, p) + print("wiping exisiting namespace ...") + k8s.wipe() + print("deploying new planet ...") + k8s.deploy('../templates') + print("done.") except Exception as e: print("ERROR: while running app: %s" % e) diff --git a/templates/default/kubernetes/flumotion-worker-deploy.yml.j2 b/templates/default/kubernetes/flumotion-worker-deploy.yml.j2 index bee42cc..0705364 100644 --- a/templates/default/kubernetes/flumotion-worker-deploy.yml.j2 +++ b/templates/default/kubernetes/flumotion-worker-deploy.yml.j2 @@ -48,30 +48,52 @@ spec: volumeMounts: - name: home mountPath: /srv -%% if 'input-decklink' in sub.flags - - name: decklink-devices - mountPath: /dev/blackmagic +%% 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-decklink' in worker.flags - - name: decklink-devices +%% 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: Directory - path: /dev/blackmagic + 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 -- cgit v1.2.3