From f1e9a7678920bae16fda6120dc2d3cf9d5261809 Mon Sep 17 00:00:00 2001
From: Karel Suta <ksuta@redhat.com>
Date: Wed, 27 Nov 2024 13:02:53 +0100
Subject: [PATCH] Add --cgroup-manager cgroupfs for e2e PR check

---
 .github/workflows/e2e_tests.yaml | 3 +++
 Makefile                         | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/e2e_tests.yaml b/.github/workflows/e2e_tests.yaml
index 7c8365652..c6cccde5f 100644
--- a/.github/workflows/e2e_tests.yaml
+++ b/.github/workflows/e2e_tests.yaml
@@ -75,6 +75,9 @@ jobs:
           kind load image-archive cfo.tar --name cluster --verbosity 1000
           make deploy -e IMG="${IMG}" -e ENV="e2e"
           kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager
+        env:
+          # cgroup-manager configuration is required for NVidia image used in e2e PR check
+          IMAGE_BUILD_FLAGS: '--cgroup-manager cgroupfs'
 
       - name: Run e2e tests
         run: |
diff --git a/Makefile b/Makefile
index 5ae089c59..ba5925a3d 100644
--- a/Makefile
+++ b/Makefile
@@ -77,6 +77,10 @@ endif
 
 # Image URL to use all building/pushing image targets
 IMG ?= ${IMAGE_TAG_BASE}:${VERSION}
+
+# IMAGE_BUILD_FLAGS are the flags passed to the podman operator image build command
+IMAGE_BUILD_FLAGS :=
+
 # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
 ENVTEST_K8S_VERSION = 1.24.2
 
@@ -184,7 +188,7 @@ run: manifests fmt vet ## Run a controller from your host.
 
 .PHONY: image-build
 image-build: test-unit ## Build container image with the manager.
-	podman build -t ${IMG} .
+	podman $(IMAGE_BUILD_FLAGS) build -t ${IMG} .
 
 .PHONY: image-push
 image-push: image-build ## Push container image with the manager.