Merge pull request #101312 from harche/ContainerLogPath_fix

Add SELinux security context to ContainerLogPath test
This commit is contained in:
Kubernetes Prow Robot 2021-04-21 09:31:17 -07:00 committed by GitHub
commit 032007e007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ package e2enode
import (
"context"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
@ -74,7 +75,12 @@ var _ = SIGDescribe("ContainerLogPath [NodeConformance]", func() {
Containers: []v1.Container{
{
Image: busyboxImage,
Name: podName,
SecurityContext: &v1.SecurityContext{
SELinuxOptions: &v1.SELinuxOptions{
Type: "container_logreader_t",
},
},
Name: podName,
// If we find expected log file and contains right content, exit 0
// else, keep checking until test timeout
Command: []string{"sh", "-c", "while true; do if [ -e " + expectedLogPath + " ] && grep -q " + log + " " + expectedLogPath + "; then exit 0; fi; sleep 1; done"},