diff --git a/README.md b/README.md index 9dbe64e..d9405fe 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # gitlab2rbac -**Version 1.1.0 is the last stable version. `gitlab2rbac` is used in production with kubernetes version 1.27.** +`gitlab2rbac` synchronizes Kubernetes cluster user permissions with those defined in GitLab, ensuring consistent access controls across both platforms. -`gitlab2rbac` ensures that your Kubernetes cluster users have the same permissions than on GitLab. - -It takes [GitLab Permissions](https://docs.gitlab.com/ee/user/permissions.html) by project as input and generates [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) objects inside Kubernetes. +This tool takes [GitLab Permissions](https://docs.gitlab.com/ee/user/permissions.html) on a project level and generates corresponding [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) objects within Kubernetes. ![graph](graph.png) @@ -11,8 +9,8 @@ It takes [GitLab Permissions](https://docs.gitlab.com/ee/user/permissions.html) ### Requirements Before anything else, `gitlab2rbac` requires: -* [RBAC enabled on your Kubernetes cluster](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) -* [GitLab API with v4 support](https://docs.gitlab.com/ee/api/rest/) +* [RBAC is enabled on your Kubernetes cluster](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) +* [GitLab API v4 support is available](https://docs.gitlab.com/ee/api/rest/) ### Deploy with helm @@ -23,13 +21,13 @@ helm install gitlab2rbac /path/to/chart/gitla2rbac --create-namespace gitlab2rba or ### Configuration -`gitlab2rbac` needs a namespace, cluster roles and cluster role bindings. Create them with: +`gitlab2rbac` requires a namespace, cluster roles and cluster role bindings. You can create these by executing: ```sh $ kubectl apply -f https://raw.githubusercontent.com/numberly/gitlab2rbac/master/deploy/configuration.yaml ``` -You will then need to create a [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) that contains all the useful information for `gitlab2rbac`: +Next, create a [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) containing the necessary configuration: ```sh cat < +## Matrix GitLab role & Kubernetes resources +**[here](./docs/matrix.md)** ## Advanced configuration `gitlab2rbac` supports multiple environment variables for advanced configuration: @@ -234,5 +101,17 @@ Any admin on GitLab is an admin of the Kubernetes cluster. |`KUBERNETES_LOAD_INCLUSTER_CONFIG` |Load configuration inside Kubernetes when gitlab2rbac runs as a pod. |False | |`KUBERNETES_TIMEOUT` |Timeout for Kubernetes operations, in seconds. |10 | +## Kubernetes cluster compatibility + +The following table outlines the compatibility between gitlab2rbac versions and Kubernetes cluster versions. Ensure that you are using the correct version of gitlab2rbac for your Kubernetes cluster to maintain stability and functionality. + +:construction: not tested + +:green_circle: ok + +| GitLab2rbac Version | k8s 1.25 | k8s 1.26 | k8s 1.27 | k8s 1.28 | k8s 1.29 | k8s 1.30 | k8s 1.31 | +|-------------------|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:| +| **0.2.4** | :green_circle: | :green_circle: | :green_circle: | :green_circle: | :construction: | :construction: | :construction: | + ## License MIT diff --git a/docs/matrix.md b/docs/matrix.md new file mode 100644 index 0000000..cff659c --- /dev/null +++ b/docs/matrix.md @@ -0,0 +1,70 @@ +### Role Descriptions +| Role | Use Cases | Typical Examples | +|:----------:|:-------------------------:|:-----------------------------------:| +| Guest | Inspiration | Team members from other departments | +| Reporter | Complete overview, testing| Project managers, marketing staff | +| Developer | Deployment, debugging | Engineers, technical project managers | +| Maintainer | Sensitive configurations | Lead or senior engineers | + +### RBAC Permissions Matrix +In Kubernetes, `R` and `W` correspond to API verbs: +* **Read (`R`)**: `get`, `list`, `watch` +* **Write (`W`)**: `create`, `update`, `patch`, `delete`, `deletecollection` + +#### Cluster-Wide Resources +All authenticated users have access to the following cluster-wide resources: +* apiservices +* componentstatuses (deprecated in v1.19+) +* namespaces +* nodes + +GitLab admins are automatically granted admin privileges in the Kubernetes cluster. + +#### Workload Resources +| Resource | Guest | Reporter | Developer | Maintainer | +|:------------------------:|:-----:|:--------:|:---------:|:----------:| +| cronjobs | R | R | R+W | R+W | +| daemonsets | R | R | R+W | R+W | +| deployments | R | R | R+W | R+W | +| horizontalpodautoscalers | R | R | R+W | R+W | +| ingresses | R | R | R+W | R+W | +| jobs | R | R | R+W | R+W | +| pods | R | R | R+W | R+W | +| replicasets | R | R | R+W | R+W | +| replicationcontrollers | R | R | R+W | R+W | +| services | R | R | R+W | R+W | +| statefulsets | R | R | R+W | R+W | +| verticalpodautoscalers | R | R | R+W | R+W | +| events | | R | R | R+W | + +#### Action-Based Resources +| Resource | Guest | Reporter | Developer | Maintainer | +|:----------------------------:|:-----:|:--------:|:---------:|:----------:| +| pods/log | | R+W | R+W | R+W | +| pods/portforward | | R+W | R+W | R+W | +| deployments/rollback | | | R+W | R+W | +| deployments/scale | | | R+W | R+W | +| pods/attach | | | R+W | R+W | +| pods/exec | | | R+W | R+W | +| replicasets/scale | | | R+W | R+W | +| replicationcontrollers/scale | | | R+W | R+W | +| statefulsets/scale | | | R+W | R+W | + +#### Setup Resources +| Resource | Guest | Reporter | Developer | Maintainer | +|:-----------------------------:|:-----:|:--------:|:---------:|:----------:| +| configmaps | R | R | R+W | R+W | +| endpoints | R | R | R+W | R+W | +| networkpolicies | R | R | R+W | R+W | +| persistentvolumeclaims | R | R | R+W | R+W | +| persistentvolumeclaims/status | R | R | R+W | R+W | +| poddisruptionbudgets | R | R | R+W | R+W | +| poddisruptionbudgets/status | R | R | R+W | R+W | +| serviceaccounts | R | R | R+W | R+W | +| certificates | | | R+W | R+W | +| secrets | | | R+W | R+W | +| limitranges | | | R | R+W | +| resourcequotas | | | R | R+W | +| rolebindings | | | R | R+W | +| roles | | | R | R+W | +