From 7074e4255148234f6e1194163177cbe2ee98c8de Mon Sep 17 00:00:00 2001 From: Alessandro Thea Date: Thu, 24 Aug 2023 16:47:43 +0200 Subject: [PATCH] Apply readout k8s resource requirements only if real hardware is used --- python/daqconf/apps/readout_gen.py | 83 ++++++++++++++++-------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/python/daqconf/apps/readout_gen.py b/python/daqconf/apps/readout_gen.py index ee240d4f..cd1acb51 100644 --- a/python/daqconf/apps/readout_gen.py +++ b/python/daqconf/apps/readout_gen.py @@ -808,52 +808,55 @@ def generate( readout_app = App(mgraph, host=RU_DESCRIPTOR.host_name) - # Kubernetes-specific extensions - # FELIX - if RU_DESCRIPTOR.kind == 'flx': - - c = card_override if card_override != -1 else RU_DESCRIPTOR.iface - readout_app.resources = { - f"felix.cern/flx{c}-data": "1", # requesting FLX{c} - # "memory": f"{}Gi" # yes bro - } - readout_app.pod_privileged = True - - readout_app.mounted_dirs += [{ - 'name': 'devfs', - 'physical_location': '/dev', - 'in_pod_location': '/dev', - 'read_only': False, - }] - - # DPDK - elif RU_DESCRIPTOR.kind == 'eth': - - readout_app.resources = { - f"intel.com/intel_sriov_dpdk": "1", # requesting sriov - } + if cfg.use_fake_cards: + pass + else: + # Kubernetes-specific extensions + # FELIX + if RU_DESCRIPTOR.kind == 'flx': + + c = card_override if card_override != -1 else RU_DESCRIPTOR.iface + readout_app.resources = { + f"felix.cern/flx{c}-data": "1", # requesting FLX{c} + # "memory": f"{}Gi" # yes bro + } + readout_app.pod_privileged = True - readout_app.mounted_dirs += [ - { + readout_app.mounted_dirs += [{ 'name': 'devfs', 'physical_location': '/dev', 'in_pod_location': '/dev', 'read_only': False, - }, - { - 'name': 'linux-firmware', - 'physical_location': '/lib/firmware', - 'in_pod_location': '/lib/firmware', - 'read_only': True, + }] + + # DPDK + elif RU_DESCRIPTOR.kind == 'eth': + + readout_app.resources = { + f"intel.com/intel_sriov_dpdk": "1", # requesting sriov } - ] - - # Remove in favour of capabilites - readout_app.pod_privileged = True - readout_app.pod_capabilities += [ - "IPC_LOCK", - "CAP_NET_ADMIN" - ] + + readout_app.mounted_dirs += [ + { + 'name': 'devfs', + 'physical_location': '/dev', + 'in_pod_location': '/dev', + 'read_only': False, + }, + { + 'name': 'linux-firmware', + 'physical_location': '/lib/firmware', + 'in_pod_location': '/lib/firmware', + 'read_only': True, + } + ] + + # Remove in favour of capabilites + readout_app.pod_privileged = True + readout_app.pod_capabilities += [ + "IPC_LOCK", + "CAP_NET_ADMIN" + ] dir_names = set()