-
Notifications
You must be signed in to change notification settings - Fork 555
✨ Include network policy for all configmap and grpc catalogsources #3568
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
base: master
Are you sure you want to change the base?
✨ Include network policy for all configmap and grpc catalogsources #3568
Conversation
7e73286
to
b8dbde0
Compare
b8dbde0
to
437b8cb
Compare
Signed-off-by: Joe Lanford <[email protected]>
437b8cb
to
b9ecf89
Compare
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.
Looking good. A few comments.
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.
/approve
return np | ||
} | ||
|
||
func sanitizedDeepEqual(a client.Object, b client.Object) bool { |
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.
is it possible that some future additional field breaks this function?
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.
Yes, that is possible. I looked at using equality.Semantic.DeepDerivative()
instead, but I didn't want to allow someone to add an extra network policy rule or change the selector in a way that would say "all good" from a deep derivative perspective.
We could potentially write a diff detector in a different way that would be less susceptible to future API changes, but also still secure in terms of reverting undesirable changes.
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.
I changed this to be specific to network policy and exactly what we care about:
- Our labels are there (but others can be added)
- The specs are identical
test/e2e/catalog_e2e_test.go
Outdated
@@ -750,6 +753,119 @@ var _ = Describe("Starting CatalogSource e2e tests", Label("CatalogSource"), fun | |||
Expect(registryPods.Items).To(HaveLen(1), "unexpected number of replacement registry pods found") | |||
}) | |||
|
|||
It("delete registry network policy triggers recreation", func() { |
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.
do we need an e2e? could a unit test cover this case?
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.
Maybe? I didn't look too closely. The main bit of coverage I wanted here was "is there an NP event that the catalog-operator notices and causes there to be a sync of the relevant CatSrc"
It seemed like there were other e2e's for similar catsrc reconcile behaviors, so I followed the pattern.
@joelanford is this ready for review? it looks pretty good to me =D |
Yes-ish. I think the catalog pod network policy is reviewable. But I realized I also need to add dynamic network policy handling for bundle unpack pods. I could do that here, or I could do it in a separate PR. I don't really care which. I also have this listed as a draft because the RFC is still in review: https://docs.google.com/document/d/1TCb2YsSHaXBUnUUFp44Bt2hdsb2jwLnL77imP25QGVs/edit?tab=t.0#heading=h.x3tfh25grvnv |
c8fd1f1
to
f2a4870
Compare
Signed-off-by: Joe Lanford <[email protected]>
f2a4870
to
026ceff
Compare
Ready for review again! RFC is here: https://docs.google.com/document/d/1TCb2YsSHaXBUnUUFp44Bt2hdsb2jwLnL77imP25QGVs/edit?tab=t.0#heading=h.x3tfh25grvnv |
Description of the change:
This change updates OLMv0 to generate and reconcile two
NetworkPolicy
objects for eachCatalogSource
where OLMv0 also manages a catalog pod (i.e. configmap and grpc-based catalog sources).Related implementation details:
Unit tests are updated to ensure that NetworkPolicy objects are handled correctly.
Motivation for the change:
By adding NetworkPolicy, we can provide more security to mitigate vulnerabilities and avoid accidental data leaks.
Architectural changes:
None (unless you count managing NetworkPolicy for CatalogSources as an architectural change)
Testing remarks:
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue