Skip to content

Printing CRDs with priority set will hide columns  #65196

@soltysh

Description

@soltysh

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened:

Create a CRD:

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: foos.samplecontroller.k8s.io
spec:
  group: samplecontroller.k8s.io
  version: v1alpha1
  names:
    kind: Foo
    plural: foos
  scope: Namespaced
  validation:
    openAPIV3Schema:
      properties:
        spec:
          properties:
            replicas:
              type: integer
              minimum: 1
              maximum: 10
  additionalPrinterColumns:
  - name: replicas
    type: integer
    JSONPath: .spec.replicas
    priority: 1

and then its instance:

apiVersion: samplecontroller.k8s.io/v1alpha1
kind: Foo
metadata:
  name: example-foo
spec:
  deploymentName: example-foo
  replicas: 1

Invoking kubectl get foos.samplecontroller.k8s.io will return only the NAME column omitting the additionalPrinterColumns that have priority set to a value > 0.

Invoking kubectl get foos.samplecontroller.k8s.io -o wide will return all the columns properly.

The culprit lies here:

if !options.Wide && column.Priority != 0 {
we should probably calculate the number of columns and only after exceeding some limit print those with lower priority.

/cc @sttts

Metadata

Metadata

Assignees

Labels

area/custom-resourceskind/documentationCategorizes issue or PR as related to documentation.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.sig/cliCategorizes an issue or PR as relevant to SIG CLI.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions