Skip to content

Commit 11f3a1b

Browse files
committed
Automate OCP-70987: Allow dev fuse by default in CRI-O
1 parent b039d39 commit 11f3a1b

3 files changed

Lines changed: 102 additions & 1 deletion

File tree

test/extended/node/node_e2e/node.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package node
22

33
import (
4+
"path/filepath"
45
"strings"
56
"time"
67

@@ -14,7 +15,9 @@ import (
1415

1516
var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager", func() {
1617
var (
17-
oc = exutil.NewCLIWithoutNamespace("node")
18+
oc = exutil.NewCLIWithoutNamespace("node")
19+
nodeE2EBaseDir = exutil.FixturePath("testdata", "node", "node_e2e")
20+
podDevFuseYAML = filepath.Join(nodeE2EBaseDir, "pod-dev-fuse.yaml")
1821
)
1922

2023
// Skip all tests on MicroShift clusters as MachineConfig resources are not available
@@ -103,4 +106,40 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
103106
o.Expect(err).Should(o.HaveOccurred())
104107
o.Expect(output).To(o.ContainSubstring("spec.cgroupMode: Unsupported value: \"v1\": supported values: \"v2\", \"\""))
105108
})
109+
110+
//author: cmaurya@redhat.com
111+
g.It("[OTP] Allow dev fuse by default in CRI-O [OCP-70987]", func() {
112+
podName := "pod-devfuse"
113+
ns := "devfuse-test"
114+
115+
g.By("Create a test namespace")
116+
err := oc.AsAdmin().WithoutNamespace().Run("create").Args("namespace", ns).Execute()
117+
o.Expect(err).NotTo(o.HaveOccurred())
118+
defer oc.AsAdmin().WithoutNamespace().Run("delete").Args("namespace", ns, "--ignore-not-found").Execute()
119+
120+
g.By("Create a pod with dev fuse annotation")
121+
err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", podDevFuseYAML, "-n", ns).Execute()
122+
o.Expect(err).NotTo(o.HaveOccurred())
123+
124+
g.By("Wait for pod to be ready")
125+
err = wait.Poll(5*time.Second, 1*time.Minute, func() (bool, error) {
126+
status, pollErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", podName, "-n", ns, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}").Output()
127+
if pollErr != nil {
128+
e2e.Logf("Error polling pod status: %v", pollErr)
129+
return false, nil
130+
}
131+
return status == "True", nil
132+
})
133+
if err != nil {
134+
podStatus, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", podName, "-n", ns, "-o=jsonpath={.status}").Output()
135+
e2e.Logf("Pod status on timeout: %s", podStatus)
136+
}
137+
o.Expect(err).NotTo(o.HaveOccurred(), "pod did not become ready")
138+
139+
g.By("Check /dev/fuse is mounted inside the pod")
140+
output, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(podName, "-n", ns, "--", "stat", "/dev/fuse").Output()
141+
o.Expect(err).NotTo(o.HaveOccurred())
142+
e2e.Logf("/dev/fuse mount output: %s", output)
143+
o.Expect(output).To(o.ContainSubstring("fuse"), "dev fuse is not mounted inside pod")
144+
})
106145
})

test/extended/testdata/bindata.go

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-devfuse
5+
annotations:
6+
io.kubernetes.cri-o.Devices: "/dev/fuse"
7+
spec:
8+
securityContext:
9+
runAsNonRoot: true
10+
seccompProfile:
11+
type: RuntimeDefault
12+
containers:
13+
- name: pod-devfuse
14+
image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
15+
command: ["sleep", "infinity"]
16+
securityContext:
17+
allowPrivilegeEscalation: false
18+
capabilities:
19+
drop:
20+
- ALL

0 commit comments

Comments
 (0)