Skip to content

Add printer columns to PodNetworkConnectivityCheck CRD - #2977

Open
swshende-cmd wants to merge 2 commits into
openshift:masterfrom
swshende-cmd:rfe-5093-podnetworkconnectivitycheck-printer-columns
Open

Add printer columns to PodNetworkConnectivityCheck CRD#2977
swshende-cmd wants to merge 2 commits into
openshift:masterfrom
swshende-cmd:rfe-5093-podnetworkconnectivitycheck-printer-columns

Conversation

@swshende-cmd

Copy link
Copy Markdown

Summary

  • Adds additionalPrinterColumns to the PodNetworkConnectivityCheck CRD so that oc get podnetworkconnectivitychecks displays useful status information at a glance
  • Adds three columns: Target Endpoint, Reachable (True/False), and Since (last transition time)
  • Previously only NAME and AGE were shown, requiring YAML inspection or jsonpath queries to determine check results

Fixes: https://redhat.atlassian.net/browse/RFE-5093

Before

NAMESPACE                       NAME                                                                AGE
openshift-network-diagnostics   network-check-source-...-to-kubernetes-apiserver-service-cluster    18d
openshift-network-diagnostics   network-check-source-...-to-load-balancer-api-external              18d

After

NAMESPACE                       NAME                                                                TARGET ENDPOINT                                       REACHABLE   SINCE
openshift-network-diagnostics   network-check-source-...-to-kubernetes-apiserver-service-cluster    172.30.86.198:443                                     True        17d
openshift-network-diagnostics   network-check-source-...-to-load-balancer-api-external              api.swshende.vmware.gsslab.pnq2.redhat.com:6443       True        18d
openshift-network-diagnostics   network-check-source-...-to-network-check-target-service-cluster    network-check-target:80                               True        18d

Implementation

Added 3 +kubebuilder:printcolumn annotations to PodNetworkConnectivityCheck type in operatorcontrolplane/v1alpha1/types_conditioncheck.go:

// +kubebuilder:printcolumn:name="Target Endpoint",type=string,JSONPath=".spec.targetEndpoint",description="The endpoint being checked"
// +kubebuilder:printcolumn:name="Reachable",type=string,JSONPath=".status.conditions[?(@.type==\"Reachable\")].status",description="Whether the target endpoint is reachable"
// +kubebuilder:printcolumn:name="Since",type=date,JSONPath=".status.conditions[?(@.type==\"Reachable\")].lastTransitionTime",description="The time the reachability status last changed"

This follows the same pattern used by ClusterOperator, ClusterVersion, and Route CRDs.

Test Plan

  • Applied updated CRD to live OCP 4.22.3 cluster
  • Verified oc get podnetworkconnectivitychecks -A shows all 3 new columns
  • Verified column values match underlying resource data
  • Verified -o json and -o yaml output unchanged
  • Verified -o wide works correctly
  • Verified all 18 resources render with correct data
  • Ran make update (with PROTO_OPTIONAL=1) — code generation passes

Made with Cursor

Previously, `oc get podnetworkconnectivitychecks` only displayed NAME and
AGE columns, requiring users to inspect YAML output or use complex jsonpath
queries to determine connectivity check status.

This adds three additionalPrinterColumns to the CRD:
- Target Endpoint: shows the endpoint being checked (.spec.targetEndpoint)
- Reachable: shows the reachability status (True/False from conditions)
- Since: shows when the status last changed (date type)

This follows the same pattern used by ClusterOperator, ClusterVersion,
and Route CRDs in this repository.

Fixes: https://redhat.atlassian.net/browse/RFE-5093
Co-authored-by: Cursor <cursoragent@cursor.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 12, 2026
@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Hello @swshende-cmd! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 12, 2026
@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Hi @swshende-cmd. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 0467e912-75a0-4957-912b-084bc250f707

📥 Commits

Reviewing files that changed from the base of the PR and between 32370d2 and 55ece6a.

⛔ Files ignored due to path filters (3)
  • operatorcontrolplane/v1alpha1/zz_generated.crd-manifests/0000_10_network_01_podnetworkconnectivitychecks.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • operatorcontrolplane/v1alpha1/zz_generated.featuregated-crd-manifests.yaml is excluded by !**/zz_generated*
  • operatorcontrolplane/v1alpha1/zz_generated.featuregated-crd-manifests/podnetworkconnectivitychecks.controlplane.operator.openshift.io/AAA_ungated.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
📒 Files selected for processing (1)
  • operatorcontrolplane/v1alpha1/types_conditioncheck.go

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Added four Kubernetes print columns to PodNetworkConnectivityCheck. The columns show the target endpoint, the Reachable condition status, the last reachability transition time, and the resource age.

Suggested reviewers: joelspeed

Merge Risk: ⚪ Minimal · up to 55ece

This change adds status columns to the resource listing without changing stored resource data or behavior; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding printer columns to the PodNetworkConnectivityCheck CRD.
Description check ✅ Passed The description directly explains the new printer columns, their purpose, implementation, validation, and preserved Age output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The diff adds printer-column annotations and generated CRD YAML only; it adds no tests or Ginkgo titles with dynamic values.
Test Structure And Quality ✅ Passed The full PR diff changes only CRD annotations and generated manifests; it adds no Ginkgo tests, cluster operations, waits, or assertions to assess against these requirements.
Microshift Test Compatibility ✅ Passed The PR diff changes only printer-column annotations and generated CRD manifests; it adds no Ginkgo e2e tests or MicroShift-incompatible test references.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR diff adds only CRD printer-column annotations and generated YAML; it adds no Ginkgo e2e tests or multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The diff only adds print-column annotations and generated CRD fields for PodNetworkConnectivityCheck; it adds no workloads or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The PR changes only kubebuilder annotations and generated CRD YAML; no main, init, suite setup, or stdout-writing code changed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The complete PR diff changes only PodNetworkConnectivityCheck annotations and generated CRD manifests; it adds no Ginkgo tests, IPv4 assumptions, or external connectivity.
No-Weak-Crypto ✅ Passed The PR diff adds only printer-column annotations and generated CRD metadata; no weak-crypto tokens, crypto APIs, comparisons, or custom crypto code were added.
Container-Privileges ✅ Passed The diff only adds an Age printer-column annotation and generated CRD metadata. It adds no containers or prohibited privilege settings such as privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN,...
No-Sensitive-Data-In-Logs ✅ Passed The PR adds only CRD printer-column annotations and generated YAML; no logging calls or sensitive data are introduced.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@swshende-cmd

Copy link
Copy Markdown
Author

Hi Reviewers, First of All, sorry if I have missed any workflow here:

I was going through some back log cases and jiras and found this where I thought i can contribute, seems this was not a lot of change and surely adds value for customers in our product, I have gone ahead, implemented and tested this and would need your review for PR.

Implementation Summary
Repository: openshift/api
File Changed: operatorcontrolplane/v1alpha1/types_conditioncheck.go
Cluster Tested: OCP 4.22.3 (api.swshende.vmware.gsslab.pnq2.redhat.com)

Before implementation (only NAME + AGE)
NAMESPACE NAME AGE
openshift-network-diagnostics network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-endpoint-swshende-7rfg6-master-0 2d22h
openshift-network-diagnostics network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-service-cluster 18d
openshift-network-diagnostics network-check-source-swshende-7rfg6-worker-0-4zwg7-to-load-balancer-api-external 18d

After implementation (with Target Endpoint, Reachable, Since)
NAMESPACE NAME TARGET ENDPOINT REACHABLE SINCE
openshift-network-diagnostics network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-endpoint-swshende-7rfg6-master-0 10.74.238.148:6443 True 2d23h
openshift-network-diagnostics network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-endpoint-swshende-7rfg6-master-1 10.74.238.22:6443 True 2d23h
openshift-network-diagnostics network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-endpoint-swshende-7rfg6-master-2 10.74.233.153:6443 True 2d23h
openshift-network-diagnostics network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-service-cluster 172.30.86.198:443 True 17d

Impact
Zero behavioral change — printer columns are purely cosmetic (only affect table display output)
No API compatibility risk — CRD is compatibility level 4
Users can now immediately see connectivity status at a glance without YAML inspection or jsonpath queries.

