Fix CRDB skills to discover cluster schema#656
Conversation
9ac446c to
f6bcf67
Compare
Update the CockroachDB Helm troubleshooting skills to discover live CrdbCluster resources before reading object-specific fields. This removes assumptions that Helm release names, service names, image tags, or CRDB versions match CrdbCluster.metadata.name. Fetch and save the served CRD schema, derive available field paths from that schema, and use those paths when collecting image, action, condition, migration, certificate, ready-node, and reconciled data. This keeps skill output aligned with the CRD version actually installed in the target cluster. Apply the same discovery-first pattern across install verification, migration debugging, TLS validation, escalation packet collection, Helm diagnosis, and multi-region service checks. Fix the schema helper for zsh by avoiding the special shell variable name path, which otherwise mutates PATH and breaks jq lookup inside crdb_first_schema_path. Handle namespaces with no live CrdbCluster rows by stopping object-specific drilldown. Remaining CrdbNode owner references and labels may be collected as teardown evidence, but they are not treated as replacement CrdbCluster discovery. Add a Codex directive requiring future PRs to include non-empty commit and PR message details covering summary, rationale, and validation. Validation: git diff --check; Markdown code fence balance check; no remaining unsafe for-path helper loops; live OpenShift cluster read with KUBECONFIG from /var/folders/8q/494h7chx3jn5291_k74_2q5c0000gp/T/helm-charts-ocp-ocp-4a34ff7a86-463512545/auth/kubeconfig confirmed empty CrdbCluster discovery in cockroach-ns-xxnxyv and resolved live CRD schema paths for spec.template.spec.image, status.actions, and spec.template.spec.certificates.
f6bcf67 to
564e5c4
Compare
|
|
||
| kubectl -n <cockroachdb-namespace> get crdbnodes \ | ||
| kubectl -n "$CRDB_NAMESPACE" get crdbnodes \ | ||
| -o custom-columns=NAME:.metadata.name,GENERATION:.metadata.generation,OBSERVED:.status.observedGeneration,PHASE:.status.phase,HASH:.metadata.annotations["crdb.cockroachlabs.com/hash-revision"],NODE_ID:.status.nodeID \ |
There was a problem hiding this comment.
Could you verify this command once? It worked for me after wrapping entire custom-columns in quotes('') and i dont think we have phase and hash-revision annotation defined in crdbnode status.
| /cockroach/cockroach node status --decommission | ||
|
|
||
| kubectl -n <cockroachdb-namespace> get crdbnodes -o json | jq '[.items[] | select(.status.phase=="Decommissioning")] | {count: length, nodes: [.[].metadata.name]}' | ||
| kubectl -n "$CRDB_NAMESPACE" get crdbnodes -o json | jq '[.items[] | select(.status.phase=="Decommissioning")] | {count: length, nodes: [.[].metadata.name]}' |
There was a problem hiding this comment.
crdbnode does not have phase field. Should be select(.status.decommission != null).
|
|
||
| kubectl -n "$CRDB_NAMESPACE" get crdbnodes \ | ||
| -o custom-columns=NAME:.metadata.name,GENERATION:.metadata.generation,OBSERVED:.status.observedGeneration,PHASE:.status.phase,HASH:.metadata.annotations["crdb.cockroachlabs.com/hash-revision"],NODE_ID:.status.nodeID | ||
| ``` |
There was a problem hiding this comment.
Similar to other comment. hash-revision should be clusterNodeRevision.
|
If some of these issues are originating from runbooks, we should update them as well. In runbooks, make sure commands and helpers are properly indented within code blocks. Also, since these are skills its no brainer to agents that all of these commands are ran in single shell session but we could add a comment mentioning the same in case if any user tries to run these commands manually. |
NishanthNalluri
left a comment
There was a problem hiding this comment.
Thanks for fixing the buggy commands!
Summary
pathvariable, which mutatesPATHand breaksjqlookupRationale
The skills should work from observed cluster state first, then drill into discovered CrdbCluster objects using fields exposed by the served CRD schema. This avoids stale assumptions about object names and CRD layouts, and handles teardown states where CrdbNodes remain after the CrdbCluster is gone.
Validation
for pathhelper loopscockroach-ns-xxnxyvspec.template.spec.image,status.actions, andspec.template.spec.certificatesunder zsh