CMP-4496: Add NetworkPolicy RBAC for operands to operator Role and CSV - #1313
Conversation
|
@taimurhafeez: This pull request references CMP-4496 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 "5.0.0" version, but no target version was set. DetailsIn response to this:
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. |
|
/retest-required |
|
/retest-required |
a852f8f to
529958f
Compare
|
🤖 To deploy this PR, run the following command: |
|
/retest |
1 similar comment
|
/retest |
|
/retest |
1 similar comment
|
/retest |
|
/lgtm |
529958f to
82f7364
Compare
The operator now creates and reconciles label-scoped NetworkPolicies for its operand pods (result server, scanners, aggregator, profileparser, rerunner) so operand traffic is governed at runtime rather than left unrestricted. - Add the compliance.openshift.io/netpol-managed marker to every operand pod template (pod template only for the result-server and profileparser Deployments, to avoid mutating their immutable selectors). - Create three named policies in the operator namespace via get-or-create/update (no list/watch, matching the RBAC granted for CMP-4496): default-deny (ingress+egress), allow-all-egress, and result-server ingress on 8443 from pod-network scanners and host-networked node scanners. - Reconcile the policies at the start of the scan launching phase, before any operand pods are created. - Read NetworkPolicy directly from the API server (manager client cache DisableFor) so a by-name Get does not start an informer list+watch, which the operand RBAC does not grant. Depends on ComplianceAsCode#1313 (CMP-4496) for the NetworkPolicy RBAC.
|
/retest-required |
82f7364 to
5924a5c
Compare
|
🤖 To deploy this PR, run the following command: |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: taimurhafeez, yuumasato The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What
networking.k8s.io/networkpoliciesRBAC rule (verbs:create,delete,get,update) to the operator Role (config/rbac/operator_role.yaml)config/manifests/bases/compliance-operator.clusterserviceversion.yaml) under thecompliance-operatorservice accountcompliancescan_controller.goto keep the three RBAC sources of truth in syncmake bundleWhy
The Conforma policy
olm.required_network_policy_rbac_for_operandsrequires the CSV to declare RBAC permissions fornetworking.k8s.io/networkpolicieswith verbscreate,delete, andupdate(orpatch).Test plan
Prerequisites
compliance-operator,compliance-operator-bundle, andcompliance-operator-catalog1. Build and push images
2. Deploy via OLM
3.Verify OLM installation is complete
4. Verify NetworkPolicy RBAC in the OLM-created Role
Check the OLM-created Role contains the networkpolicies rule
oc get roles -n openshift-compliance -o yaml | grep -B 2 -A 6 networkpoliciesExpected output:
5. Verify the CSV permissions section
Expected output should show
networkpolicieswith verbscreate,delete,get,updateunder thepermissions(namespace-scoped) section.6. Verify SA has the permissions