Skip to content

Conversation

@joshbranham
Copy link
Contributor

@joshbranham joshbranham commented Aug 5, 2025

This extends the existing osdctl network verify-egress command to support our new --pod-mode feature in osd-network-verifier.

It relies on OCM and Backplane to fetch cluster data, and then constructs the necessary config to perform egress validation.

Of note, the CaCert option is not supported, as this will be configured automatically since the verification runs as a Pod in the cluster.

This code was written in conjunction with claude, and commits reflect that.

Sample Run

> ./dist/osdctl_darwin_arm64_v8.0/osdctl network verify-egress --cluster-id 26lot29426h7hol5hi9saend50s6r5ab --pod-mode -S
2025/08/06 14:37:19 Preparing to run pod-based network verification in namespace openshift-network-diagnostics.
INFO[0002] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0002] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
INFO[0004] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0004] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
2025/08/06 14:37:23 Pod mode using backplane credentials for cluster: 26lot29426h7hol5hi9saend50s6r5ab
2025/08/06 14:37:23 Pod mode initialized with namespace: openshift-network-diagnostics
2025/08/06 14:37:23 Detected AWS region from OCM: us-east-1
Using egress URL list from https://api.github.com/repos/openshift/osd-network-verifier/contents/pkg/data/egress_lists/aws-classic.yaml?ref=main at SHA 997186fa8fbf863db4b071d246e7bb781bc1e796
Summary:
All tests passed!

joshbranham and others added 3 commits August 5, 2025 15:36
Implement --pod-mode flag to run egress verification using Kubernetes Jobs
instead of cloud instances, providing more accurate results by testing from
within the actual cluster environment.

Key features:
- New --pod-mode flag enables Kubernetes-based verification
- Automatic region detection from OCM for AWS clusters
- Manual region override with --region flag
- Configurable namespace with --namespace flag (default: openshift-network-diagnostics)
- Custom kubeconfig support with --kubeconfig flag
- Automatic probe switching to curl (required for pod mode)
- Comprehensive input validation with clear error messages
- Mutual exclusivity with cloud-specific flags

Benefits:
- No cloud credentials required
- Tests actual cluster network environment
- More accurate results than external instance testing
- Secure execution with restrictive pod security contexts

Usage examples:
  osdctl network verify-egress --cluster-id my-cluster --pod-mode
  osdctl network verify-egress --pod-mode --platform aws-classic --region us-east-1

Includes comprehensive unit test coverage with 21 new tests covering:
- Input validation logic
- Region detection (OCM vs manual)
- Probe validation and switching
- AWS config generation
- Error handling scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@joshbranham joshbranham self-assigned this Aug 5, 2025
@joshbranham joshbranham added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 5, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 5, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 5, 2025

@joshbranham: This pull request references SREP-862 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

Details

In response to this:

This extends the existing osdctl network verify-egress command to support our new --pod-mode feature in osd-network-verifier.

It relies on OCM and Backplane to fetch cluster data, and then constructs the necessary config to perform egress validation.

Of note, the CaCert option is not supported, as this will be configured automatically since the verification runs as a Pod in the cluster.

This code was written in conjunction with claude, and commits reflect that.

TODO:

  • Cut a new release of osd-network-verifier and update go.mod to use that tag.

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.

@joshbranham
Copy link
Contributor Author

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 5, 2025
@openshift-ci openshift-ci bot requested review from dustman9000 and fahlmant August 5, 2025 22:50
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 5, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 5, 2025

@joshbranham: This pull request references SREP-862 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

Details

In response to this:

This extends the existing osdctl network verify-egress command to support our new --pod-mode feature in osd-network-verifier.

It relies on OCM and Backplane to fetch cluster data, and then constructs the necessary config to perform egress validation.

Of note, the CaCert option is not supported, as this will be configured automatically since the verification runs as a Pod in the cluster.

This code was written in conjunction with claude, and commits reflect that.

Sample Run

 ./dist/osdctl_darwin_arm64_v8.0/osdctl network verify-egress --cluster-id 26lot29426h7hol5hi9saend50s6r5ab --pod-mode --egress-timeout 30s -S
2025/08/05 16:53:29 Preparing to run pod-based network verification in namespace openshift-network-diagnostics.
INFO[0002] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0002] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
INFO[0003] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0003] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
2025/08/05 16:53:32 Pod mode using osdcloud credentials for cluster: 26lot29426h7hol5hi9saend50s6r5ab
2025/08/05 16:53:32 Pod mode initialized with namespace: openshift-network-diagnostics
2025/08/05 16:53:32 Detected AWS region from OCM: us-east-1
Using egress URL list from https://api.github.com/repos/openshift/osd-network-verifier/contents/pkg/data/egress_lists/aws-classic.yaml?ref=main at SHA 997186fa8fbf863db4b071d246e7bb781bc1e796
Summary:
All tests passed!

TODO

  • Cut a new release of osd-network-verifier and update go.mod to use that tag.

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.

@joshbranham
Copy link
Contributor Author

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 5, 2025
@dakotalongRH
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels Aug 6, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 6, 2025

@joshbranham: This pull request references SREP-862 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

Details

In response to this:

This extends the existing osdctl network verify-egress command to support our new --pod-mode feature in osd-network-verifier.

It relies on OCM and Backplane to fetch cluster data, and then constructs the necessary config to perform egress validation.

Of note, the CaCert option is not supported, as this will be configured automatically since the verification runs as a Pod in the cluster.

This code was written in conjunction with claude, and commits reflect that.

Sample Run

> ./dist/osdctl_darwin_arm64_v8.0/osdctl network verify-egress --cluster-id 26lot29426h7hol5hi9saend50s6r5ab --pod-mode -S
2025/08/06 14:37:19 Preparing to run pod-based network verification in namespace openshift-network-diagnostics.
INFO[0002] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0002] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
INFO[0004] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0004] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
2025/08/06 14:37:23 Pod mode using backplane credentials for cluster: 26lot29426h7hol5hi9saend50s6r5ab
2025/08/06 14:37:23 Pod mode initialized with namespace: openshift-network-diagnostics
2025/08/06 14:37:23 Detected AWS region from OCM: us-east-1
Using egress URL list from https://api.github.com/repos/openshift/osd-network-verifier/contents/pkg/data/egress_lists/aws-classic.yaml?ref=main at SHA 997186fa8fbf863db4b071d246e7bb781bc1e796
Summary:
All tests passed!

TODO

  • Cut a new release of osd-network-verifier and update go.mod to use that tag.

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Aug 6, 2025

@joshbranham: This pull request references SREP-862 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

Details

In response to this:

This extends the existing osdctl network verify-egress command to support our new --pod-mode feature in osd-network-verifier.

It relies on OCM and Backplane to fetch cluster data, and then constructs the necessary config to perform egress validation.

Of note, the CaCert option is not supported, as this will be configured automatically since the verification runs as a Pod in the cluster.

This code was written in conjunction with claude, and commits reflect that.

Sample Run

> ./dist/osdctl_darwin_arm64_v8.0/osdctl network verify-egress --cluster-id 26lot29426h7hol5hi9saend50s6r5ab --pod-mode -S
2025/08/06 14:37:19 Preparing to run pod-based network verification in namespace openshift-network-diagnostics.
INFO[0002] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0002] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
INFO[0004] Backplane URL retrieved via OCM environment: https://api.backplane.openshift.com
INFO[0004] No PagerDuty API Key configuration available. This will result in failure of `ocm-backplane login --pd <incident-id>` command.
2025/08/06 14:37:23 Pod mode using backplane credentials for cluster: 26lot29426h7hol5hi9saend50s6r5ab
2025/08/06 14:37:23 Pod mode initialized with namespace: openshift-network-diagnostics
2025/08/06 14:37:23 Detected AWS region from OCM: us-east-1
Using egress URL list from https://api.github.com/repos/openshift/osd-network-verifier/contents/pkg/data/egress_lists/aws-classic.yaml?ref=main at SHA 997186fa8fbf863db4b071d246e7bb781bc1e796
Summary:
All tests passed!

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.

@joshbranham
Copy link
Contributor Author

/retest

@joshbranham
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2025
@joshbranham joshbranham force-pushed the feature/add-network-verifier-pod-mode branch from 29e33f5 to 558fcaf Compare August 6, 2025 22:13
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 6, 2025

@joshbranham: 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.

@reedcort
Copy link
Contributor

reedcort commented Aug 7, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dakotalongRH, joshbranham, reedcort

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-merge-bot openshift-merge-bot bot merged commit 510d4d1 into openshift:master Aug 7, 2025
7 checks passed
@joshbranham joshbranham deleted the feature/add-network-verifier-pod-mode branch August 7, 2025 15:17
bergmannf pushed a commit to bergmannf/osdctl that referenced this pull request Aug 7, 2025
…penshift#784)

* Bump osd-network-verifier and dependencies

* Add pod mode support to osdctl network verify-egress

Implement --pod-mode flag to run egress verification using Kubernetes Jobs
instead of cloud instances, providing more accurate results by testing from
within the actual cluster environment.

Key features:
- New --pod-mode flag enables Kubernetes-based verification
- Automatic region detection from OCM for AWS clusters
- Manual region override with --region flag
- Configurable namespace with --namespace flag (default: openshift-network-diagnostics)
- Custom kubeconfig support with --kubeconfig flag
- Automatic probe switching to curl (required for pod mode)
- Comprehensive input validation with clear error messages
- Mutual exclusivity with cloud-specific flags

Benefits:
- No cloud credentials required
- Tests actual cluster network environment
- More accurate results than external instance testing
- Secure execution with restrictive pod security contexts

Usage examples:
  osdctl network verify-egress --cluster-id my-cluster --pod-mode
  osdctl network verify-egress --pod-mode --platform aws-classic --region us-east-1

Includes comprehensive unit test coverage with 21 new tests covering:
- Input validation logic
- Region detection (OCM vs manual)
- Probe validation and switching
- AWS config generation
- Error handling scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Use backplane as preference for getting k8s credentials

* Docs and fmt

* Consolidate and cleanup tests

* Pull in actual osd-network-verifier release, update region flag

---------

Co-authored-by: Claude <noreply@anthropic.com>
nephomaniac pushed a commit to nephomaniac/osdctl that referenced this pull request Aug 20, 2025
…penshift#784)

* Bump osd-network-verifier and dependencies

* Add pod mode support to osdctl network verify-egress

Implement --pod-mode flag to run egress verification using Kubernetes Jobs
instead of cloud instances, providing more accurate results by testing from
within the actual cluster environment.

Key features:
- New --pod-mode flag enables Kubernetes-based verification
- Automatic region detection from OCM for AWS clusters
- Manual region override with --region flag
- Configurable namespace with --namespace flag (default: openshift-network-diagnostics)
- Custom kubeconfig support with --kubeconfig flag
- Automatic probe switching to curl (required for pod mode)
- Comprehensive input validation with clear error messages
- Mutual exclusivity with cloud-specific flags

Benefits:
- No cloud credentials required
- Tests actual cluster network environment
- More accurate results than external instance testing
- Secure execution with restrictive pod security contexts

Usage examples:
  osdctl network verify-egress --cluster-id my-cluster --pod-mode
  osdctl network verify-egress --pod-mode --platform aws-classic --region us-east-1

Includes comprehensive unit test coverage with 21 new tests covering:
- Input validation logic
- Region detection (OCM vs manual)
- Probe validation and switching
- AWS config generation
- Error handling scenarios

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Use backplane as preference for getting k8s credentials

* Docs and fmt

* Consolidate and cleanup tests

* Pull in actual osd-network-verifier release, update region flag

---------

Co-authored-by: Claude <noreply@anthropic.com>
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants