Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

yp969803
Copy link
Contributor

@yp969803 yp969803 commented Feb 5, 2025

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


@kmesh-bot kmesh-bot added the kind/enhancement New feature or request label Feb 5, 2025
@kmesh-bot
Copy link
Collaborator

Welcome @yp969803! It looks like this is your first PR to kmesh-net/kmesh 🎉

@yp969803
Copy link
Contributor Author

yp969803 commented Feb 5, 2025

@hzxuzhonghu @LiZhenCheng9527 can you review the PR

Namespace string `json:"namespace"`
Scope string `json:"scope"`
Action string `json:"action"`
Rules []string `json:"rules"`
Copy link
Member

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

@@ -460,7 +459,7 @@ type WorkloadDump struct {
Workloads []*Workload
Services []*Service
// TODO: add authorization
Copy link
Member

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 {
Copy link
Member

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

@kmesh-bot
Copy link
Collaborator

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

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.

@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hzxuzhonghu for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot added size/M and removed size/L labels Feb 6, 2025
@yp969803
Copy link
Contributor Author

yp969803 commented Feb 6, 2025

@hzxuzhonghu can you review i have done the changes !

Copy link
Member

@hzxuzhonghu hzxuzhonghu left a 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

@yp969803
Copy link
Contributor Author

yp969803 commented Feb 7, 2025

@hzxuzhonghu added unit test

fakeWorkloadCache := cache.NewWorkloadCache()
fakeServiceCache := cache.NewServiceCache()
fakeWorkloadCache.AddOrUpdateWorkload(w1)
fakeServiceCache.AddOrUpdateService(svc)
fakeAuth := auth.NewRbac(fakeWorkloadCache)
fakeAuth.UpdatePolicy(policy)
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support dump workload and authorizationPolicy
3 participants