rbac-sync

command module
v0.0.0-...-9dca1a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 23 Imported by: 0

README

rbac-sync

License [github Go Report Card

What it does

rbac-sync's task is to synchronize the members of a Google IAM group into a Kubernetes rolebinding. What group to synchronize, and which role to map is specified as a Namespace annotation.

How it works

On the specified interval, it will:

  1. Fetch information about all the namespaces in the cluster
  2. Filter those namespaces who has enabled rbac-sync through the rbac-sync.nais.io/group-name annotation (see example below)
  3. For each of these namespaces, it will fetch the members in the group (configured with rbac-sync.nais.io/group-name) from Google Admin and generate a RoleBinding containing these users and map these to the configured role (rbac-sync.nais.io/roles or default value provided as flag)
  4. Remove orphan role bindings
  5. Create new role bindings
  6. Update existing role bindings
  7. zZz
Example Namespace configuration
apiVersion: v1
kind: Namespace
metadata:
  name: myteam
  annotations:
    "rbac-sync.nais.io/group-name": myteam@domain.no # email/name of the google group, that will be synced into rolebinding
    "rbac-sync.nais.io/roles": team-member # optional, name of role to be mapped into rolebinding
    "rbac-sync.nais.io/rolebinding-prefix": myteam-members # optional, name of the rolebinding that rbac-sync creates
  ...

Requirements

Flags

$ rbac-sync --help 
Usage of rbac-sync
  -bind-address string
        Bind address for application. (default ":8080")
  -debug
        enables debug logging
  -default-rolebinding-prefix string
        Default rolebinding-prefix if not specified in namespace annotation, rolebinding name format will be <prefix>-<role> (default "rbacsync-default")
  -default-roles string
        Default role(s) if not specified in namespace annotation. Comma-separated (default "rbacsync-default")
  -gcp-admin-user string
        The google admin user e-mail address.
  -kubeconfig string
        path to Kubernetes config file
  -mock-iam
        starts rbac-sync with a mocked version of the IAM client
  -serviceaccount-keyfile string
        The path to the service account private key file.
  -update-interval duration
        Update interval in seconds. (default 5m0s)

Development

make local # requires a running k8s as current kubeconfig context

This will spin up a rbac-sync in debug mode with a mock IAM client

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL