Skip to content

Add printer columns to PodNetworkConnectivityCheck CRD - #2977

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

Add printer columns to PodNetworkConnectivityCheck CRD#2977
swshende-cmd wants to merge 1 commit 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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign joelspeed for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 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: 43d37254-1118-4a89-8810-64b19ab93b56

📥 Commits

Reviewing files that changed from the base of the PR and between 42cb0a0 and 32370d2.

⛔ 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

📝 Walkthrough

Walkthrough

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

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the addition of printer columns to the PodNetworkConnectivityCheck CRD.
Description check ✅ Passed The description directly explains the three printer columns, their purpose, implementation, and validation.
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 API printer-column annotations and generated CRD data only; it changes no test files or Ginkgo test-title calls.
Test Structure And Quality ✅ Passed The patch changes only API annotations and generated CRD manifests; it adds no Ginkgo tests or It blocks, so the listed test-quality requirements are not applicable.
Microshift Test Compatibility ✅ Passed The commit changes one API type and three generated CRD manifests; it adds no Ginkgo e2e tests or new test references to MicroShift-unavailable APIs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR changes only CRD printer-column annotations and generated YAML; the parent-to-HEAD diff adds no Ginkgo tests or multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The commit changes only PodNetworkConnectivityCheck print-column annotations and generated CRDs; it adds no deployments, controllers, replicas, affinity, topology spread, selectors, tolerations, or...
Ote Binary Stdout Contract ✅ Passed The PR changes only print-column annotations and generated CRD YAML; the changed Go file has no main, init, suite setup, or stdout-writing calls.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The diff adds only print-column annotations and generated CRD manifests. It adds no Ginkgo tests, IPv4 assumptions, or external connectivity requirements.
No-Weak-Crypto ✅ Passed The PR diff only adds printer-column annotations and generated CRD metadata; added lines contain no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR changes Go annotations and generated CRDs only; the added lines contain no privileged:true, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed The commit adds only CRD printer-column metadata and generated manifests; the diff adds no logging calls or password, token, PII, session ID, or customer data to logs.
✨ 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.

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

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it 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.

2 participants