Skip to content

Add print columns for CRDs in kubectl output#11805

Open
caseydavenport wants to merge 4 commits intoprojectcalico:masterfrom
caseydavenport:casey-printer-columns
Open

Add print columns for CRDs in kubectl output#11805
caseydavenport wants to merge 4 commits intoprojectcalico:masterfrom
caseydavenport:casey-printer-columns

Conversation

@caseydavenport
Copy link
Member

Description

Add basic information to kubectl output for our CRDs using printcolums

Related issues/PRs

Todos

  • Tests
  • Documentation
  • Release note

Release Note

TBD

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

@caseydavenport caseydavenport requested a review from a team as a code owner February 9, 2026 22:51
Copilot AI review requested due to automatic review settings February 9, 2026 22:51
@marvin-tigera marvin-tigera added this to the Calico v3.32.0 milestone Feb 9, 2026
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Feb 9, 2026
@caseydavenport caseydavenport added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Feb 9, 2026
@caseydavenport caseydavenport force-pushed the casey-printer-columns branch 3 times, most recently from 21bb924 to adcb635 Compare February 9, 2026 23:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to improve kubectl get output for Calico CRDs by adding additionalPrinterColumns (via +kubebuilder:printcolumn markers and/or direct CRD YAML updates), surfacing key spec/status fields in tabular output.

Changes:

  • Added/updated +kubebuilder:printcolumn markers across multiple CRD API types (policies, IPAM, BGP, node status, etc.).
  • Updated several generated CRD YAMLs under api/config/crd/ to include additionalPrinterColumns.
  • Introduced new columns such as Tier/Order, node/classes, claim time, and cluster readiness/version.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
api/pkg/apis/projectcalico/v3/stagednetworkpolicy.go Adds printer column for policy order (currently with naming/type issues).
api/pkg/apis/projectcalico/v3/stagedglobalnetworkpolicy.go Adds printer column for policy order.
api/pkg/apis/projectcalico/v3/nodestatus.go Adds printer columns for node name and monitored classes.
api/pkg/apis/projectcalico/v3/networkpolicy.go Adds printer column for policy order.
api/pkg/apis/projectcalico/v3/kubecontrollersconfig.go Adds printer column for enabled controllers (currently attached to list type + JSONPath concerns).
api/pkg/apis/projectcalico/v3/ipamhandle.go Adds printer column for handle ID.
api/pkg/apis/projectcalico/v3/ipamconfig.go Adds printer columns for key IPAM config fields (currently attached to list type + description issue).
api/pkg/apis/projectcalico/v3/ipamblocks.go Adds printer column for affinity claim time (and surfaces existing column-name typo).
api/pkg/apis/projectcalico/v3/hostendpoint.go Adds printer columns for node/interface (currently attached to list type).
api/pkg/apis/projectcalico/v3/globalnetworkset.go Adds printer column for age (currently attached to list type).
api/pkg/apis/projectcalico/v3/globalnetworkpolicy.go Adds printer columns for order/age (currently attached to list type).
api/pkg/apis/projectcalico/v3/clusterinfo.go Adds printer columns for version, readiness, and cluster types.
api/pkg/apis/projectcalico/v3/blockaffinity.go Adds printer column for affinity type.
api/pkg/apis/projectcalico/v3/bgppeer.go Adds printer columns for BGP peer fields (currently attached to list type + ASN type concerns).
api/config/crd/projectcalico.org_stagednetworkpolicies.yaml Adds .spec.order printer column (currently with naming/type issues).
api/config/crd/projectcalico.org_stagedglobalnetworkpolicies.yaml Adds .spec.order printer column.
api/config/crd/projectcalico.org_networkpolicies.yaml Adds .spec.order printer column.
api/config/crd/projectcalico.org_ipamhandles.yaml Adds handle ID printer column.
api/config/crd/projectcalico.org_ipamblocks.yaml Adds affinity claim time printer column (and contains existing column-name typo).
api/config/crd/projectcalico.org_clusterinformations.yaml Adds version/ready/types printer columns.
api/config/crd/projectcalico.org_caliconodestatuses.yaml Adds node/classes printer columns.
api/config/crd/projectcalico.org_blockaffinities.yaml Adds type printer column.
Comments suppressed due to low confidence (4)

api/pkg/apis/projectcalico/v3/ipamconfig.go:30

  • The StrictAffinity printer column description is inverted. The API field docs state: "When StrictAffinity is true, borrowing IP addresses is not allowed"; the column description currently says borrowing is allowed. Please update the description to match the actual semantics to avoid misleading kubectl output.

// IPAMConfigurationList contains a list of IPAMConfiguration resources.

api/pkg/apis/projectcalico/v3/bgppeer.go:34

  • The new +kubebuilder:printcolumn markers are currently attached to BGPPeerList (the next type), so they won't be reflected in the generated CRD (api/config/crd/projectcalico.org_bgppeers.yaml has no additionalPrinterColumns). Move these markers to the BGPPeer type and regenerate CRDs. Also, .spec.asNumber/.spec.localASNumber are integers in the CRD schema, so use an integer/number column type for those fields.

// BGPPeerList is a list of BGPPeer resources.
type BGPPeerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`

api/pkg/apis/projectcalico/v3/globalnetworkpolicy.go:33

  • These print columns are currently on GlobalNetworkPolicyList (the next type), not the GlobalNetworkPolicy resource type, so they won't be emitted into the CRD (api/config/crd/projectcalico.org_globalnetworkpolicies.yaml has no additionalPrinterColumns). Move the markers to GlobalNetworkPolicy and regenerate CRDs so kubectl output actually changes.
// +kubebuilder:resource:scope=Cluster

// GlobalNetworkPolicyList is a list of Policy objects.
type GlobalNetworkPolicyList struct {
	metav1.TypeMeta `json:",inline"`

api/pkg/apis/projectcalico/v3/ipamconfig.go:31

  • These +kubebuilder:printcolumn markers are attached to IPAMConfigurationList (the next type), but the generated CRD (api/config/crd/projectcalico.org_ipamconfigurations.yaml) currently has no additionalPrinterColumns. Move the printcolumn markers to the IPAMConfiguration type (the CRD root) and regenerate the CRDs so the columns show up in kubectl.
// +kubebuilder:resource:scope=Cluster

// IPAMConfigurationList contains a list of IPAMConfiguration resources.
type IPAMConfigurationList struct {

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

Labels

docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants