@@ -23,6 +23,18 @@ func KubernetesBuildkitImage() string {
2323 return "moby/buildkit:" + tag
2424}
2525
26+ func KubernetesK3sImage () string {
27+ return os .Getenv ("TEST_K3S_IMAGE" )
28+ }
29+
30+ func KubernetesK3DToolsImage () string {
31+ return os .Getenv ("TEST_K3D_TOOLS_IMAGE" )
32+ }
33+
34+ func KubernetesK3DLoadBalancerImage () string {
35+ return os .Getenv ("TEST_K3D_LOADBALANCER_IMAGE" )
36+ }
37+
2638func KubernetesDiagnostics (clusterName , dockerContext string ) string {
2739 ctx , cancel := context .WithTimeout (context .Background (), 20 * time .Second )
2840 defer cancel ()
@@ -56,16 +68,22 @@ func appendK3sServerDiagnostics(ctx context.Context, buf *bytes.Buffer, clusterN
5668 }
5769
5870 for _ , nodeName := range nodeNames {
71+ appendCommandOutput (ctx , buf , "docker inspect " + nodeName , "docker" , []string {
72+ "inspect" ,
73+ "--format" ,
74+ "Status={{.State.Status}} Health={{if .State.Health}}{{.State.Health.Status}}{{else}}<none>{{end}} Restarting={{.State.Restarting}} ExitCode={{.State.ExitCode}} Error={{.State.Error}}" ,
75+ nodeName ,
76+ }, []string {"DOCKER_CONTEXT=" + dockerContext })
5977 appendCommandOutput (ctx , buf , "docker logs " + nodeName , "docker" , []string {"logs" , "--tail" , "80" , nodeName }, []string {"DOCKER_CONTEXT=" + dockerContext })
6078 }
6179
6280 for _ , nodeName := range nodeNames {
6381 if ! strings .Contains (nodeName , "-server-" ) {
6482 continue
6583 }
66- appendCommandOutput (ctx , buf , "docker exec " + nodeName + " k3s kubectl get pods" , "docker" , []string {"exec" , nodeName , "k3s" , "kubectl" , "get" , "pods" , "-A" , "-o" , "wide" }, []string {"DOCKER_CONTEXT=" + dockerContext })
67- appendCommandOutput (ctx , buf , "docker exec " + nodeName + " k3s kubectl get events" , "docker" , []string {"exec" , nodeName , "k3s" , "kubectl" , "get" , "events" , "-A" , "--sort-by=.lastTimestamp" }, []string {"DOCKER_CONTEXT=" + dockerContext })
68- appendCommandOutput (ctx , buf , "docker exec " + nodeName + " k3s kubectl describe pods" , "docker" , []string {"exec" , nodeName , "k3s" , "kubectl" , "describe" , "pods" , "-A" }, []string {"DOCKER_CONTEXT=" + dockerContext })
84+ appendCommandOutput (ctx , buf , "docker exec " + nodeName + " kubectl get pods" , "docker" , []string {"exec" , nodeName , "kubectl" , "get" , "pods" , "-A" , "-o" , "wide" }, []string {"DOCKER_CONTEXT=" + dockerContext })
85+ appendCommandOutput (ctx , buf , "docker exec " + nodeName + " kubectl get events" , "docker" , []string {"exec" , nodeName , "kubectl" , "get" , "events" , "-A" , "--sort-by=.lastTimestamp" }, []string {"DOCKER_CONTEXT=" + dockerContext })
86+ appendCommandOutput (ctx , buf , "docker exec " + nodeName + " kubectl describe pods" , "docker" , []string {"exec" , nodeName , "kubectl" , "describe" , "pods" , "-A" }, []string {"DOCKER_CONTEXT=" + dockerContext })
6987 break
7088 }
7189}
0 commit comments