Skip to content

Commit ccb0690

Browse files
feat: collecting logs
1 parent 77f5777 commit ccb0690

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

.github/workflows/e2e.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,40 +165,40 @@ jobs:
165165
echo "Collecting cluster events..."
166166
kubectl get events -A --sort-by='.lastTimestamp' > bootstrap-pod-logs/events.txt 2>&1 || true
167167
echo "✓ Saved events.txt"
168-
168+
169169
# Get all clusters
170170
echo "Getting list of workload clusters..."
171171
kubectl get clusters -A > bootstrap-pod-logs/clusters.txt 2>&1 || true
172-
172+
173173
# Collect logs from workload cluster (where konnector-agent actually runs)
174174
echo "===== Collecting logs from WORKLOAD CLUSTER ====="
175175
mkdir -p bootstrap-pod-logs/workload-cluster
176-
176+
177177
# Find the workload cluster name (starts with "quick-start")
178178
WORKLOAD_CLUSTER=$(kubectl get clusters -A -o jsonpath='{.items[?(@.metadata.name contains "quick-start")].metadata.name}' 2>/dev/null | head -n 1)
179179
WORKLOAD_NAMESPACE=$(kubectl get clusters -A -o jsonpath='{.items[?(@.metadata.name contains "quick-start")].metadata.namespace}' 2>/dev/null | head -n 1)
180-
180+
181181
if [[ -n "$WORKLOAD_CLUSTER" && -n "$WORKLOAD_NAMESPACE" ]]; then
182182
echo "Found workload cluster: $WORKLOAD_CLUSTER in namespace $WORKLOAD_NAMESPACE"
183-
183+
184184
# Get workload cluster kubeconfig from secret
185185
echo "Retrieving workload cluster kubeconfig..."
186186
if kubectl get secret -n "$WORKLOAD_NAMESPACE" "${WORKLOAD_CLUSTER}-kubeconfig" -o jsonpath='{.data.value}' 2>/dev/null | base64 -d > bootstrap-pod-logs/workload-cluster/kubeconfig.yaml; then
187187
export WORKLOAD_KUBECONFIG="${PWD}/bootstrap-pod-logs/workload-cluster/kubeconfig.yaml"
188188
echo "✓ Retrieved workload cluster kubeconfig"
189-
189+
190190
# Test connectivity
191191
if kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" cluster-info &> bootstrap-pod-logs/workload-cluster/cluster-info.txt; then
192192
echo "✓ Can connect to workload cluster"
193-
193+
194194
# Get all pods in ntnx-system namespace
195195
echo "Getting pods in ntnx-system namespace..."
196196
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get pods -n ntnx-system -o wide > bootstrap-pod-logs/workload-cluster/ntnx-system-pods.txt 2>&1 || true
197-
197+
198198
# Get konnector-agent pod descriptions (THIS IS WHAT YOU WANT!)
199199
echo "Getting konnector-agent pod descriptions..."
200200
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" describe pods -n ntnx-system -l app.kubernetes.io/name=konnector-agent > bootstrap-pod-logs/workload-cluster/konnector-agent-describe.txt 2>&1 || true
201-
201+
202202
# Get konnector-agent pod logs
203203
echo "Getting konnector-agent pod logs..."
204204
for pod in $(kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get pods -n ntnx-system -l app.kubernetes.io/name=konnector-agent -o name 2>/dev/null); do
@@ -207,34 +207,34 @@ jobs:
207207
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" logs -n ntnx-system "$pod_name" --all-containers=true --tail=1000 > "bootstrap-pod-logs/workload-cluster/${pod_name}.log" 2>&1 || true
208208
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" logs -n ntnx-system "$pod_name" --all-containers=true --previous --tail=500 > "bootstrap-pod-logs/workload-cluster/${pod_name}-previous.log" 2>&1 || true
209209
done
210-
210+
211211
# Get hook pod descriptions and logs (hook-preinstall is what fails)
212212
echo "Getting hook pod information..."
213213
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get pods -n ntnx-system | grep hook > bootstrap-pod-logs/workload-cluster/hook-pods.txt 2>&1 || true
214-
214+
215215
for hook_pod in hook-preinstall hook-postinstall; do
216216
if kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get pod -n ntnx-system "$hook_pod" &>/dev/null; then
217217
echo " Found $hook_pod, collecting info..."
218218
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" describe pod -n ntnx-system "$hook_pod" > "bootstrap-pod-logs/workload-cluster/${hook_pod}-describe.txt" 2>&1 || true
219219
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" logs -n ntnx-system "$hook_pod" --all-containers=true --tail=1000 > "bootstrap-pod-logs/workload-cluster/${hook_pod}.log" 2>&1 || true
220220
fi
221221
done
222-
222+
223223
# Get konnector-agent secret info (without credentials)
224224
echo "Getting konnector-agent secret info..."
225225
if kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get secret -n ntnx-system konnector-agent &>/dev/null; then
226226
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get secret -n ntnx-system konnector-agent -o yaml | grep -v "password\|credential" > bootstrap-pod-logs/workload-cluster/konnector-agent-secret.yaml 2>&1 || true
227227
echo "Secret keys present:" > bootstrap-pod-logs/workload-cluster/konnector-agent-secret-keys.txt
228228
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get secret -n ntnx-system konnector-agent -o jsonpath='{.data}' | grep -o '"[^"]*":' | tr -d '":' >> bootstrap-pod-logs/workload-cluster/konnector-agent-secret-keys.txt 2>&1 || true
229229
fi
230-
230+
231231
# Get workload cluster events
232232
echo "Getting workload cluster events..."
233233
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get events -n ntnx-system --sort-by='.lastTimestamp' > bootstrap-pod-logs/workload-cluster/events.txt 2>&1 || true
234-
234+
235235
# Get all namespaces in workload cluster
236236
kubectl --kubeconfig="$WORKLOAD_KUBECONFIG" get namespaces > bootstrap-pod-logs/workload-cluster/namespaces.txt 2>&1 || true
237-
237+
238238
echo "✓ Workload cluster logs collected successfully"
239239
else
240240
echo "✗ Cannot connect to workload cluster"
@@ -246,7 +246,7 @@ jobs:
246246
else
247247
echo "No workload cluster found (this is normal if cluster creation failed early)"
248248
fi
249-
249+
250250
echo "===== ✓ Log collection completed successfully ====="
251251
ls -lh bootstrap-pod-logs/
252252
else

0 commit comments

Comments
 (0)