feat: Add NetworkPolicy support for chains#3776
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3776 +/- ##
==========================================
- Coverage 25.40% 25.36% -0.05%
==========================================
Files 449 450 +1
Lines 23477 23534 +57
==========================================
+ Hits 5964 5969 +5
- Misses 16822 16873 +51
- Partials 691 692 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@ngelman1 have you verified this once on openshift ? |
|
|
||
| // chainsControllerPodSelector matches the tekton-chains-controller Deployment's | ||
| // spec.selector.matchLabels shipped in the upstream release manifest. | ||
| var chainsControllerPodSelector = metav1.LabelSelector{ |
There was a problem hiding this comment.
Can you add e2e for chains network policies please (similar to triggers, etc)
There was a problem hiding this comment.
I added test simialr to triggers with a small difference:
- setup is using
TektonConfiginstead of chain + pipeline, because creating CRs dierclty caused pre-reconciliation failures. - update of the NP is done through config and not directly through chain cause when I tried the latter chain was immediatly reverted by the
tektonConfigreconciler
Also- I named the file 03_tektonchain_networkpolicy_test.go cause I saw this is how the triggers test is named. let me know if I need to change the number
There was a problem hiding this comment.
@jkhelil was triggers e2e test was tested on openshift? I tested on ROSA and kept getting tektonconfig.operator.tekton.dev "config" not found when I tried creating standalone CRs withou TektonConfig like in here https://github.com/tektoncd/operator/blob/main/test/e2e/common/03_tektontrigger_networkpolicy_test.go#L61
There was a problem hiding this comment.
@ngelman1 e2e are running on kind, you need to add the test, and do manual testing on openshift as complementary test
0222aa4 to
c741785
Compare
Changes
Implements NetworkPolicy resources to restrict network access for the Tekton Chains controller.
Adds a
spec.networkPolicyfield toTektonChainSpec(propagated fromTektonConfig) and a newpkg/reconciler/kubernetes/tektonchain/networkpolicies.gothat reconciles default-deny + allow policies in the operand namespace.
Default policies for the Chains controller pod:
Both platforms (Kubernetes and OpenShift) are supported via the existing
networkpolicy.PlatformParamshelper. Updates generated CRDs/Helm chart output anddocs/NetworkPolicy.md.Ref: SRVKP-12056
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make test lintbefore submitting a PRSee the contribution guide for more details.
Release Notes