mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #27958 from aveshagarwal/master-node-e2e-issues
Automatic merge from submit-queue Fix node e2e issues on selinux enabled systems It fixes following 3 node e2es: ``` [Fail] [k8s.io] Container Runtime Conformance Test container runtime conformance blackbox test when starting a container that exits [It] it should run with the expected status [Conformance] /root/upstream-code/gocode/src/k8s.io/kubernetes/test/e2e_node/runtime_conformance_test.go:114 [Fail] [k8s.io] Kubelet metrics api when querying /stats/summary [It] it should report resource usage through the stats api /root/upstream-code/gocode/src/k8s.io/kubernetes/test/e2e_node/kubelet_test.go:158 ``` ``` [Fail] [k8s.io] Container Runtime Conformance Test container runtime conformance blackbox test when starting a container that exits [It] should report termination message if TerminationMessagePath is set [Conformance] /root/upstream-code/gocode/src/k8s.io/kubernetes/test/e2e_node/runtime_conformance_test.go:150 ``` @kubernetes/rh-cluster-infra
This commit is contained in:
commit
fd523abd57
@ -34,7 +34,8 @@ type ConformanceContainer struct {
|
|||||||
Volumes []api.Volume
|
Volumes []api.Volume
|
||||||
ImagePullSecrets []string
|
ImagePullSecrets []string
|
||||||
|
|
||||||
podName string
|
podName string
|
||||||
|
PodSecurityContext *api.PodSecurityContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cc *ConformanceContainer) Create() {
|
func (cc *ConformanceContainer) Create() {
|
||||||
@ -52,6 +53,7 @@ func (cc *ConformanceContainer) Create() {
|
|||||||
Containers: []api.Container{
|
Containers: []api.Container{
|
||||||
cc.Container,
|
cc.Container,
|
||||||
},
|
},
|
||||||
|
SecurityContext: cc.PodSecurityContext,
|
||||||
Volumes: cc.Volumes,
|
Volumes: cc.Volumes,
|
||||||
ImagePullSecrets: imagePullSecrets,
|
ImagePullSecrets: imagePullSecrets,
|
||||||
},
|
},
|
||||||
|
@ -178,6 +178,11 @@ func createSummaryTestPods(f *framework.Framework, podNamePrefix string, count i
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
SecurityContext: &api.PodSecurityContext{
|
||||||
|
SELinuxOptions: &api.SELinuxOptions{
|
||||||
|
Level: "s0",
|
||||||
|
},
|
||||||
|
},
|
||||||
Volumes: []api.Volume{
|
Volumes: []api.Volume{
|
||||||
// TODO: Test secret volumes
|
// TODO: Test secret volumes
|
||||||
// TODO: Test hostpath volumes
|
// TODO: Test hostpath volumes
|
||||||
|
@ -18,8 +18,6 @@ package e2e_node
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"path"
|
"path"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -58,9 +56,7 @@ var _ = framework.KubeDescribe("Container Runtime Conformance Test", func() {
|
|||||||
{
|
{
|
||||||
Name: restartCountVolumeName,
|
Name: restartCountVolumeName,
|
||||||
VolumeSource: api.VolumeSource{
|
VolumeSource: api.VolumeSource{
|
||||||
HostPath: &api.HostPathVolumeSource{
|
EmptyDir: &api.EmptyDirVolumeSource{Medium: api.StorageMediumMemory},
|
||||||
Path: os.TempDir(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -77,9 +73,6 @@ var _ = framework.KubeDescribe("Container Runtime Conformance Test", func() {
|
|||||||
{"terminate-cmd-rpn", api.RestartPolicyNever, api.PodFailed, ContainerStateTerminated, 0, false},
|
{"terminate-cmd-rpn", api.RestartPolicyNever, api.PodFailed, ContainerStateTerminated, 0, false},
|
||||||
}
|
}
|
||||||
for _, testCase := range testCases {
|
for _, testCase := range testCases {
|
||||||
tmpFile, err := ioutil.TempFile("", "restartCount")
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
|
||||||
defer os.Remove(tmpFile.Name())
|
|
||||||
|
|
||||||
// It failed at the 1st run, then succeeded at 2nd run, then run forever
|
// It failed at the 1st run, then succeeded at 2nd run, then run forever
|
||||||
cmdScripts := `
|
cmdScripts := `
|
||||||
@ -93,7 +86,7 @@ if [ $count -eq 2 ]; then
|
|||||||
fi
|
fi
|
||||||
while true; do sleep 1; done
|
while true; do sleep 1; done
|
||||||
`
|
`
|
||||||
tmpCmd := fmt.Sprintf(cmdScripts, path.Join(restartCountVolumePath, path.Base(tmpFile.Name())))
|
tmpCmd := fmt.Sprintf(cmdScripts, path.Join(restartCountVolumePath, "restartCount"))
|
||||||
testContainer.Name = testCase.Name
|
testContainer.Name = testCase.Name
|
||||||
testContainer.Command = []string{"sh", "-c", tmpCmd}
|
testContainer.Command = []string{"sh", "-c", tmpCmd}
|
||||||
terminateContainer := ConformanceContainer{
|
terminateContainer := ConformanceContainer{
|
||||||
@ -101,6 +94,11 @@ while true; do sleep 1; done
|
|||||||
Container: testContainer,
|
Container: testContainer,
|
||||||
RestartPolicy: testCase.RestartPolicy,
|
RestartPolicy: testCase.RestartPolicy,
|
||||||
Volumes: testVolumes,
|
Volumes: testVolumes,
|
||||||
|
PodSecurityContext: &api.PodSecurityContext{
|
||||||
|
SELinuxOptions: &api.SELinuxOptions{
|
||||||
|
Level: "s0",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
terminateContainer.Create()
|
terminateContainer.Create()
|
||||||
defer terminateContainer.Delete()
|
defer terminateContainer.Delete()
|
||||||
@ -133,6 +131,7 @@ while true; do sleep 1; done
|
|||||||
name := "termination-message-container"
|
name := "termination-message-container"
|
||||||
terminationMessage := "DONE"
|
terminationMessage := "DONE"
|
||||||
terminationMessagePath := "/dev/termination-log"
|
terminationMessagePath := "/dev/termination-log"
|
||||||
|
priv := true
|
||||||
c := ConformanceContainer{
|
c := ConformanceContainer{
|
||||||
Framework: f,
|
Framework: f,
|
||||||
Container: api.Container{
|
Container: api.Container{
|
||||||
@ -141,6 +140,9 @@ while true; do sleep 1; done
|
|||||||
Command: []string{"/bin/sh", "-c"},
|
Command: []string{"/bin/sh", "-c"},
|
||||||
Args: []string{fmt.Sprintf("/bin/echo -n %s > %s", terminationMessage, terminationMessagePath)},
|
Args: []string{fmt.Sprintf("/bin/echo -n %s > %s", terminationMessage, terminationMessagePath)},
|
||||||
TerminationMessagePath: terminationMessagePath,
|
TerminationMessagePath: terminationMessagePath,
|
||||||
|
SecurityContext: &api.SecurityContext{
|
||||||
|
Privileged: &priv,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
RestartPolicy: api.RestartPolicyNever,
|
RestartPolicy: api.RestartPolicyNever,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user