Closed harshanarayana closed 4 months ago
@harshanarayana Thank you for the pointers. I have added the logic to check for all the deployment related to kyverno to be available before we run the tests as part of the PR https://github.com/kubernetes-sigs/e2e-framework/pull/438 and have also ran the test multiple times using the following shell script:
#!/bin/bash
set -euo pipefail
for x in $(seq 1 15); do
echo "Running test ${x}"
set -x
go test -v ./... -count=1
set +x
sleep 5
kind get clusters
done
The test has not failed since then.
cc @vladimirvivien @cpanato
What happened?
It has been a few days since the tests started flaking too much.
https://prow.k8s.io/job-history/gs/kubernetes-jenkins/pr-logs/directory/pull-e2e-framework-test
I did some debug and found the following.
Looks like the flakiness is because the kyverno policy is not getting enforced always. The
nginx-1
deployment based pod is never supposed to start up as per the config, but it does. That leads to the tests failing.I0712 23:33:04.996051 19948 warning_handler.go:65] "would violate PodSecurity \"restricted:latest\": privileged (container \"nginx\" must not set securityContext.privileged=true), allowPrivilegeEscalation != false (container \"nginx\" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container \"nginx\" must set securityContext.capabilities.drop=[\"ALL\"]), runAsNonRoot != true (pod or container \"nginx\" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container \"nginx\" must set securityContext.seccompProfile.type to \"RuntimeDefault\" or \"Localhost\")" logger="KubeAPIWarningLogger"
It does generate this warning but doesn't seem to fail.
What did you expect to happen?
Tests not to flake
How can we reproduce it (as minimally and precisely as possible)?
for x in $(seq 1 15); do go test -count=1 ./...; done;
running this underexamples/third_party_integration/flux/kyverno
can easily reproduce flaky testsAnything elese we need to know?
No response
E2E Provider Used
kind
e2e-framework
VersionHEAD
OS version