Happy to have all the suggestions and feedback! Thank you.

@everettraven

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 18, 2026
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:

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.

One thing to note, by adding these custom printer columns the default Age column will be dropped.

If we wanted to keep that information around we'd need to explicitly add an Age column here.

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.

After doing a bit more research on this API, it looks like this API is actually stamped out on the cluster via a controller whose implementation exists in client-go.

It seems like in order for this change to be properly picked up and applied to the cluster I think we would need to update https://github.com/openshift/library-go/blob/master/pkg/operator/connectivitycheckcontroller/manifests/controlplane.operator.openshift.io_podnetworkconnectivitychecks.yaml as well.

When custom additionalPrinterColumns are defined, the default Age column
is no longer automatically included. Add it explicitly to maintain the
expected oc get output.

Addresses review feedback from @everettraven.

Co-authored-by: Cursor <cursoragent@cursor.com>
@swshende-cmd

Copy link
Copy Markdown
Author

@everettraven Thank you for the review! Both points addressed:

1. Age column restored
Added an explicit Age printer column (+kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp") to preserve the default behavior. Good catch — I missed that custom columns drop the implicit Age.

2. library-go update 📝
Acknowledged — will raise a companion PR to update https://github.com/openshift/library-go/blob/master/pkg/operator/connectivitycheckcontroller/manifests/controlplane.operator.openshift.io_podnetworkconnectivitychecks.yaml once this API change is merged.


Updated test results (OCP 4.22.3, with Age column)

NAMESPACE                       NAME                                                                                                          TARGET ENDPOINT                                       REACHABLE   SINCE   AGE
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-endpoint-swshende-7rfg6-master-0   10.74.238.148:6443                                    True        3d7h    3d7h
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-endpoint-swshende-7rfg6-master-1   10.74.238.22:6443                                     True        3d7h    3d7h
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-endpoint-swshende-7rfg6-master-2   10.74.233.153:6443                                    True        3d7h    3d7h
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-apiserver-service-cluster                    172.30.86.198:443                                     True        25d     26d
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-kubernetes-default-service-cluster-0                    172.30.0.1:443                                        True        26d     26d
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-load-balancer-api-external                              api.swshende.vmware.gsslab.pnq2.redhat.com:6443       True        26d     26d
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-load-balancer-api-internal                              api-int.swshende.vmware.gsslab.pnq2.redhat.com:6443   True        26d     26d
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-network-check-target-service-cluster                    network-check-target:80                               True        26d     26d
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-network-check-target-swshende-7rfg6-master-0            10.128.0.3:8080                                       True        26d     26d
openshift-network-diagnostics   network-check-source-swshende-7rfg6-worker-0-4zwg7-to-openshift-apiserver-service-cluster                     172.30.173.0:443                                      True        26d     26d

All 6 E2E tests passed:

  • ✅ CRD has 4 printer columns (Target Endpoint, Reachable, Since, Age)
  • ✅ All column headers present in output
  • ✅ Reachable column shows condition status correctly
  • ✅ Target Endpoint matches spec.targetEndpoint
  • -o json output unaffected
  • ✅ All 18 resources displayed correctly

@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@swshende-cmd: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@swshende-cmd

Copy link
Copy Markdown
Author

@everettraven Hi, if everything looks good, would you help with further needed help, Thank you in advance.

@everettraven

Copy link
Copy Markdown
Contributor

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 19, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

No second-stage tests were triggered for this PR.

This can happen when:

  • The changed files don't match any pipeline_run_if_changed patterns
  • All files match pipeline_skip_if_only_changed patterns
  • No pipeline-controlled jobs are defined for the master branch

Use /test ? to see all available tests.

@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: everettraven

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 19, 2026
@swshende-cmd

Copy link
Copy Markdown
Author

/verified by @swshende-cmd

@openshift-ci-robot

Copy link
Copy Markdown

@swshende-cmd: Jira verification commands are restricted to collaborators for this repo.

Details

In response to this:

/verified by @swshende-cmd

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants