-
Notifications
You must be signed in to change notification settings - Fork 88
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: dump authorizationPolicy #1222
base: main
Are you sure you want to change the base?
Conversation
Welcome @yp969803! It looks like this is your first PR to kmesh-net/kmesh 🎉 |
@hzxuzhonghu @LiZhenCheng9527 can you review the PR |
pkg/status/api.go
Outdated
Namespace string `json:"namespace"` | ||
Scope string `json:"scope"` | ||
Action string `json:"action"` | ||
Rules []string `json:"rules"` |
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.
rules are complex structure, we can use the original definition
pkg/status/status_server.go
Outdated
@@ -460,7 +459,7 @@ type WorkloadDump struct { | |||
Workloads []*Workload | |||
Services []*Service | |||
// TODO: add authorization |
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.
remove the todo now
"kmesh.net/kmesh/api/v2/workloadapi/security" | ||
) | ||
|
||
type PolicyCache interface { |
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.
we do have a policyStore in pkg/auth/policy_store.go, can we share with it
Adding label 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 kubernetes/test-infra repository. |
[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.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@hzxuzhonghu can you review i have done the 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.
Generally LG
Can you add ut tests for it
@hzxuzhonghu added unit test |
fakeWorkloadCache := cache.NewWorkloadCache() | ||
fakeServiceCache := cache.NewServiceCache() | ||
fakeWorkloadCache.AddOrUpdateWorkload(w1) | ||
fakeServiceCache.AddOrUpdateService(svc) | ||
fakeAuth := auth.NewRbac(fakeWorkloadCache) | ||
fakeAuth.UpdatePolicy(policy) |
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.
YOu still need to update the GoldenFile
What type of PR is this?
/kind enhancement
What this PR does / why we need it:
support authorizationPolicy dump
Which issue(s) this PR fixes:
Fixes #214
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
No