-
Notifications
You must be signed in to change notification settings - Fork 68
feat: Update network policy resource #2533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds initializer and serialization logic to the NetworkPolicy resource. Introduces parameterized init, typed api_group attribute, and a to_dict method that validates required pod_selector and conditionally populates spec fields (podSelector, egress, ingress, policyTypes). Updates imports to include MissingRequiredArgumentError and Any. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
ocp_resources/network_policy.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
ocp_resources/network_policy.py (2)
ocp_resources/resource.py (2)
NamespacedResource(1534-1644)ApiGroup(466-576)ocp_resources/exceptions.py (1)
MissingRequiredArgumentError(5-10)
🔇 Additional comments (5)
ocp_resources/network_policy.py (5)
1-2: LGTM!The file includes the standard generated code comment and appropriate spacing.
4-6: LGTM!The imports are correctly added with the necessary types for the implementation.
14-14: LGTM!The API group is correctly set to
NETWORKING_K8S_IOwith proper type annotation.
16-47: LGTM!The
__init__method is well-structured with appropriate parameter types and comprehensive docstring. The parameter names match the Kubernetes NetworkPolicy spec fields, and the initialization logic correctly stores all provided values.
55-68: LGTM!The spec field population logic correctly maps the instance attributes to the NetworkPolicy specification format. The conditional inclusion of optional fields (
egress,ingress,policyTypes) follows the proper pattern of only including fields when they are provided.
|
/approve |
|
/lgtm |
|
/verified Updating RedHatQE/openshift-virtualization-tests#1984 to use this PR, the tests passed: |
Short description:
Update networkPolicy resource following https://github.com/RedHatQE/openshift-python-wrapper/blob/main/class_generator/README.md
More details:
N/A
What this PR does / why we need it:
We need it for RedHatQE/openshift-virtualization-tests#1984
Which issue(s) this PR fixes:
N/A
Special notes for reviewer:
N/A
Bug:
N/A
Summary by CodeRabbit
New Features
Bug Fixes
Improvements