tests: k8s-policy-pod: use prometheus container

Change quay.io/prometheus/busybox to quay.io/prometheus/prometheus in
this test. The prometheus image will be helpful for testing the future
fix for #9928 because it specifies user = "nobody".

Also, change:

sh -c "ls -l /"

to:

echo -n "readinessProbe with space characters"

as the test readinessProbe command line. Both include a command line
argument containing space characters, but "sh -c" behaves differently
when using the prometheus container image (causes the readinessProbe
to time out, etc.).

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
Dan Mihai 2024-09-11 17:29:07 +00:00
parent 614328f342
commit 71ede4ea3f
2 changed files with 8 additions and 6 deletions

View File

@ -216,7 +216,7 @@ test_pod_policy_error() {
# Execute commands allowed by the policy.
pod_exec_allowed_command "${pod_name}" "echo" "livenessProbe" "test"
pod_exec_allowed_command "${pod_name}" "sh" "-c" "ls -l /"
pod_exec_allowed_command "${pod_name}" "echo" "-n" "readinessProbe with space characters"
pod_exec_allowed_command "${pod_name}" "echo" "startupProbe" "test"
# Try to execute commands disallowed by the policy.

View File

@ -11,8 +11,10 @@ spec:
terminationGracePeriodSeconds: 0
runtimeClassName: kata
containers:
- name: busybox
image: quay.io/prometheus/busybox:latest
- name: prometheus
image: quay.io/prometheus/prometheus:latest
command:
- /bin/sh
env:
- name: KUBE_CONFIG_1
valueFrom:
@ -40,9 +42,9 @@ spec:
readinessProbe:
exec:
command:
- "sh"
- "-c"
- "ls -l /"
- "echo"
- "-n"
- "readinessProbe with space characters"
startupProbe:
exec:
command: