You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+149-21
Original file line number
Diff line number
Diff line change
@@ -7,21 +7,68 @@
7
7
8
8
## Introduction
9
9
10
-
The Plex Sandbox Operator is an operator for [Kubernetes](https://kubernetes.io/) that enables authenticated users to a cluster to create their own isolated environments leveraging namespaces.
10
+
The Plex Sandbox Operator is an operator for [Kubernetes](https://kubernetes.io/) that enables authenticated users to a cluster to create their own isolated environments.
11
11
12
12
## Installation
13
13
14
-
The [deploy](deploy) folder contains the necessary Kubernetes manifests to install the operator.
14
+
### Kustomize
15
+
16
+
This repository contains a [deploy](deploy) folder which contains all of the manifests required to deploy the operator, as well as a `kustomization.yaml` file.
17
+
18
+
If you would like to apply your own customizations, reference the `deploy` folder and the version in your `kustomization.yaml`.
The sandbox operator can leverage different clients, depending upon how authenitcation is configured for your cluster.
19
66
20
67
### Azure
21
68
22
-
If Azure credentials are provided to the deployment, the operator will perform a lookup of the user in the owners field to fetch that users ObjectID inside of Azure.
69
+
If Azure credentials are provided to the operators environment, it will perform a lookup of each user in the owners field and fetch that users `ObjectID` inside of Azure using [Microsoft Graph](https://docs.microsoft.com/en-us/graph/api/resources/azure-ad-overview?view=graph-rest-1.0).
23
70
24
-
This enables users of the operator to provide a user friendly name, such as their email address, and have the operator itself handle the creation of the bindings within Kubernetes.
71
+
This enables users to create Sandboxes with friendly names, such as their email address, and have the operator itself handle the mapping when creating the Kubernetes resources.
25
72
26
73
To use the Azure client, include the following environment variables:
27
74
@@ -31,53 +78,134 @@ To use the Azure client, include the following environment variables:
31
78
32
79
### Default
33
80
34
-
If no credentials are provided, the operator will create the bindings using the values listed in the owners field.
81
+
If no credentials are provided, the operator will create the `Role` and `ClusterRole` bindings using the values listed in the owners field.
82
+
83
+
## Creating a Sandbox
35
84
36
-
## Usage
85
+
To create a Sandbox, create and apply a Sandbox CRD to the target cluster.
37
86
38
-
To use the operator, create and apply a Sandbox CRD to the target cluster.
87
+
The following will create a Sandbox called `foo` (the resulting namespace being `sandbox-foo`), and assign the RBAC policies to user `[email protected]`.
39
88
40
-
The following manifest will create a sandbox called `test` (the resulting namespace being `sandbox-test`), and assign the RBAC roles to user `foo@bar.com`
This will cause the operator to add `ClusterRoleBinding` and `RoleBinding` resources to match the owners list.
167
+
168
+
## Deleting a Sandbox
53
169
54
-
For each sandbox that is created the following resources will be created:
170
+
To delete a Sandbox, delete the Sandbox resource from the cluster:
55
171
56
-
- `Namespace`: Name of the sandbox, prefixed with `sandbox-`.
172
+
```console
173
+
$ kubectl delete sandbox foo
174
+
sandboxes.operators.plex.dev "foo" deleted
175
+
```
57
176
58
-
- `ClusterRole`: Only the permission to delete and view the created sandbox.
177
+
Deleting a Sandbox will delete the `Namespace` as well as the `ClusterRole` and `ClusterRoleBinding` resources
59
178
60
-
- `ClusterRoleBinding`: Given to each user listed in the `owners` field of the Sandbox CRD.
179
+
## Metrics
61
180
62
-
- `Role`: Permissions to manage the contents of the sandbox, but no permission to view secrets.
181
+
The operator exposes two metric ports for the `/metrics` end point:
63
182
64
-
- `RoleBinding`: Given to each user listed in the `owners` field of the Sandbox CRD.
183
+
- Port `8383` exposes metrics for the operator itself
184
+
- Port `8686` exposes metrics for the `Sandbox` CRD
65
185
66
-
- `ResourceQuota`: Defined quotas for the Sandbox.
186
+
Additionally, if [prometheus-operator](https://github.com/coreos/prometheus-operator) is installed into the cluster, a `ServiceMonitor` is created for the operator
67
187
68
188
## Development
69
189
70
-
### Testing
190
+
No external tooling is required to develop and build the operator. However, some tooling is required to run the integration tests and validate the manifests:
The provided `Makefile` contains commands that assist with running the tests for the operator.
71
199
72
200
### Unit tests
73
201
74
-
Run the `make test-unit` command. This will use an in-memory kubernetes client to validate and test your changes.
202
+
`make test-unit`will use an in-memory kubernetes client to validate and test your changes without the need for an external Kubernetes cluster.
75
203
76
204
### Integration tests
77
205
78
-
Run the `make test-integration` command. This will create a Kubernetes cluster for you, using [Kind](https://github.com/kubernetes-sigs/kind), and deploy the operator to it. Afterwards, the integration tests will be ran against the newly created cluster and operator.
206
+
`make test-integration`will create a Kubernetes cluster for you, using Kind, and deploy the operator to it. The integration tests will then be ran against the newly created cluster.
79
207
80
-
**NOTE:** To test the operator with different versions of Kubernetes, you can use the `KUBERNETES_VERSION` variable to when calling `make`. For example, to test on Kubernetes v1.16.3, run the following command:
208
+
**NOTE:** To test the operator with different versions of Kubernetes, you can use the `KUBERNETES_VERSION` variable when calling `make`. For example, to test on Kubernetes v1.16.3, run the following command:
0 commit comments