Skip to content

Fix CRDB skills to discover cluster schema#656

Open
VishalJaishankar wants to merge 1 commit into
cockroachdb:masterfrom
VishalJaishankar:vijaisha/skill-fix
Open

Fix CRDB skills to discover cluster schema#656
VishalJaishankar wants to merge 1 commit into
cockroachdb:masterfrom
VishalJaishankar:vijaisha/skill-fix

Conversation

@VishalJaishankar

@VishalJaishankar VishalJaishankar commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add explicit CrdbCluster discovery before object-specific reads
  • derive inspected field paths from the live served CRD schema instead of assuming names or stale paths
  • update install, migration, TLS, diagnostics, escalation, and multi-region skill flows to capture schema-grounded data
  • fix the schema helper for zsh by avoiding the special path variable, which mutates PATH and breaks jq lookup
  • stop object-specific drilldown when no live CrdbCluster rows are discovered; remaining CrdbNode owner refs/labels are teardown evidence, not substitute discovery
  • add a Codex directive requiring non-empty commit and PR message details for future PRs

Rationale

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

  • git diff --check
  • Markdown code fence balance check
  • no remaining unsafe for path helper loops
  • live OpenShift cluster read using the provided KUBECONFIG confirmed no live CrdbCluster candidates in cockroach-ns-xxnxyv
  • live CRD schema helper resolved spec.template.spec.image, status.actions, and spec.template.spec.certificates under zsh

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.

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 \

@NishanthNalluri NishanthNalluri Jul 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]}'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to other comment. hash-revision should be clusterNodeRevision.

@NishanthNalluri

NishanthNalluri commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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 NishanthNalluri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the buggy commands!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants