Skip to content

Conversation

pasha-codefresh
Copy link
Member

farodin91 and others added 7 commits July 16, 2021 09:57
Part of: argoproj#4296

Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
…e-argo-cd

� Conflicts:
�	util/rbac/rbac.go
Signed-off-by: pashavictorovich <pavel@codefresh.io>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
@codecov
Copy link

codecov bot commented Nov 1, 2021

Codecov Report

Merging #7587 (0e58f59) into master (513d8a4) will increase coverage by 0.07%.
The diff coverage is 89.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7587      +/-   ##
==========================================
+ Coverage   41.39%   41.46%   +0.07%     
==========================================
  Files         161      161              
  Lines       21686    21723      +37     
==========================================
+ Hits         8976     9008      +32     
- Misses      11445    11449       +4     
- Partials     1265     1266       +1     
Impacted Files Coverage Δ
util/rbac/rbac.go 77.04% <88.70%> (+0.64%) ⬆️
server/rbacpolicy/rbacpolicy.go 82.35% <100.00%> (+3.56%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 513d8a4...0e58f59. Read the comment docs.

@yeya24
Copy link
Contributor

yeya24 commented Nov 1, 2021

IIUC, the AddFunction call needs to invalidate the cache as well?

@yeya24
Copy link
Contributor

yeya24 commented Nov 2, 2021

We also implemented the rbac cache based on #6739 and have been using it on prod for several weeks. The issue of the casbin cached enforcer is that it doesn't free memory and will hold cached items forever.

@pasha-codefresh
Copy link
Member Author

Thank you for comment @yeya24

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
var err error
if policy == "" {
enf = e.Enforcer
enf = e.wrapperEnforcer
} else {
enf, err = newEnforcerSafe(newBuiltInModel(), newAdapter(e.adapter.builtinPolicy, e.adapter.userDefinedPolicy, policy))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the project has roles with policies then the cache is not used. We should support this use case as well and use cached enforces with project with policies.

Signed-off-by: pashavictorovich <pavel@codefresh.io>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
@pasha-codefresh pasha-codefresh force-pushed the cache-argo-cd branch 2 times, most recently from c165c11 to c252e4e Compare November 3, 2021 10:31
Signed-off-by: pashavictorovich <pavel@codefresh.io>
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexmt
Copy link
Collaborator

alexmt commented Nov 3, 2021

Thanks a lot to @farodin91 for working on initial implementation in #6739!

@alexmt alexmt merged commit fe3cc72 into argoproj:master Nov 3, 2021
lukpep pushed a commit to lukpep/argo-cd that referenced this pull request Nov 3, 2021
feat: cache argo cd rbac (argoproj#7587)

Part of: argoproj#4296

Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
Signed-off-by: pashavictorovich <pavel@codefresh.io>
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Signed-off-by: lukasz.peplinski <lukpep@gmail.com>
@alexmt alexmt mentioned this pull request Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants