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

Function printPodDiagnostics

tests/utils/utils.go:149–184  ·  view source on GitHub ↗
(clusterInfo *tabby.Tabby, pod *corev1.Pod)

Source from the content-addressed store, hash-verified

147}
148
149func printPodDiagnostics(clusterInfo *tabby.Tabby, pod *corev1.Pod) {
150 clusterInfo.AddLine("Pod name", pod.Name)
151 clusterInfo.AddLine("Pod phase", pod.Status.Phase)
152 clusterInfo.AddLine("Pod node", pod.Spec.NodeName)
153 if pod.Status.Reason != "" {
154 clusterInfo.AddLine("Pod reason", pod.Status.Reason)
155 }
156 if pod.Status.Message != "" {
157 clusterInfo.AddLine("Pod message", pod.Status.Message)
158 }
159 for _, cond := range pod.Status.Conditions {
160 if cond.Status == corev1.ConditionFalse {
161 clusterInfo.AddLine(
162 fmt.Sprintf("Condition %s", cond.Type),
163 fmt.Sprintf("%s: %s", cond.Reason, cond.Message),
164 )
165 }
166 }
167 for _, cs := range pod.Status.InitContainerStatuses {
168 if cs.State.Waiting != nil {
169 clusterInfo.AddLine(
170 fmt.Sprintf("Init container %s waiting", cs.Name),
171 fmt.Sprintf("%s: %s", cs.State.Waiting.Reason, cs.State.Waiting.Message),
172 )
173 }
174 }
175 for _, cs := range pod.Status.ContainerStatuses {
176 if cs.State.Waiting != nil {
177 clusterInfo.AddLine(
178 fmt.Sprintf("Container %s waiting", cs.Name),
179 fmt.Sprintf("%s: %s", cs.State.Waiting.Reason, cs.State.Waiting.Message),
180 )
181 }
182 }
183 clusterInfo.AddLine("---", "---")
184}
185
186func printPVCDiagnostics(clusterInfo *tabby.Tabby, pvc *corev1.PersistentVolumeClaim) {
187 clusterInfo.AddLine("PVC name", pvc.Name)

Callers 1

PrintClusterResourcesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected