Skip to content

Commit

Permalink
Merge pull request #38 from reactiveops/rs/cleanup
Browse files Browse the repository at this point in the history
Small bits of documentation and code cleanup
  • Loading branch information
robscott authored Nov 30, 2018
2 parents 0b09a55 + f397fcb commit 5868f2e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
22 changes: 22 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,28 @@ kubectl apply -f deploy/
Once RBAC Manager is installed in your cluster, you'll be able to deploy RBAC Definitions to your cluster. There are examples of these custom resources above as well as in the examples directory of this repository.
## Dynamic Namespaces and Labels
RBAC Definitions can now include `namespaceSelectors` in place of `namespace` attributes when specifying Role Binding configuration. This can be incredibly helpful when working with dynamically provisioned namespaces.
```yaml
apiVersion: rbacmanager.reactiveops.io/v1beta1
kind: RBACDefinition
metadata:
name: dev-access
rbacBindings:
- name: dev-team
subjects:
- kind: Group
name: dev-team
roleBindings:
- clusterRole: edit
namespaceSelector:
matchLabels:
team: dev
```

In the example above, Role Bindings would automatically get created for each Namespace with a `team=dev` label.

## Further Reading

### RBAC Definitions
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/namespace/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func (r *ReconcileNamespace) Reconcile(request reconcile.Request) (reconcile.Res

func reconcileNamespace(config *rest.Config, namespace *v1.Namespace) error {
var err error
var rbacDefList rbacmanagerv1beta1.RBACDefinitionList
rdr := rbacdefinition.Reconciler{}

// Full Kubernetes ClientSet is required because RBAC types don't
Expand All @@ -110,7 +111,7 @@ func reconcileNamespace(config *rest.Config, namespace *v1.Namespace) error {
return err
}

rbacDefList, err := getRbacDefinitions(config)
rbacDefList, err = getRbacDefinitions(config)

for _, rbacDef := range rbacDefList.Items {
err = rdr.ReconcileNamespaceChange(&rbacDef, namespace)
Expand Down
1 change: 1 addition & 0 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
package version

var (
// Version represents the current version of RBAC Manager
Version = "0.5.0"
)

0 comments on commit 5868f2e

Please sign in to comment.