corneliusweig / rakkess

Review Access - kubectl plugin to show an access matrix for k8s server resources
Apache License 2.0
1.3k stars 56 forks source link

New subcommand `resource` #21

Closed corneliusweig closed 5 years ago

corneliusweig commented 5 years ago

This PR adds a new subcommand resource. It retrieves all (Cluster)Roles plus their bindings and evaluates the authorization for the given resource and verbs. The result is shown as a matrix with verbs in the horizontal and subjects in the vertical direction. For example:

rakkess resource deployments

show what subjects may globally hamper with deployments. It therefore only considers ClusterRoles. On the other hand,

rakkess r deploy -n default

shows who may deal with deployments in a particular namespace. It considers both ClusterRoles and Roles.

While the usual rakkess behavior slices the authorization space (subject, resource, verb) along a plane of constant subject (usually self), this new variant does a similar thing along a plane of fixed resource.

codecov-io commented 5 years ago

Codecov Report

Merging #21 into master will increase coverage by 1.6%. The diff coverage is 80.67%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #21     +/-   ##
=========================================
+ Coverage   71.72%   73.33%   +1.6%     
=========================================
  Files          11       15      +4     
  Lines         474      630    +156     
=========================================
+ Hits          340      462    +122     
- Misses        121      145     +24     
- Partials       13       23     +10
Impacted Files Coverage Δ
pkg/rakkess/validation/validation.go 66.66% <0%> (ø) :arrow_up:
cmd/signals.go 77.77% <0%> (ø) :arrow_up:
pkg/rakkess/client/result/resource.go 100% <100%> (ø)
pkg/rakkess/printer/printer.go 89.36% <100%> (-1.55%) :arrow_down:
cmd/resource.go 50% <50%> (ø)
cmd/root.go 25% <62.5%> (+5.76%) :arrow_up:
pkg/rakkess/client/resource_access.go 63.51% <63.51%> (ø)
pkg/rakkess/client/user_access.go 83.33% <90.9%> (ø)
pkg/rakkess/client/result/subject.go 94.11% <94.11%> (ø)
... and 3 more

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 9f088c5...e2330ee. Read the comment docs.