element_type
stringclasses 4
values | project_name
stringclasses 1
value | uuid
stringlengths 36
36
| name
stringlengths 0
346
| imports
stringlengths 0
2.67k
| structs
stringclasses 761
values | interfaces
stringclasses 22
values | file_location
stringclasses 545
values | code
stringlengths 26
8.07M
| global_vars
stringclasses 7
values | package
stringclasses 124
values | tags
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
function
|
openshift/openshift-tests-private
|
ba276b47-8947-49e2-b6b7-51eba6d39782
|
create
|
['"strconv"']
|
['liveProbeNoTermPeriod']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (liveProbe *liveProbeNoTermPeriod) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", liveProbe.template, "-p", "NAME="+liveProbe.name, "NAMESPACE="+liveProbe.namespace, "TERMINATIONGRACE="+strconv.Itoa(liveProbe.terminationgrace))
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
0d2c5908-70b9-449a-9855-d65efd2fa21d
|
delete
|
['liveProbeNoTermPeriod']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (liveProbe *liveProbeNoTermPeriod) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", liveProbe.namespace, "pod", liveProbe.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
beabc004-e86f-458c-9064-b39e0d05f74c
|
create
|
['podNoWkloadCpuDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podNoWkloadCpu *podNoWkloadCpuDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podNoWkloadCpu.template, "-p", "NAME="+podNoWkloadCpu.name, "NAMESPACE="+podNoWkloadCpu.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
e7975c97-2c22-4a16-ba98-fbda6d9eec9f
|
delete
|
['podNoWkloadCpuDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podNoWkloadCpu *podNoWkloadCpuDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podNoWkloadCpu.namespace, "pod", podNoWkloadCpu.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
1255ec69-a65d-4f61-9998-e0ea8a21b341
|
create
|
['podGuDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podGu *podGuDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podGu.template, "-p", "NAME="+podGu.name, "NAMESPACE="+podGu.namespace, "NODENAME="+podGu.nodename)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
a1dbc53f-3cf2-4876-9f4e-e5dbeea14301
|
delete
|
['podGuDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podGu *podGuDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podGu.namespace, "pod", podGu.name, "--ignore-not-found").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
3730b9b4-8e0f-4fc9-b9f0-181a18bda5eb
|
getWorkersList
|
['"strings"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getWorkersList(oc *exutil.CLI) []string {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "-l", "node-role.kubernetes.io/worker", "-o=jsonpath={.items[*].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
return strings.Fields(output)
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
c09dbeaf-2fa2-4a6f-a35a-a1f0e1ae5e5c
|
getCpuNum
|
['"strconv"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getCpuNum(oc *exutil.CLI, node string) int {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("node", node, "-o=jsonpath={.status.capacity.cpu}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
cpuNum, err := strconv.Atoi(output)
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("Cpu num is: [%d]\n", cpuNum)
return cpuNum
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
d516fb40-5ab2-4bdc-90cb-908401296b61
|
getCgroupVersion
|
['"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getCgroupVersion(oc *exutil.CLI) string {
workerNodes := getWorkersList(oc)
cgroupV, err := exutil.DebugNodeWithChroot(oc, workerNodes[0], "/bin/bash", "-c", "stat -fc %T /sys/fs/cgroup")
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("cgroup version info is: [%v]\n", cgroupV)
if strings.Contains(string(cgroupV), "tmpfs") {
return "tmpfs"
} else if strings.Contains(string(cgroupV), "cgroup2fs") {
return "cgroup2fs"
} else {
return cgroupV
}
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
a1eb3c94-7466-4729-9b3f-cfc35d261f79
|
checkReservedCpu
|
['"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkReservedCpu(oc *exutil.CLI, reservedCpu string) {
workerNodes := getWorkersList(oc)
err := wait.Poll(3*time.Second, 15*time.Second, func() (bool, error) {
for _, node := range workerNodes {
nodeStatus, statusErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", node, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}").Output()
o.Expect(statusErr).NotTo(o.HaveOccurred())
e2e.Logf("\nNode %s Status is %s\n", node, nodeStatus)
if nodeStatus == "True" {
kubeletConf, err := exutil.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "cat /etc/kubernetes/kubelet.conf | grep reservedSystemCPUs")
o.Expect(err).NotTo(o.HaveOccurred())
//need match : "reservedSystemCPUs": "0-3"
cpuStr := `"reservedSystemCPUs": "` + reservedCpu + `"`
if strings.Contains(string(kubeletConf), cpuStr) {
e2e.Logf("Reserved Cpu: [%s], is expected \n", kubeletConf)
crioOutput, err := exutil.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "pgrep crio | while read i; do taskset -cp $i; done")
o.Expect(err).NotTo(o.HaveOccurred())
crioCpuStr := "current affinity list: " + reservedCpu
if strings.Contains(crioOutput, crioCpuStr) {
e2e.Logf("crio use CPU: [%s], is expected \n", crioOutput)
return true, nil
} else {
e2e.Logf("crio use CPU: [%s], not expected \n", crioOutput)
return false, nil
}
} else {
e2e.Logf("Reserved Cpu: [%s], not expected \n", kubeletConf)
return false, nil
}
} else {
e2e.Logf("\n NODE %s IS NOT READY\n", node)
}
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("Check reservedCpu failed!\n"))
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
a2cae3c4-e144-4ff7-9302-e5207727bb32
|
NewDeployment
|
['deployment']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func NewDeployment(name, namespace, replicas, template string) *deployment {
return &deployment{name, namespace, replicas, "", "", template}
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
e003291d-822b-457d-b78a-ad31b97e0a8d
|
NewDeploymentWithNode
|
['deployment']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func NewDeploymentWithNode(name, namespace, replicas, hostname, template string) *deployment {
return &deployment{name, namespace, replicas, "", hostname, template}
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
6dffe294-282c-4421-babb-ddf3b1069887
|
NewDeploymentWithImage
|
['deployment']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func NewDeploymentWithImage(name, namespace, replicas, image, template string) *deployment {
return &deployment{name, namespace, replicas, image, "", template}
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
9cc91610-949c-457e-b34c-630f667d0a6d
|
create
|
['deployment']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (deployment *deployment) create(oc *exutil.CLI) {
imageArg := ""
nodenameArg := ""
if deployment.image != "" {
imageArg = "IMAGE=" + deployment.image
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", deployment.template, "-p", "NAME="+deployment.name, "NAMESPACE="+deployment.namespace, "REPLICAS="+deployment.replicas, imageArg)
o.Expect(err).NotTo(o.HaveOccurred())
} else if deployment.nodename != "" {
nodenameArg = "NODENAME=" + deployment.nodename
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", deployment.template, "-p", "NAME="+deployment.name, "NAMESPACE="+deployment.namespace, "REPLICAS="+deployment.replicas, nodenameArg)
o.Expect(err).NotTo(o.HaveOccurred())
} else {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", deployment.template, "-p", "NAME="+deployment.name, "NAMESPACE="+deployment.namespace, "REPLICAS="+deployment.replicas)
o.Expect(err).NotTo(o.HaveOccurred())
}
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
bef68b69-84e2-4383-833d-c8c0ff232a74
|
waitForCreation
|
['"fmt"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['deployment']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (deployment *deployment) waitForCreation(oc *exutil.CLI, timeoutMin int) {
err := wait.Poll(3*time.Second, time.Duration(timeoutMin)*time.Minute, func() (bool, error) {
msg, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("deployment", deployment.name, "-o=jsonpath={.status.readyReplicas}", "-n", deployment.namespace).Output()
if err != nil {
e2e.Logf("Command failed with error: %s .... there are no ready workloads", err)
return false, nil
}
if (msg == "" && deployment.replicas == "0") || msg == deployment.replicas {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("fail to create deployment %v in namespace %v", deployment.name, deployment.namespace))
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
a8fd81f8-9fd1-4a38-9c2d-96afa9675e47
|
delete
|
['deployment']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (deployment *deployment) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", deployment.namespace, "deployment", deployment.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
d8df0df9-1314-4aa8-81f5-df395f0e168f
|
NewPDB
|
['podDisruptionBudget']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func NewPDB(name, namespace, minAvailable, template string) *podDisruptionBudget {
return &podDisruptionBudget{name, namespace, minAvailable, template}
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
af9acdfc-c01c-4152-aa48-9350497e5e1f
|
create
|
['podDisruptionBudget']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (pdb *podDisruptionBudget) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", pdb.template, "-p", "NAME="+pdb.name, "NAMESPACE="+pdb.namespace, "MIN_AVAILABLE="+pdb.minAvailable)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
20f5422e-de07-421f-9a23-1508a64aaaf0
|
delete
|
['podDisruptionBudget']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (pdb *podDisruptionBudget) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", pdb.namespace, "poddisruptionbudget", pdb.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
86bb5468-0cdc-4487-a1b4-e65587066942
|
create
|
['podWkloadCpuDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podWkloadCpu *podWkloadCpuDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podWkloadCpu.template, "-p", "NAME="+podWkloadCpu.name, "NAMESPACE="+podWkloadCpu.namespace, "WORKLOADCPU="+podWkloadCpu.workloadcpu)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
db4f04be-9ded-4b2b-bd94-46420645b87d
|
delete
|
['podWkloadCpuDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podWkloadCpu *podWkloadCpuDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podWkloadCpu.namespace, "pod", podWkloadCpu.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
42c1c15d-87af-4199-a679-c0cbfdb3743f
|
create
|
['podWkloadCpuNoAnotation']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podWkloadCpuNoAnota *podWkloadCpuNoAnotation) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podWkloadCpuNoAnota.template, "-p", "NAME="+podWkloadCpuNoAnota.name, "NAMESPACE="+podWkloadCpuNoAnota.namespace, "WORKLOADCPU="+podWkloadCpuNoAnota.workloadcpu)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
3102eee1-f269-4419-b6f4-c21afd5bae14
|
delete
|
['podWkloadCpuNoAnotation']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podWkloadCpuNoAnota *podWkloadCpuNoAnotation) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podWkloadCpuNoAnota.namespace, "pod", podWkloadCpuNoAnota.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
ecdfcb19-c431-4b96-a040-173834f44193
|
create
|
['podHelloDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podHello *podHelloDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podHello.template, "-p", "NAME="+podHello.name, "NAMESPACE="+podHello.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
3be9ef9e-3437-4775-bae9-c4852a162e42
|
delete
|
['podHelloDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podHello *podHelloDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podHello.namespace, "pod", podHello.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
7deb34b3-caab-4458-933b-b1ded18b9e0d
|
create
|
['ctrcfgOverlayDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (ctrcfg *ctrcfgOverlayDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", ctrcfg.template, "-p", "NAME="+ctrcfg.name, "OVERLAY="+ctrcfg.overlay)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
08966a19-5dd8-49ec-a299-2d1db0f36531
|
createPodUserNS
|
['podUserNSDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podUserNS *podUserNSDescription) createPodUserNS(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podUserNS.template, "-p", "NAME="+podUserNS.name, "NAMESPACE="+podUserNS.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
44756c20-fd81-4bb7-b6a8-e77b41ed3744
|
deletePodUserNS
|
['podUserNSDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podUserNS *podUserNSDescription) deletePodUserNS(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podUserNS.namespace, "pod", podUserNS.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
696dd4ec-9847-4f5f-9f05-e3fb2063374f
|
create
|
['kubeletConfigDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (kubeletConfig *kubeletConfigDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", kubeletConfig.template, "-p", "NAME="+kubeletConfig.name, "LABELKEY="+kubeletConfig.labelkey, "LABELVALUE="+kubeletConfig.labelvalue)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
c51f64bd-9d4c-4014-8195-b15596b64f1c
|
create
|
['memHogDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (memHog *memHogDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", memHog.template, "-p", "NAME="+memHog.name, "LABELKEY="+memHog.labelkey, "LABELVALUE="+memHog.labelvalue)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
75fb4c82-1553-4d8f-8893-520d6a0a07c2
|
create
|
['podSleepDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podSleep *podSleepDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podSleep.template, "-p", "NAMESPACE="+podSleep.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
a934f2cd-07b8-40be-b00b-13906db56a1c
|
create
|
['runtimeTimeoutDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (runtimeTimeout *runtimeTimeoutDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", runtimeTimeout.template, "-p", "NAME="+runtimeTimeout.name, "LABELKEY="+runtimeTimeout.labelkey, "LABELVALUE="+runtimeTimeout.labelvalue)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
f355b729-2590-4c91-b598-8e76bb500cf2
|
delete
|
['runtimeTimeoutDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (runtimeTimeout *runtimeTimeoutDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("kubeletconfig", runtimeTimeout.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
aa2eee66-71a2-4f6d-884e-f76f85c66c64
|
create
|
['systemReserveESDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (systemReserveES *systemReserveESDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", systemReserveES.template, "-p", "NAME="+systemReserveES.name, "LABELKEY="+systemReserveES.labelkey, "LABELVALUE="+systemReserveES.labelvalue)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
5a918aa5-04e1-45f5-aad0-73c1a409bff4
|
delete
|
['systemReserveESDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (systemReserveES *systemReserveESDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("kubeletconfig", systemReserveES.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
99f4f391-d3e6-4835-9944-8cc5f6d812a3
|
create
|
['upgradeMachineconfig1Description']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (upgradeMachineconfig1 *upgradeMachineconfig1Description) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", upgradeMachineconfig1.template, "-p", "NAME="+upgradeMachineconfig1.name)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
5699596e-14a2-4592-8a72-442137f9871e
|
delete
|
['upgradeMachineconfig1Description']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (upgradeMachineconfig1 *upgradeMachineconfig1Description) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("kubeletconfig", upgradeMachineconfig1.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
d990f72f-8cd7-4295-a289-9375b0429cd7
|
create
|
['upgradeMachineconfig2Description']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (upgradeMachineconfig2 *upgradeMachineconfig2Description) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", upgradeMachineconfig2.template, "-p", "NAME="+upgradeMachineconfig2.name)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
531329b8-b077-45ca-b6cf-4b8f3617ae93
|
delete
|
['upgradeMachineconfig2Description']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (upgradeMachineconfig2 *upgradeMachineconfig2Description) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("kubeletconfig", upgradeMachineconfig2.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
3e507a7c-5d23-49fe-aa18-79a5757d9c4f
|
deleteProject
|
['podSleepDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podSleep *podSleepDescription) deleteProject(oc *exutil.CLI) error {
e2e.Logf("Deleting Project ...")
return oc.AsAdmin().WithoutNamespace().Run("delete").Args("project", podSleep.namespace).Execute()
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
1ebd7d65-bcaa-48bb-b231-20acb4d3e789
|
create
|
['podInitConDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podInitCon *podInitConDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podInitCon.template, "-p", "NAME="+podInitCon.name, "NAMESPACE="+podInitCon.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
9496f980-35d0-4dd2-adcc-b034f3479547
|
delete
|
['podInitConDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podInitCon *podInitConDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podInitCon.namespace, "pod", podInitCon.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
cdae1b83-2418-461a-b0f3-1519d096e3fc
|
create
|
['podSigstoreDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podSigstore *podSigstoreDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podSigstore.template, "-p", "NAME="+podSigstore.name, "NAMESPACE="+podSigstore.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
d25c40af-4a7f-41cb-8b55-5d4e9ff7f7e7
|
delete
|
['podSigstoreDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podSigstore *podSigstoreDescription) delete(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podSigstore.namespace, "pod", podSigstore.name).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
99653e07-2e4f-41c5-be09-9b448180b8e6
|
getRandomString
|
['"math/rand"', '"time"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getRandomString() string {
chars := "abcdefghijklmnopqrstuvwxyz0123456789"
seed := rand.New(rand.NewSource(time.Now().UnixNano()))
buffer := make([]byte, 8)
for index := range buffer {
buffer[index] = chars[seed.Intn(len(chars))]
}
return string(buffer)
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
c4abfca1-aaf7-41ff-a100-72fc5ad7fa06
|
createKubeletConfigMaxpods
|
['"strconv"']
|
['kubeletCfgMaxpods']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (kubeletcfg *kubeletCfgMaxpods) createKubeletConfigMaxpods(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", kubeletcfg.template, "-p", "NAME="+kubeletcfg.name, "LABELKEY="+kubeletcfg.labelkey, "LABELVALUE="+kubeletcfg.labelvalue, "MAXPODS="+strconv.Itoa(kubeletcfg.maxpods))
if err != nil {
e2e.Logf("the err of createKubeletConfigMaxpods:%v", err)
}
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
c1f4fffa-c1c6-43d3-873f-1e30d0349ec4
|
deleteKubeletConfigMaxpods
|
['kubeletCfgMaxpods']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (kubeletcfg *kubeletCfgMaxpods) deleteKubeletConfigMaxpods(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("kubeletconfig", kubeletcfg.name).Execute()
if err != nil {
e2e.Logf("the err of deleteKubeletConfigMaxpods:%v", err)
}
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
b33da08f-fea9-4df1-b757-3eadbad55827
|
createPodLivenessProbe
|
['"strconv"']
|
['podLivenessProbe']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (pod *podLivenessProbe) createPodLivenessProbe(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", pod.template, "-p", "NAME="+pod.name, "NAMESPACE="+pod.namespace, "OVERRIDELIVENESSGRACE="+pod.overridelivenessgrace, "TERMINATIONGRACE="+strconv.Itoa(pod.terminationgrace), "FAILURETHRESHOLD="+strconv.Itoa(pod.failurethreshold), "PERIODSECONDS="+strconv.Itoa(pod.periodseconds))
if err != nil {
e2e.Logf("the err of createPodLivenessProbe:%v", err)
}
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
34c2631e-d72e-4afc-95e5-2c49de48580e
|
deletePodLivenessProbe
|
['podLivenessProbe']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (pod *podLivenessProbe) deletePodLivenessProbe(oc *exutil.CLI) {
err := oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", pod.namespace, "pod", pod.name).Execute()
if err != nil {
e2e.Logf("the err of deletePodLivenessProbe:%v", err)
}
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
6b70d6e4-f821-4bc2-8f42-351bfe933c87
|
create
|
['podModifyDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podModify *podModifyDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podModify.template, "-p", "NAME="+podModify.name, "NAMESPACE="+podModify.namespace, "MOUNTPATH="+podModify.mountpath, "COMMAND="+podModify.command, "ARGS="+podModify.args, "POLICY="+podModify.restartPolicy, "USER="+podModify.user, "ROLE="+podModify.role, "LEVEL="+podModify.level)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
ee985cbf-64a9-44f8-852d-a82b1af52314
|
delete
|
['podModifyDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podModify *podModifyDescription) delete(oc *exutil.CLI) error {
return oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podModify.namespace, "pod", podModify.name).Execute()
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
5fcf345e-5e9d-4f67-86c9-0774e58e5ec9
|
create
|
['podTerminationDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podTermination *podTerminationDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podTermination.template, "-p", "NAME="+podTermination.name, "NAMESPACE="+podTermination.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
d1bca3ff-0278-4ed7-a6d8-3745d29330ae
|
delete
|
['podTerminationDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podTermination *podTerminationDescription) delete(oc *exutil.CLI) error {
return oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podTermination.namespace, "pod", podTermination.name).Execute()
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
907ee023-2f71-4b1c-97f0-c5f3a4afdd26
|
createResourceFromTemplate
|
['"fmt"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func createResourceFromTemplate(oc *exutil.CLI, parameters ...string) error {
var jsonCfg string
err := wait.Poll(3*time.Second, 15*time.Second, func() (bool, error) {
output, err := oc.AsAdmin().Run("process").Args(parameters...).OutputToFile(getRandomString() + "node-config.json")
if err != nil {
e2e.Failf("the result of ReadFile:%v", err)
return false, nil
}
jsonCfg = output
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("fail to process %v", parameters))
e2e.Logf("The resource is %s", jsonCfg)
return oc.AsAdmin().WithoutNamespace().Run("create").Args("-f", jsonCfg).Execute()
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
c430825c-eb4f-428b-beed-3f5f77016088
|
podStatusReason
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func podStatusReason(oc *exutil.CLI) error {
e2e.Logf("check if pod is available")
return wait.Poll(5*time.Second, 3*time.Minute, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[*].status.initContainerStatuses[*].state.waiting.reason}", "-n", oc.Namespace()).Output()
e2e.Logf("the status of pod is %v", status)
if err != nil {
e2e.Failf("the result of ReadFile:%v", err)
return false, nil
}
if strings.Contains(status, "CrashLoopBackOff") {
e2e.Logf(" Pod failed status reason is :%s", status)
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
d1a1ccf4-37e2-4c15-9483-5ac446fe6458
|
podStatusterminatedReason
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func podStatusterminatedReason(oc *exutil.CLI) error {
e2e.Logf("check if pod is available")
return wait.Poll(5*time.Second, 3*time.Minute, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[*].status.initContainerStatuses[*].state.terminated.reason}", "-n", oc.Namespace()).Output()
e2e.Logf("the status of pod is %v", status)
if err != nil {
e2e.Failf("the result of ReadFile:%v", err)
return false, nil
}
if strings.Contains(status, "Error") {
e2e.Logf(" Pod failed status reason is :%s", status)
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
e4bcc120-0939-4573-991f-68663706b0e3
|
podStatus
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func podStatus(oc *exutil.CLI, namespace string, podName string) error {
e2e.Logf("check if pod is available")
return wait.Poll(5*time.Second, 3*time.Minute, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", podName, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}", "-n", namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(status, "True") {
e2e.Logf("Pod is running and container is Ready!")
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
8d864338-9635-46d8-8e05-a09dd9f0de37
|
podEvent
|
['"regexp"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func podEvent(oc *exutil.CLI, timeout int, keyword string) error {
return wait.Poll(10*time.Second, time.Duration(timeout)*time.Second, func() (bool, error) {
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("events", "-n", oc.Namespace()).Output()
if err != nil {
e2e.Logf("Can't get events from test project, error: %s. Trying again", err)
return false, nil
}
if matched, _ := regexp.MatchString(keyword, output); matched {
e2e.Logf(keyword)
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
1e4a4e5a-5109-4c5c-8a27-f83b36ae0e6b
|
kubeletNotPromptDupErr
|
['"regexp"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func kubeletNotPromptDupErr(oc *exutil.CLI, keyword string, name string) error {
return wait.Poll(10*time.Second, 3*time.Minute, func() (bool, error) {
re := regexp.MustCompile(keyword)
output, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("kubeletconfig", name, "-o=jsonpath={.status.conditions[*]}").Output()
if err != nil {
e2e.Logf("Can't get kubeletconfig status, error: %s. Trying again", err)
return false, nil
}
found := re.FindAllString(output, -1)
if lenStr := len(found); lenStr > 1 {
e2e.Logf("[%s] appear %d times.", keyword, lenStr)
return false, nil
} else if lenStr == 1 {
e2e.Logf("[%s] appear %d times.\nkubeletconfig not prompt duplicate error message", keyword, lenStr)
return true, nil
} else {
e2e.Logf("error: kubelet not prompt [%s]", keyword)
return false, nil
}
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
25967ddc-c086-4290-b26c-75e44da9b8da
|
volStatus
|
['"os/exec"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func volStatus(oc *exutil.CLI) error {
e2e.Logf("check content of volume")
return wait.Poll(1*time.Second, 1*time.Minute, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args("init-volume", "-c", "hello-pod", "cat", "/init-test/volume-test", "-n", oc.Namespace()).Output()
e2e.Logf("The content of the vol is %v", status)
if err != nil {
e2e.Failf("the result of ReadFile:%v", err)
return false, nil
}
if strings.Contains(status, "This is OCP volume test") {
e2e.Logf(" Init containers with volume work fine \n")
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
4bfb6515-44f3-4b79-9026-2d0d8bea434f
|
ContainerSccStatus
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func ContainerSccStatus(oc *exutil.CLI) error {
return wait.Poll(1*time.Second, 1*time.Second, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pods", "hello-pod", "-o=jsonpath={.spec.securityContext.seLinuxOptions.*}", "-n", oc.Namespace()).Output()
e2e.Logf("The Container SCC Content is %v", status)
if err != nil {
e2e.Failf("the result of ReadFile:%v", err)
return false, nil
}
if strings.Contains(status, "unconfined_u unconfined_r s0:c25,c968") {
e2e.Logf("SeLinuxOptions in pod applied to container Sucessfully \n")
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
79091d27-6c6c-46fd-a769-1d331924626a
|
create
|
['ctrcfgDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (ctrcfg *ctrcfgDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", ctrcfg.template, "-p", "LOGLEVEL="+ctrcfg.loglevel, "OVERLAY="+ctrcfg.overlay, "LOGSIZEMAX="+ctrcfg.logsizemax)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
1d5a17a2-c283-4792-88ff-af0e3a2ee3ac
|
checkCtrcfgParameters
|
['"fmt"', '"os/exec"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
['ctrcfgDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (ctrcfg *ctrcfgDescription) checkCtrcfgParameters(oc *exutil.CLI) error {
return wait.Poll(10*time.Minute, 11*time.Minute, func() (bool, error) {
nodeName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "--selector=node-role.kubernetes.io/worker=", "-o=jsonpath={.items[*].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\nNode Names are %v", nodeName)
node := strings.Fields(nodeName)
for _, v := range node {
nodeStatus, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", fmt.Sprintf("%s", v), "-o=jsonpath={.status.conditions[3].type}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\nNode %s Status is %s\n", v, nodeStatus)
if nodeStatus == "Ready" {
criostatus, err := oc.AsAdmin().WithoutNamespace().Run("debug").Args(`node/`+fmt.Sprintf("%s", v), "--", "chroot", "/host", "crio", "config").OutputToFile("crio.conf")
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf(`\nCRI-O PARAMETER ON THE WORKER NODE :` + fmt.Sprintf("%s", v))
e2e.Logf("\ncrio config file path is %v", criostatus)
wait.Poll(2*time.Second, 1*time.Minute, func() (bool, error) {
result, err1 := exec.Command("bash", "-c", "cat "+criostatus+" | egrep 'pids_limit|log_level'").Output()
if err != nil {
e2e.Failf("the result of ReadFile:%v", err1)
return false, nil
}
e2e.Logf("\nCtrcfg Parameters is %s", result)
if strings.Contains(string(result), "debug") && strings.Contains(string(result), "2048") {
e2e.Logf("\nCtrcfg parameter pod limit and log_level configured successfully")
return true, nil
}
return false, nil
})
} else {
e2e.Logf("\n NODES ARE NOT READY\n ")
}
}
return true, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
f89ecc8d-04d2-4f69-ad22-4ba48c642987
|
getTerminationGrace
|
['"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['podTerminationDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podTermination *podTerminationDescription) getTerminationGrace(oc *exutil.CLI) error {
e2e.Logf("check terminationGracePeriodSeconds period")
return wait.Poll(1*time.Second, 1*time.Minute, func() (bool, error) {
nodename, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].spec.nodeName}", "-n", podTermination.namespace).Output()
e2e.Logf("The nodename is %v", nodename)
o.Expect(err).NotTo(o.HaveOccurred())
nodeReadyBool, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", fmt.Sprintf("%s", nodename), "-o=jsonpath={.status.conditions[?(@.reason=='KubeletReady')].status}").Output()
e2e.Logf("The Node Ready status is %v", nodeReadyBool)
o.Expect(err).NotTo(o.HaveOccurred())
containerID, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].status.containerStatuses[0].containerID}", "-n", podTermination.namespace).Output()
e2e.Logf("The containerID is %v", containerID)
o.Expect(err).NotTo(o.HaveOccurred())
if nodeReadyBool == "True" {
terminationGrace, err := exutil.DebugNodeWithChroot(oc, nodename, "systemctl", "show", containerID)
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(string(terminationGrace), "TimeoutStopUSec=1min 30s") {
e2e.Logf("\nTERMINATION GRACE PERIOD IS SET CORRECTLY")
return true, nil
}
e2e.Logf("\ntermination grace is NOT Updated")
return false, nil
}
return false, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
09fd7bcf-ea02-46a6-bcc6-62d2cf507162
|
containerExit
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['podInitConDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podInitCon *podInitConDescription) containerExit(oc *exutil.CLI) error {
return wait.Poll(2*time.Second, 2*time.Minute, func() (bool, error) {
initConStatus, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].status.initContainerStatuses[0].state.terminated.reason}", "-n", podInitCon.namespace).Output()
e2e.Logf("The initContainer status is %v", initConStatus)
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(string(initConStatus), "Completed") {
e2e.Logf("The initContainer exit normally")
return true, nil
}
e2e.Logf("The initContainer not exit!")
return false, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
324c720d-7c77-41e7-8411-7683b026df3f
|
deleteInitContainer
|
['"fmt"']
|
['podInitConDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podInitCon *podInitConDescription) deleteInitContainer(oc *exutil.CLI) (string, error) {
nodename, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].spec.nodeName}", "-n", podInitCon.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
containerID, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].status.initContainerStatuses[0].containerID}", "-n", podInitCon.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("The containerID is %v", containerID)
initContainerID := string(containerID)[8:]
e2e.Logf("The initContainerID is %s", initContainerID)
return exutil.DebugNodeWithChroot(oc, fmt.Sprintf("%s", nodename), "crictl", "rm", initContainerID)
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
56f6bc0a-df29-48d0-9fed-6f7583dd4b4d
|
initContainerNotRestart
|
['"os/exec"', '"regexp"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['podInitConDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podInitCon *podInitConDescription) initContainerNotRestart(oc *exutil.CLI) error {
return wait.Poll(3*time.Minute, 6*time.Minute, func() (bool, error) {
re := regexp.MustCompile("running")
podname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].metadata.name}", "-n", podInitCon.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
output, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(string(podname), "-n", podInitCon.namespace, "--", "cat", "/mnt/data/test").Output()
e2e.Logf("The /mnt/data/test: %s", output)
o.Expect(err).NotTo(o.HaveOccurred())
found := re.FindAllString(output, -1)
if lenStr := len(found); lenStr > 1 {
e2e.Logf("initContainer restart %d times.", (lenStr - 1))
return false, nil
} else if lenStr == 1 {
e2e.Logf("initContainer not restart")
return true, nil
}
return false, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
4880fac5-2934-47ef-a69d-52dd394632cc
|
checkNodeStatus
|
['"fmt"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkNodeStatus(oc *exutil.CLI, nodeName string, expectedStatus string) {
var expectedStatus1 string
if expectedStatus == "Ready" {
expectedStatus1 = "True"
} else if expectedStatus == "NotReady" {
expectedStatus1 = "Unknown"
} else {
err1 := fmt.Errorf("TBD supported node status")
o.Expect(err1).NotTo(o.HaveOccurred())
}
err := wait.Poll(5*time.Second, 15*time.Minute, func() (bool, error) {
statusOutput, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", nodeName, "-ojsonpath={.status.conditions[-1].status}").Output()
if err != nil {
e2e.Logf("\nGet node status with error : %v", err)
return false, nil
}
e2e.Logf("Expect Node %s in state %v, kubelet status is %s", nodeName, expectedStatus, statusOutput)
if statusOutput != expectedStatus1 {
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(err, fmt.Sprintf("Node %s is not in expected status %s", nodeName, expectedStatus))
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
d5bda9ad-1b50-42e9-9d73-6b6bec81ae1a
|
getSingleWorkerNode
|
['e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getSingleWorkerNode(oc *exutil.CLI) string {
workerNodeName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "--selector=node-role.kubernetes.io/worker=", "-o=jsonpath={.items[0].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\nWorker Node Name is %v", workerNodeName)
return workerNodeName
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
7c59e48c-ceb8-42e5-a4ff-d5cb9bddb398
|
getSingleMasterNode
|
['e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getSingleMasterNode(oc *exutil.CLI) string {
masterNodeName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "--selector=node-role.kubernetes.io/master=", "-o=jsonpath={.items[1].metadata.name}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\nMaster Node Name is %v", masterNodeName)
return masterNodeName
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
02bd535a-9870-4d32-800e-df0eb5428549
|
getPodNodeName
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getPodNodeName(oc *exutil.CLI, namespace string) string {
nodeName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].spec.nodeName}", "-n", namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("Pod Node Name is %v \n", nodeName)
return nodeName
}
|
node
| |||||
function
|
openshift/openshift-tests-private
|
eeda7570-d1d4-4d2f-a7c7-e7a62b6b58c6
|
getPodNetNs
|
['"fmt"', '"regexp"', '"strings"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getPodNetNs(oc *exutil.CLI, hostname string) (string, error) {
NetNsStr, err := exutil.DebugNodeWithChroot(oc, hostname, "/bin/bash", "-c", "journalctl -u crio --since=\"5 minutes ago\" | grep pod-56266 | grep NetNS")
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("NetNs string : %v", NetNsStr)
keyword := "NetNS:[^\\s]*"
re := regexp.MustCompile(keyword)
found := re.FindAllString(NetNsStr, -1)
if len(found) == 0 {
e2e.Logf("can not find NetNS for pod")
return "", fmt.Errorf("can not find NetNS for pod")
}
e2e.Logf("found : %v \n", found[0])
NetNs := strings.Split(found[0], ":")
e2e.Logf("NetNs : %v \n", NetNs[1])
return NetNs[1], nil
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
cb747464-35e9-48b9-acfb-810e41bbc1d1
|
addLabelToResource
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func addLabelToResource(oc *exutil.CLI, label string, resourceName string, resource string) {
_, err := oc.AsAdmin().WithoutNamespace().Run("label").Args(resource, resourceName, label, "--overwrite").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\nLabel Added")
}
|
node
| |||||
function
|
openshift/openshift-tests-private
|
fb6e44b1-bc5d-4919-b3ce-928afcc98502
|
removeLabelFromNode
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func removeLabelFromNode(oc *exutil.CLI, label string, workerNodeName string, resource string) {
_, err := oc.AsAdmin().WithoutNamespace().Run("label").Args(resource, workerNodeName, label).Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\nLabel Removed")
}
|
node
| |||||
function
|
openshift/openshift-tests-private
|
20ab068a-28ff-4676-a904-85e229528a46
|
rebootNode
|
['"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func rebootNode(oc *exutil.CLI, workerNodeName string) error {
return wait.Poll(1*time.Second, 1*time.Second, func() (bool, error) {
e2e.Logf("\nRebooting node %s....", workerNodeName)
_, err1 := exutil.DebugNodeWithChroot(oc, workerNodeName, "shutdown", "-r", "+1", "-t", "30")
o.Expect(err1).NotTo(o.HaveOccurred())
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
4549c186-4d84-43d2-a897-f1bb6bb2f540
|
masterNodeLog
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func masterNodeLog(oc *exutil.CLI, masterNode string) error {
return wait.Poll(1*time.Second, 1*time.Second, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("debug").Args(`node/`+masterNode, "--", "chroot", "/host", "journalctl", "-u", "crio").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if !strings.Contains(status, "layer not known") {
e2e.Logf("\nTest successfully executed")
} else {
e2e.Logf("\nTest fail executed, and try next")
return false, nil
}
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
fea58309-d52a-4094-834c-57824aaf125b
|
getmcpStatus
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getmcpStatus(oc *exutil.CLI, nodeName string) error {
return wait.Poll(60*time.Second, 15*time.Minute, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("mcp", nodeName, "-ojsonpath={.status.conditions[?(@.type=='Updating')].status}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\nCurrent mcp UPDATING Status is %s\n", status)
if strings.Contains(status, "False") {
e2e.Logf("\nmcp updated successfully ")
} else {
e2e.Logf("\nmcp is still in UPDATING state")
return false, nil
}
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
3218e51e-ceca-468e-899e-9fad6a0ec809
|
getWorkerNodeDescribe
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func getWorkerNodeDescribe(oc *exutil.CLI, workerNodeName string) error {
return wait.Poll(3*time.Second, 1*time.Minute, func() (bool, error) {
nodeStatus, err := oc.AsAdmin().WithoutNamespace().Run("describe").Args("node", workerNodeName).Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(nodeStatus, "EvictionThresholdMet") {
e2e.Logf("\n WORKER NODE MET EVICTION THRESHOLD\n ")
} else {
e2e.Logf("\n WORKER NODE DO NOT HAVE MEMORY PRESSURE\n ")
return false, nil
}
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
db698b04-8b81-4e3d-b38e-6a16c2b2fe19
|
checkOverlaySize
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkOverlaySize(oc *exutil.CLI, overlaySize string) error {
return wait.Poll(3*time.Second, 1*time.Minute, func() (bool, error) {
workerNode := getSingleWorkerNode(oc)
//overlayString, err := exutil.DebugNodeWithChroot(oc, workerNode, "/bin/bash", "-c", "head -n 7 /etc/containers/storage.conf | grep size")
overlayString, err := exutil.DebugNodeWithChroot(oc, workerNode, "/bin/bash", "-c", "head -n 7 /etc/containers/storage.conf | grep size || true")
if err != nil {
return false, err
}
e2e.Logf("overlaySize string : %v", overlayString)
if strings.Contains(string(overlayString), overlaySize) {
e2e.Logf("overlay size check successfully")
} else {
e2e.Logf("overlay size check failed")
return false, nil
}
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
19618fdd-b21d-4792-aa38-4774410178f6
|
checkPodOverlaySize
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkPodOverlaySize(oc *exutil.CLI, overlaySize string) error {
return wait.Poll(1*time.Second, 3*time.Second, func() (bool, error) {
podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].metadata.name}", "-n", oc.Namespace()).Output()
o.Expect(err).NotTo(o.HaveOccurred())
overlayString, err := oc.AsAdmin().WithoutNamespace().Run("rsh").Args("-n", oc.Namespace(), podName, "/bin/bash", "-c", "df -h | grep overlay").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("overlayString is : %v", overlayString)
overlaySizeStr := strings.Fields(string(overlayString))
e2e.Logf("overlaySize : %s", overlaySizeStr[1])
overlaySizeInt := strings.Split(string(overlaySizeStr[1]), ".")[0] + "G"
e2e.Logf("overlaySizeInt : %s", overlaySizeInt)
if overlaySizeInt == overlaySize {
e2e.Logf("pod overlay size is correct")
} else {
e2e.Logf("pod overlay size is not correct !!!")
return false, nil
}
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
de11b1f6-951e-4033-95cf-3eadf3e45ce7
|
checkNetNs
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkNetNs(oc *exutil.CLI, hostname string, netNsPath string) error {
return wait.Poll(1*time.Second, 3*time.Second, func() (bool, error) {
result, _ := exutil.DebugNodeWithChroot(oc, hostname, "ls", "-l", netNsPath)
e2e.Logf("the check result: %v", result)
if strings.Contains(string(result), "No such file or directory") {
e2e.Logf("the NetNS file is cleaned successfully")
} else {
e2e.Logf("the NetNS file still exist")
return false, nil
}
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
983b0fd5-b3a0-457d-983f-2c9a6d7fcfd1
|
checkEventsForErr
|
['"regexp"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkEventsForErr(oc *exutil.CLI) error {
return wait.Poll(1*time.Second, 3*time.Second, func() (bool, error) {
// get all cronjob's namespace from:
// NAMESPACE NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE
// openshift-image-registry image-pruner 0 0 * * * False 0 <none> 4h36m
// openshift-operator-lifecycle-manager collect-profiles */15 * * * * False 0 9m11s 4h40m
allcronjobs, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("cronjob", "--all-namespaces", "-o=jsonpath={range .items[*]}{@.metadata.namespace}{\"\\n\"}{end}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("the cronjobs namespaces are: %v", allcronjobs)
for _, s := range strings.Fields(allcronjobs) {
events, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("events", "-n", s).Output()
o.Expect(err).NotTo(o.HaveOccurred())
keyword := "MountVolume.SetUp failed for volume.*object.*not registered"
re := regexp.MustCompile(keyword)
found := re.FindAllString(events, -1)
if len(found) > 0 {
e2e.Logf("The events of ns [%v] hit the error: %v", s, found[0])
return false, nil
}
}
e2e.Logf("all the crontab events don't hit the error: MountVolume.SetUp failed for volume ... not registered")
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
36055142-30c2-47ce-b7b4-df8b26e4ef91
|
cleanupObjectsClusterScope
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['objectTableRefcscope']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func cleanupObjectsClusterScope(oc *exutil.CLI, objs ...objectTableRefcscope) error {
return wait.Poll(1*time.Second, 1*time.Second, func() (bool, error) {
for _, v := range objs {
e2e.Logf("\n Start to remove: %v", v)
status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args(v.kind, v.name).Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(status, "Error") {
e2e.Logf("Error getting resources... Seems resources objects are already deleted. \n")
return true, nil
}
_, err = oc.AsAdmin().WithoutNamespace().Run("delete").Args(v.kind, v.name).Output()
o.Expect(err).NotTo(o.HaveOccurred())
}
return true, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
57be9911-8f5e-457f-8e2b-267adf1ad763
|
create
|
['podTwoContainersDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podTwoContainers *podTwoContainersDescription) create(oc *exutil.CLI) {
err := createResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", podTwoContainers.template, "-p", "NAME="+podTwoContainers.name, "NAMESPACE="+podTwoContainers.namespace)
o.Expect(err).NotTo(o.HaveOccurred())
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
c990ccdd-ca5c-4326-8347-d23c41ac1743
|
delete
|
['podTwoContainersDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podTwoContainers *podTwoContainersDescription) delete(oc *exutil.CLI) error {
return oc.AsAdmin().WithoutNamespace().Run("delete").Args("-n", podTwoContainers.namespace, "pod", podTwoContainers.name).Execute()
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
1380b07f-b489-45be-b3aa-ae37e5669564
|
crioWorkloadConfigExist
|
['"context"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['podUserNSDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podUserNS *podUserNSDescription) crioWorkloadConfigExist(oc *exutil.CLI) error {
return wait.Poll(10*time.Second, 30*time.Second, func() (bool, error) {
nodeList, err := e2enode.GetReadySchedulableNodes(context.TODO(), oc.KubeFramework().ClientSet)
o.Expect(err).NotTo(o.HaveOccurred())
nodename := nodeList.Items[0].Name
workloadString, _ := exutil.DebugNodeWithChroot(oc, nodename, "cat", "/etc/crio/crio.conf.d/00-default")
//not handle err as a workaround of issue: debug container needs more time to start in 4.13&4.14
//o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(string(workloadString), "crio.runtime.workloads.openshift-builder") && strings.Contains(string(workloadString), "io.kubernetes.cri-o.userns-mode") && strings.Contains(string(workloadString), "io.kubernetes.cri-o.Devices") {
e2e.Logf("the crio workload exist in /etc/crio/crio.conf.d/00-default")
} else {
e2e.Logf("the crio workload not exist in /etc/crio/crio.conf.d/00-default")
return false, nil
}
return true, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
0760f376-923d-4f28-b8b9-6af5c09aadc9
|
userContainersExistForNS
|
['"context"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['podUserNSDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podUserNS *podUserNSDescription) userContainersExistForNS(oc *exutil.CLI) error {
return wait.Poll(10*time.Second, 30*time.Second, func() (bool, error) {
nodeList, err := e2enode.GetReadySchedulableNodes(context.TODO(), oc.KubeFramework().ClientSet)
o.Expect(err).NotTo(o.HaveOccurred())
nodename := nodeList.Items[0].Name
xContainers, _ := exutil.DebugNodeWithChroot(oc, nodename, "bash", "-c", "cat /etc/subuid /etc/subgid")
//not handle err as a workaround of issue: debug container needs more time to start in 4.13&4.14
//o.Expect(err).NotTo(o.HaveOccurred())
if strings.Count(xContainers, "containers") == 2 {
e2e.Logf("the user containers exist in /etc/subuid and /etc/subgid")
} else {
e2e.Logf("the user containers not exist in /etc/subuid and /etc/subgid")
return false, nil
}
return true, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
832592f3-3e9f-4987-9ae8-9241062e02e6
|
podRunInUserNS
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
['podUserNSDescription']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func (podUserNS *podUserNSDescription) podRunInUserNS(oc *exutil.CLI) error {
return wait.Poll(10*time.Second, 30*time.Second, func() (bool, error) {
podName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].metadata.name}", "-n", podUserNS.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
idString, err := oc.AsAdmin().WithoutNamespace().Run("rsh").Args("-n", podUserNS.namespace, podName, "id").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(string(idString), "uid=0(root) gid=0(root) groups=0(root)") {
e2e.Logf("the user id in pod is root")
podUserNSstr, _ := oc.AsAdmin().WithoutNamespace().Run("rsh").Args("-n", podUserNS.namespace, podName, "lsns", "-o", "NS", "-t", "user").Output()
//not handle err due to the container crash like: unable to upgrade connection: container not found
//o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("string(podUserNS) is : %s", string(podUserNSstr))
podNS := strings.Fields(string(podUserNSstr))
e2e.Logf("pod user namespace : %s", podNS[1])
nodename, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].spec.nodeName}", "-n", podUserNS.namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
nodeUserNS, _ := exutil.DebugNodeWithChroot(oc, string(nodename), "/bin/bash", "-c", "lsns -t user | grep /usr/lib/systemd/systemd")
//not handle err as a workaround of issue: debug container needs more time to start in 4.13&4.14
//o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("host user ns string : %v", nodeUserNS)
nodeNSstr := strings.Split(string(nodeUserNS), "\n")
nodeNS := strings.Fields(nodeNSstr[0])
e2e.Logf("host user namespace : %s", nodeNS[0])
if nodeNS[0] == podNS[1] {
e2e.Logf("pod run in the same user namespace with host")
return false, nil
}
e2e.Logf("pod run in different user namespace with host")
return true, nil
}
e2e.Logf("the user id in pod is not root")
return false, nil
})
}
|
node
| |||
function
|
openshift/openshift-tests-private
|
7ecc0f5d-c06c-47b6-a352-82e967c79c3b
|
configExist
|
['"context"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func configExist(oc *exutil.CLI, config []string, configPath string) error {
return wait.Poll(1*time.Second, 3*time.Second, func() (bool, error) {
nodeList, err := e2enode.GetReadySchedulableNodes(context.TODO(), oc.KubeFramework().ClientSet)
o.Expect(err).NotTo(o.HaveOccurred())
nodename := nodeList.Items[0].Name
configString, err := exutil.DebugNodeWithChroot(oc, nodename, "cat", configPath)
e2e.Logf("the %s is: \n%v", configPath, configString)
o.Expect(err).NotTo(o.HaveOccurred())
for _, conf := range config {
if !strings.Contains(string(configString), conf) {
e2e.Logf("the config: %s not exist in %s", conf, configPath)
return false, nil
}
}
e2e.Logf("all the config exist in %s", configPath)
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
a3b41bfa-d53b-4f93-8069-bbf373077a9b
|
checkMachineConfigPoolStatus
|
['"strings"', '"time"', 'g "github.com/onsi/ginkgo/v2"', 'metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkMachineConfigPoolStatus(oc *exutil.CLI, nodeSelector string) error {
//when mcp master change cgroup from v2 to v1, it takes more than 15 minutes
return wait.Poll(30*time.Second, 30*time.Minute, func() (bool, error) {
mCount, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("mcp", nodeSelector, "-n", oc.Namespace(), "-o=jsonpath={.status.machineCount}").Output()
unmCount, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("mcp", nodeSelector, "-n", oc.Namespace(), "-o=jsonpath={.status.unavailableMachineCount}").Output()
dmCount, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("mcp", nodeSelector, "-n", oc.Namespace(), "-o=jsonpath={.status.degradedMachineCount}").Output()
rmCount, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("mcp", nodeSelector, "-n", oc.Namespace(), "-o=jsonpath={.status.readyMachineCount}").Output()
e2e.Logf("MachineCount:%v unavailableMachineCount:%v degradedMachineCount:%v ReadyMachineCount:%v", mCount, unmCount, dmCount, rmCount)
if strings.Compare(mCount, rmCount) == 0 && strings.Compare(unmCount, dmCount) == 0 {
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
e1a01907-5a7a-4eb1-bda7-411b4e24d5a5
|
overrideWkloadCpu
|
['"os/exec"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func overrideWkloadCpu(oc *exutil.CLI, cpuset string, namespace string) error {
return wait.Poll(1*time.Second, 3*time.Second, func() (bool, error) {
podname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].metadata.name}", "-n", namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
cpuSet, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(string(podname), "-n", namespace, "--", "cat", "/sys/fs/cgroup/cpuset.cpus.effective").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("The cpuset is : %s", cpuSet)
if cpuset == "" {
//if cpuset == "", the pod will keep default value as the /sys/fs/cgroup/cpuset.cpus.effective on node
nodename, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].spec.nodeName}", "-n", namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("The nodename is %v", nodename)
cpusetDeft, err := exutil.DebugNodeWithChroot(oc, nodename, "cat", "/sys/fs/cgroup/cpuset.cpus.effective")
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("The cpuset of host is : %s", cpusetDeft)
if strings.Contains(cpusetDeft, cpuSet) {
e2e.Logf("the cpuset not take effect in the pod")
return true, nil
}
} else if cpuSet == cpuset {
e2e.Logf("the pod override the default workload setting")
return true, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
f1c07c53-c11c-4e96-8f51-9e964700bb99
|
defaultWkloadCpu
|
['"os/exec"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func defaultWkloadCpu(oc *exutil.CLI, cpuset string, namespace string) error {
return wait.Poll(1*time.Second, 3*time.Second, func() (bool, error) {
podname, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].metadata.name}", "-n", namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
cpuSet, err := oc.AsAdmin().WithoutNamespace().Run("exec").Args(string(podname), "-n", namespace, "--", "cat", "/sys/fs/cgroup/cpuset.cpus.effective").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("The cpuset of pod is : %s", cpuSet)
nodename, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-o=jsonpath={.items[0].spec.nodeName}", "-n", namespace).Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("The nodename is %v", nodename)
cpusetDeft, err := exutil.DebugNodeWithChroot(oc, nodename, "cat", "/sys/fs/cgroup/cpuset.cpus.effective")
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("The cpuset of host is : %s", cpusetDeft)
if strings.Contains(cpusetDeft, cpuSet) {
if string(cpuSet) != cpuset {
e2e.Logf("the pod keep the default workload setting")
return true, nil
}
e2e.Logf("the pod specified value is the same as default, invalid test!")
return false, nil
}
return false, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
3202aeb9-bdd6-45d7-a255-ce8fcd810bde
|
createKedaOperator
|
['"fmt"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func createKedaOperator(oc *exutil.CLI) {
buildPruningBaseDir := exutil.FixturePath("testdata", "node")
operatorGroup := filepath.Join(buildPruningBaseDir, "operatorgroup.yaml")
subscription := filepath.Join(buildPruningBaseDir, "subscription.yaml")
nsOperator := filepath.Join(buildPruningBaseDir, "ns-keda-operator.yaml")
operatorNamespace := "openshift-keda"
msg, err := oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", nsOperator).Output()
e2e.Logf("err %v, msg %v", err, msg)
msg, err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", operatorGroup).Output()
e2e.Logf("err %v, msg %v", err, msg)
msg, err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", subscription).Output()
e2e.Logf("err %v, msg %v", err, msg)
// checking subscription status
errCheck := wait.Poll(10*time.Second, 180*time.Second, func() (bool, error) {
subState, _ := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "openshift-custom-metrics-autoscaler-operator", "-n", operatorNamespace, "-o=jsonpath={.status.state}").Output()
//o.Expect(err).NotTo(o.HaveOccurred())
if strings.Compare(subState, "AtLatestKnown") == 0 {
msg, err = oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "openshift-custom-metrics-autoscaler-operator", "-n", operatorNamespace, "--no-headers").Output()
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errCheck, fmt.Sprintf("subscription openshift-custom-metrics-autoscaler-operator is not correct status"))
// checking csv status
csvName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "openshift-custom-metrics-autoscaler-operator", "-n", operatorNamespace, "-o=jsonpath={.status.installedCSV}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(csvName).NotTo(o.BeEmpty())
errCheck = wait.Poll(10*time.Second, 180*time.Second, func() (bool, error) {
csvState, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", csvName, "-n", operatorNamespace, "-o=jsonpath={.status.phase}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Compare(csvState, "Succeeded") == 0 {
e2e.Logf("CSV check complete!!!")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errCheck, fmt.Sprintf("csv %v is not correct status", csvName))
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
b4d7e67e-ed5a-4b06-8470-07a183c4f537
|
waitForPodWithLabelReady
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func waitForPodWithLabelReady(oc *exutil.CLI, ns, label string) error {
return wait.Poll(5*time.Second, 3*time.Minute, func() (bool, error) {
status, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("pod", "-n", ns, "-l", label, "-ojsonpath={.items[*].status.conditions[?(@.type==\"Ready\")].status}").Output()
e2e.Logf("the Ready status of pod is %v", status)
if err != nil || status == "" {
e2e.Logf("failed to get pod status: %v, retrying...", err)
return false, nil
}
if strings.Contains(status, "False") {
e2e.Logf("the pod Ready status not met; wanted True but got %v, retrying...", status)
return false, nil
}
return true, nil
})
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
ff5882f3-62e5-4a34-98c6-5b2c21bac058
|
assertKubeletLogLevel
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func assertKubeletLogLevel(oc *exutil.CLI) {
var kubeservice string
var kublet string
var err error
waitErr := wait.Poll(10*time.Second, 1*time.Minute, func() (bool, error) {
nodeName, nodeErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "-o=jsonpath={.items[*].metadata.name}").Output()
o.Expect(nodeErr).NotTo(o.HaveOccurred())
e2e.Logf("\nNode Names are %v", nodeName)
nodes := strings.Fields(nodeName)
for _, node := range nodes {
nodeStatus, statusErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", node, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}").Output()
o.Expect(statusErr).NotTo(o.HaveOccurred())
e2e.Logf("\nNode %s Status is %s\n", node, nodeStatus)
if nodeStatus == "True" {
kubeservice, err = exutil.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "systemctl show kubelet.service | grep KUBELET_LOG_LEVEL")
o.Expect(err).NotTo(o.HaveOccurred())
kublet, err = exutil.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "ps aux | grep kubelet")
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(string(kubeservice), "KUBELET_LOG_LEVEL") && strings.Contains(string(kublet), "--v=2") {
e2e.Logf(" KUBELET_LOG_LEVEL is 2. \n")
return true, nil
} else {
e2e.Logf(" KUBELET_LOG_LEVEL is not 2. \n")
return false, nil
}
} else {
e2e.Logf("\n NODES ARE NOT READY\n ")
}
}
return false, nil
})
if waitErr != nil {
e2e.Logf("Kubelet Log level is:\n %v\n", kubeservice)
e2e.Logf("Running Proccess of kubelet are:\n %v\n", kublet)
}
exutil.AssertWaitPollNoErr(waitErr, "KUBELET_LOG_LEVEL is not expected")
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
dd8e2682-cbb6-47bd-acef-b2c9ca95be0f
|
createVpaOperator
|
['"fmt"', '"path/filepath"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func createVpaOperator(oc *exutil.CLI) {
buildPruningBaseDir := exutil.FixturePath("testdata", "node")
operatorGroup := filepath.Join(buildPruningBaseDir, "vpa-operatorgroup.yaml")
subscription := filepath.Join(buildPruningBaseDir, "vpa-subscription.yaml")
nsOperator := filepath.Join(buildPruningBaseDir, "ns-vpa-operator.yaml")
operatorNamespace := "openshift-vertical-pod-autoscaler"
msg, err := oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", nsOperator).Output()
e2e.Logf("err %v, msg %v", err, msg)
msg, err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", operatorGroup).Output()
e2e.Logf("err %v, msg %v", err, msg)
msg, err = oc.AsAdmin().WithoutNamespace().Run("apply").Args("-f", subscription).Output()
e2e.Logf("err %v, msg %v", err, msg)
// checking subscription status
errCheck := wait.Poll(10*time.Second, 180*time.Second, func() (bool, error) {
subState, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "vertical-pod-autoscaler", "-n", operatorNamespace, "-o=jsonpath={.status.state}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Compare(subState, "AtLatestKnown") == 0 {
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errCheck, fmt.Sprintf("subscription vertical-pod-autoscaler is not correct status"))
// checking csv status
csvName, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("sub", "vertical-pod-autoscaler", "-n", operatorNamespace, "-o=jsonpath={.status.installedCSV}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(csvName).NotTo(o.BeEmpty())
errCheck = wait.Poll(10*time.Second, 180*time.Second, func() (bool, error) {
csvState, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("csv", csvName, "-n", operatorNamespace, "-o=jsonpath={.status.phase}").Output()
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Compare(csvState, "Succeeded") == 0 {
e2e.Logf("CSV check complete!!!")
return true, nil
}
return false, nil
})
exutil.AssertWaitPollNoErr(errCheck, fmt.Sprintf("csv %v is not correct status", csvName))
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
0c7ea765-a8da-4e65-9bb0-34f57a606042
|
runTimeTimeout
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func runTimeTimeout(oc *exutil.CLI) {
var kubeletConf string
var err error
nodeName, nodeErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "--selector=node-role.kubernetes.io/worker=", "-o=jsonpath={.items[*].metadata.name}").Output()
o.Expect(nodeErr).NotTo(o.HaveOccurred())
e2e.Logf("\nNode Names are %v", nodeName)
nodes := strings.Fields(nodeName)
waitErr := wait.Poll(10*time.Second, 1*time.Minute, func() (bool, error) {
for _, node := range nodes {
nodeStatus, statusErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", node, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}").Output()
o.Expect(statusErr).NotTo(o.HaveOccurred())
e2e.Logf("\nNode %s Status is %s\n", node, nodeStatus)
if nodeStatus == "True" {
kubeletConf, err = exutil.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "cat /etc/kubernetes/kubelet.conf | grep runtimeRequestTimeout")
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(string(kubeletConf), "runtimeRequestTimeout") && strings.Contains(string(kubeletConf), ":") && strings.Contains(string(kubeletConf), "3m0s") {
e2e.Logf(" RunTime Request Timeout is 3 minutes. \n")
return true, nil
} else {
e2e.Logf("Runtime Request Timeout is not 3 minutes. \n")
return false, nil
}
} else {
e2e.Logf("\n NODES ARE NOT READY\n ")
}
}
return false, nil
})
if waitErr != nil {
e2e.Logf("RunTime Request Timeout is:\n %v\n", kubeletConf)
}
exutil.AssertWaitPollNoErr(waitErr, "Runtime Request Timeout is not expected")
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
e1073b79-902c-454c-8ad9-9a0ecdd459cd
|
checkConmonForAllNode
|
['"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"', 'e2enode "k8s.io/kubernetes/test/e2e/framework/node"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkConmonForAllNode(oc *exutil.CLI) {
var configStr string
waitErr := wait.Poll(10*time.Second, 1*time.Minute, func() (bool, error) {
nodeName, nodeErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "--selector=node-role.kubernetes.io/worker=", "-o=jsonpath={.items[*].metadata.name}").Output()
o.Expect(nodeErr).NotTo(o.HaveOccurred())
e2e.Logf("\nNode Names are %v", nodeName)
nodes := strings.Fields(nodeName)
for _, node := range nodes {
nodeStatus, statusErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", node, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}").Output()
o.Expect(statusErr).NotTo(o.HaveOccurred())
e2e.Logf("\nNode [%s] Status is %s\n", node, nodeStatus)
if nodeStatus == "True" {
configStr, err := exutil.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "crio config | grep 'conmon = \"\"'")
o.Expect(err).NotTo(o.HaveOccurred())
if strings.Contains(string(configStr), "conmon = \"\"") {
e2e.Logf(" conmon check pass. \n")
} else {
e2e.Logf(" conmon check failed. \n")
return false, nil
}
} else {
e2e.Logf("\n NODES ARE NOT READY\n ")
return false, nil
}
}
return true, nil
})
if waitErr != nil {
e2e.Logf("conmon string is:\n %v\n", configStr)
}
exutil.AssertWaitPollNoErr(waitErr, "the conmon is not as expected!")
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
efc520f0-0301-4c99-95c2-6d0de8a27fd1
|
waitClusterOperatorAvailable
|
['"fmt"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func waitClusterOperatorAvailable(oc *exutil.CLI) {
timeout := 120
waitErr := wait.Poll(10*time.Second, time.Duration(timeout)*time.Minute, func() (bool, error) {
availableCOStatus, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("clusteroperator", "-o=jsonpath={.items[*].status.conditions[?(@.type==\"Available\")].status}").Output()
if err != nil || strings.Contains(availableCOStatus, "False") {
e2e.Logf("Some Cluster Operator is still Unavailable")
return false, nil
}
return true, nil
})
exutil.AssertWaitPollNoErr(waitErr, fmt.Sprintf("Some cluster operator is still unavailable after %v seconds ...", timeout))
}
|
node
| ||||
function
|
openshift/openshift-tests-private
|
c6cb7367-1f1c-453d-9c6e-1e9ffc294060
|
checkUpgradeMachineConfig
|
['"regexp"', '"strings"', '"time"', '"k8s.io/apimachinery/pkg/util/wait"']
|
github.com/openshift/openshift-tests-private/test/extended/node/node_utils.go
|
func checkUpgradeMachineConfig(oc *exutil.CLI) {
var machineconfig string
waitErr := wait.Poll(10*time.Second, 1*time.Minute, func() (bool, error) {
upgradestatus, err := oc.AsAdmin().WithoutNamespace().Run("get").Args("co", "machine-config").Output()
o.Expect(err).NotTo(o.HaveOccurred())
e2e.Logf("\n Upgrade status is %s\n", upgradestatus)
machineconfig, err1 := oc.AsAdmin().WithoutNamespace().Run("get").Args("mc").Output()
o.Expect(err1).NotTo(o.HaveOccurred())
if strings.Contains(string(machineconfig), "99-worker-generated-kubelet-1") {
re := regexp.MustCompile("99-worker-generated-kubelet")
found := re.FindAllString(machineconfig, -1)
lenstr := len(found)
if lenstr == 2 {
e2e.Logf("\n Upgrade happened successfully")
return true, nil
} else {
e2e.Logf("\nError")
return false, nil
}
} else {
e2e.Logf(" Upgarde has failed \n")
return false, nil
}
return true, nil
})
if waitErr != nil {
e2e.Logf("machine config is %s\n", machineconfig)
}
exutil.AssertWaitPollNoErr(waitErr, "the machine config is not as expected.")
}
|
node
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.