Skip to content

Commit

Permalink
when restart deployment kube-ovn-controller the kubectl ko log loss (#…
Browse files Browse the repository at this point in the history
…2508)

* when restart deployment kube-ovn-controller the kubectl ko log loss

* fix
  • Loading branch information
changluyi committed Mar 20, 2023
1 parent e7085de commit 416cc77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 13 additions & 0 deletions test/e2e/framework/deployment.go
Expand Up @@ -3,6 +3,7 @@ package framework
import (
"context"
"fmt"
"os/exec"
"time"

appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -118,3 +119,15 @@ func MakeDeployment(name string, replicas int32, podLabels, podAnnotations map[s
deploy.Spec.Template.Annotations = podAnnotations
return deploy
}

func RestartSystemDeployment(name string, enableLog bool) {
if enableLog {
output, err := exec.Command("bash", "-c", fmt.Sprintf("kubectl ko log kube-ovn %s all", name)).CombinedOutput()
framework.ExpectNoError(err, fmt.Sprintf("dump all %s log failed", name))
framework.Logf(string(output))
}

restartCmd := fmt.Sprintf("kubectl rollout restart deployment %s -n kube-system", name)
_, err := exec.Command("bash", "-c", restartCmd).CombinedOutput()
framework.ExpectNoError(err, fmt.Sprintf("restart %s failed", name))
}
4 changes: 1 addition & 3 deletions test/e2e/kube-ovn/underlay/underlay.go
Expand Up @@ -543,9 +543,7 @@ var _ = framework.SerialDescribe("[group:underlay]", func() {
checkU2OItems(true, subnet, underlayPod, overlayPod)

ginkgo.By("step4: check if kube-ovn-controller restart")
restartCmd := "kubectl rollout restart deployment kube-ovn-controller -n kube-system"
_, err = exec.Command("bash", "-c", restartCmd).CombinedOutput()
framework.ExpectNoError(err, "restart kube-ovn-controller")
framework.RestartSystemDeployment("kube-ovn-controller", true)
checkU2OItems(true, subnet, underlayPod, overlayPod)

ginkgo.By("step5: Disable u2o check after restart kube-controller")
Expand Down

0 comments on commit 416cc77

Please sign in to comment.