feat(operator): deploy network policies with LokiStack - #19099
Merged
Conversation
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
12 times, most recently
from
September 8, 2025 11:14
3949cf1 to
1226c1f
Compare
**What this PR does / why we need it:** This PR introduces the ability to enable network policies. By enabling network policies the operator will deploy a set of policies with the goal of restricting the allowed communications to&by LokiStack components to only the ones strictly necessary **Which issue(s) this PR fixes**: https://issues.redhat.com/browse/LOG-7198 **Special notes for your reviewer**: In this PR we have introduced the struck of `FeatureGate` which goal is to tell the code if a certain feature should be enabled or not. This was introduced as for the first time instead of adding NetworkPolicies to the feature gate we are instead adding them to the LokiStack API since they are something that should be enabled per LokiStack deployment.
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
from
September 9, 2025 10:31
1226c1f to
e9b1d33
Compare
JoaoBraveCoding
marked this pull request as ready for review
September 9, 2025 10:43
JoaoBraveCoding
requested review from
a team,
periklis and
xperimental
as code owners
September 9, 2025 10:43
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
from
September 19, 2025 10:55
0aa34d9 to
1ca09f7
Compare
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
from
September 19, 2025 17:04
7170a45 to
c1ef745
Compare
JoaoBraveCoding
commented
Sep 24, 2025
xperimental
reviewed
Oct 13, 2025
xperimental
left a comment
Collaborator
There was a problem hiding this comment.
Quick first pass. Worked fine in a cluster, but I have not looked at the actual policies yet. 🙂
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
from
October 14, 2025 09:12
625689a to
3f552bb
Compare
xperimental
reviewed
Oct 15, 2025
| Ports: []networkingv1.NetworkPolicyPort{ | ||
| { | ||
| Protocol: ptr.To(corev1.ProtocolTCP), | ||
| Port: &intstr.IntOrString{Type: intstr.Int, IntVal: 6443}, |
Collaborator
There was a problem hiding this comment.
Interesting. I would have guessed that we need the service port here and not the container port (kubernetes.default.svc has port 443 in my testcluster).
Is it maybe possible to specify "egress to the kubernetes.default.svc" instead of just listing the port here?
Collaborator
Author
There was a problem hiding this comment.
This one did it like so because of https://docs.google.com/document/d/1CDoGSRd-h8VT4PMrK_83Ro0YzYPjORbkxtfTJU1sN6Q/edit?tab=t.0#heading=h.r5za8itrk0hm
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
2 times, most recently
from
October 16, 2025 16:08
fd8c0da to
068fa2f
Compare
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
from
October 16, 2025 16:13
068fa2f to
f7bbf78
Compare
xperimental
reviewed
Oct 17, 2025
Co-authored-by: Robert Jacob <rojacob@redhat.com> Signed-off-by: Joao Marcal <jmarcal@redhat.com>
Co-authored-by: Robert Jacob <rojacob@redhat.com> Signed-off-by: Joao Marcal <jmarcal@redhat.com>
JoaoBraveCoding
force-pushed
the
LOG-7198
branch
from
October 17, 2025 15:10
d09b79b to
e2a331d
Compare
This was referenced Dec 2, 2025
This was referenced Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
This PR introduces the ability to enable network policies. By enabling network policies the operator will deploy a set of policies with the goal of restricting the allowed communications to&by LokiStack components to only the ones strictly necessary
Which issue(s) this PR fixes:
https://issues.redhat.com/browse/LOG-7198
Special notes for your reviewer:
In this PR we have introduced the struck of
FeatureValidatorwhich goal is to tell the code if a certain feature should be enabled or not. This was introduced as for the first time instead of adding NetworkPolicies to the feature gate we are instead adding them to the LokiStack API since they are something that should be enabled per LokiStack deployment.Checklist
CONTRIBUTING.mdguide (required)featPRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.mddeprecated-config.yamlanddeleted-config.yamlfiles respectively in thetools/deprecated-config-checkerdirectory. Example PR