MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / DescribeKubernetesNodes

Function DescribeKubernetesNodes

tests/utils/nodes/nodes.go:117–134  ·  view source on GitHub ↗

DescribeKubernetesNodes prints the `describe node` for each node in the kubernetes cluster

(ctx context.Context, crudClient client.Client)

Source from the content-addressed store, hash-verified

115// DescribeKubernetesNodes prints the `describe node` for each node in the
116// kubernetes cluster
117func DescribeKubernetesNodes(ctx context.Context, crudClient client.Client) (string, error) {
118 nodeList, err := List(ctx, crudClient)
119 if err != nil {
120 return "", err
121 }
122 var report strings.Builder
123 for _, node := range nodeList.Items {
124 command := fmt.Sprintf("kubectl describe node %v", node.Name)
125 stdout, _, err := run.Run(command)
126 if err != nil {
127 return "", err
128 }
129 report.WriteString("================================================\n")
130 report.WriteString(stdout)
131 report.WriteString("================================================\n")
132 }
133 return report.String(), nil
134}
135
136// IsNodeReachable checks if a node is:
137// 1. Ready

Callers 1

AssertClusterIsReadyFunction · 0.92

Calls 3

RunFunction · 0.92
ListFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected