Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End2End - Pod Security Admission fixes #368

Merged
merged 2 commits into from
Oct 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion test/util/namespaces/namespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ import (
// Test is the namespace to be use for testing
const Test = "sriov-conformance-testing"

var inhibitSecurityAdmissionLabels = map[string]string{
"pod-security.kubernetes.io/audit": "privileged",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to align this with what we have for #371

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see the labels have a delta.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wizhaoredhat this is fine for the test-pods we have this in other places where we run tests like openshift-kni/cnf-features-deploy#1238

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, got it. Thanks!

"pod-security.kubernetes.io/enforce": "privileged",
"pod-security.kubernetes.io/warn": "privileged",
"security.openshift.io/scc.podSecurityLabelSync": "false",
}

// WaitForDeletion waits until the namespace will be removed from the cluster
func WaitForDeletion(cs *testclient.ClientSet, nsName string, timeout time.Duration) error {
return wait.PollImmediate(time.Second, timeout, func() (bool, error) {
Expand All @@ -36,7 +43,8 @@ func WaitForDeletion(cs *testclient.ClientSet, nsName string, timeout time.Durat
func Create(namespace string, cs *testclient.ClientSet) error {
_, err := cs.Namespaces().Create(context.Background(), &k8sv1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: namespace,
Name: namespace,
Labels: inhibitSecurityAdmissionLabels,
}}, metav1.CreateOptions{})

if k8serrors.IsAlreadyExists(err) {
Expand Down