From e5cbb7051b915c3e1b0eb8fcb10ad23e0ecf622b Mon Sep 17 00:00:00 2001 From: Aryan-sharma11 Date: Thu, 20 Jun 2024 16:39:21 +0530 Subject: [PATCH] remove kernel headers mount if btf found with initdeploy flag = true Signed-off-by: Aryan-sharma11 --- pkg/KubeArmorOperator/internal/controller/resources.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/KubeArmorOperator/internal/controller/resources.go b/pkg/KubeArmorOperator/internal/controller/resources.go index 94029195d1..ecc4fd799c 100644 --- a/pkg/KubeArmorOperator/internal/controller/resources.go +++ b/pkg/KubeArmorOperator/internal/controller/resources.go @@ -40,11 +40,13 @@ func generateDaemonset(name, enforcer, runtime, socket, btfPresent, apparmorfs, commonVols := common.CommonVolumes commonVolMnts := common.CommonVolumesMount - if btfPresent == "no" || initDeploy { + if initDeploy || btfPresent == "no" { + if btfPresent == "no" { + commonVols = append(commonVols, common.KernelHeaderVolumes...) + commonVolMnts = append(commonVolMnts, common.KernelHeaderVolumesMount...) + } commonVols = append(commonVols, common.BPFVolumes...) commonVolMnts = append(commonVolMnts, common.BPFVolumesMount...) - commonVols = append(commonVols, common.KernelHeaderVolumes...) - commonVolMnts = append(commonVolMnts, common.KernelHeaderVolumesMount...) } vols = append(vols, commonVols...) volMnts = append(volMnts, commonVolMnts...)