-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: auth policy enforced condition #411
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #411 +/- ##
==========================================
- Coverage 66.18% 65.59% -0.60%
==========================================
Files 38 38
Lines 3901 3991 +90
==========================================
+ Hits 2582 2618 +36
- Misses 1131 1179 +48
- Partials 188 194 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
38a9336
to
f19dcf4
Compare
5b15865
to
336c81d
Compare
87c3578
to
233405a
Compare
Verification steps work as expected 🎉 After the last step, I've added: kubectl apply -f - <<EOF
apiVersion: kuadrant.io/v1beta2
kind: AuthPolicy
metadata:
name: gw-auth
namespace: istio-system
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: istio-ingressgateway
rules:
authorization:
allow-all:
opa:
rego: "allow = true"
EOF Then: kubectl get authpolicy -A -o wide
kubectl get authpolicy gw-auth -n istio-system -o yaml | yq '.status' conditions:
- lastTransitionTime: "2024-02-13T13:23:05Z"
message: AuthPolicy has been accepted
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: "2024-02-13T13:23:05Z"
message: AuthPolicy is overridden by [{"Namespace":"default","Name":"auth0"}]
reason: Overridden
status: "False"
type: Enforced
observedGeneration: 1 kubectl delete authpolicy auth0 kubectl get authpolicy -A -o wide
kubectl get authpolicy gw-auth -n istio-system -o yaml | yq '.status' conditions:
- lastTransitionTime: "2024-02-13T13:23:05Z"
message: AuthPolicy has been accepted
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: "2024-02-13T13:26:34Z"
message: AuthPolicy has been successfully enforced
reason: Enforced
status: "True"
type: Enforced
observedGeneration: 1 |
// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status`,description="RateLimitPolicy Accepted",priority=2 | ||
// +kubebuilder:printcolumn:name="Enforced",type=string,JSONPath=`.status.conditions[?(@.type=="Enforced")].status`,description="RateLimitPolicy Enforced",priority=2 |
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.
Though the title says "auth policy", it's good to have this here as well, for completeness 👍
@@ -22,6 +22,7 @@ import ( | |||
"os" | |||
"runtime" | |||
|
|||
"github.com/kuadrant/kuadrant-operator/pkg/common" |
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.
nitpick: I fail to see the logic behind how we group these dependencies. Maybe in another PR we can work on this and give them some order people can reason about. E.g. Kuadrant-controlled packages always grouped together, or layered based on proximity to the Golang std lib.
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.
Yeah, grouping is inconsistent in a few places. I think the main reason, at least for me, for this inconsistency is that these are frequently auto added by an IDE but ignores the groups that have been already been logically broken up previously. Goland IDE seems to always auto add a dependency to the first group list after the Golang std libs 🤔
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.
fyi, i had opened a PR to add the openshift goimports to keep module grouping consistent #415. Backed it out as we seem to already use goimports
in CI tests, but maybe we could look into it more.
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.
+1
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.
Created #426 to track this
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.
Nice job!
I've tested it again after last refactoring and still working perfectly fine.
Description
Part of #290 Kuadrant/architecture#38
Closes: #349
Add
Enforced
condition type to AuthPolicy.Verification
Functionality is generally already tested with the integration tests added.
To verify manually instead:
Setup
make local-setup
Accepted
-True
Enforced
-False
Accepted
-True
Enforced
-True