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
{{ message }}
Repository navigation
Commit b01f022
Browse filesBrowse the repository at this point in the historyBrowse files
Document how users can self-provision TinycodeInstance CRs with
appropriate RBAC. No operator changes required — just a ClusterRole
and per-namespace RoleBindings.
Copy file name to clipboardExpand all lines: README.md
+169Lines changed: 169 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -204,6 +204,175 @@ Together, Tekton + Argo CD cover everything the operator + GitHub Actions do tod
204
204
205
205
Making the operator itself Kubernetes-portable (auto-detecting OpenShift vs vanilla Kubernetes and falling back to `Ingress` when SCCs are unavailable) is a potential enhancement for future releases.
206
206
207
+
## Multi-User Self-Service Provisioning
208
+
209
+
**Primary deployment model**: One `TinycodeInstance` CR per user, managed centrally by a cluster-admin in the "Creating a TinycodeInstance" section above.
210
+
211
+
**Alternative for self-service teams**: Users can provision their own `TinycodeInstance` CRs if your team prefers a self-service model. No code changes to the operator are required — it already watches all namespaces and scopes all resources (Deployments, Services, Routes, PVCs, ServiceAccounts, SCC bindings) by CR name + namespace. Two users in different namespaces get completely isolated resources with no collisions.
212
+
213
+
### Setup (Cluster-Admin, One-Time)
214
+
215
+
1. **Create a ClusterRole** granting users permission to manage their own TinycodeInstance CRs:
216
+
217
+
```yaml
218
+
---
219
+
apiVersion: rbac.authorization.k8s.io/v1
220
+
kind: ClusterRole
221
+
metadata:
222
+
name: tinycode-user-role
223
+
rules:
224
+
- apiGroups:
225
+
- tinycode.dev
226
+
resources:
227
+
- tinycodeinstances
228
+
verbs:
229
+
- create
230
+
- get
231
+
- list
232
+
- watch
233
+
- delete
234
+
```
235
+
236
+
Save this as `tinycode-user-role.yaml` and apply once:
237
+
238
+
```bash
239
+
oc apply -f tinycode-user-role.yaml
240
+
```
241
+
242
+
### Per-User Setup (Cluster-Admin or Delegated)
243
+
244
+
For each user who will self-provision, create a namespace and bind the ClusterRole:
245
+
246
+
```yaml
247
+
---
248
+
apiVersion: v1
249
+
kind: Namespace
250
+
metadata:
251
+
name: tinycode-alice
252
+
253
+
---
254
+
apiVersion: rbac.authorization.k8s.io/v1
255
+
kind: RoleBinding
256
+
metadata:
257
+
name: alice-tinycode-user
258
+
namespace: tinycode-alice
259
+
roleRef:
260
+
apiGroup: rbac.authorization.k8s.io
261
+
kind: ClusterRole
262
+
name: tinycode-user-role
263
+
subjects:
264
+
- kind: User
265
+
name: alice@example.com
266
+
apiGroup: rbac.authorization.k8s.io
267
+
```
268
+
269
+
Save as `alice-tinycode-rolebinding.yaml` and apply:
270
+
271
+
```bash
272
+
oc apply -f alice-tinycode-rolebinding.yaml
273
+
```
274
+
275
+
The user also needs to create Secrets (password) in their namespace. Grant that permission by adding a namespace Role:
276
+
277
+
```yaml
278
+
---
279
+
apiVersion: rbac.authorization.k8s.io/v1
280
+
kind: Role
281
+
metadata:
282
+
name: tinycode-secret-creator
283
+
namespace: tinycode-alice
284
+
rules:
285
+
- apiGroups:
286
+
- ""
287
+
resources:
288
+
- secrets
289
+
verbs:
290
+
- create
291
+
- get
292
+
293
+
---
294
+
apiVersion: rbac.authorization.k8s.io/v1
295
+
kind: RoleBinding
296
+
metadata:
297
+
name: alice-secret-creator
298
+
namespace: tinycode-alice
299
+
roleRef:
300
+
apiGroup: rbac.authorization.k8s.io
301
+
kind: Role
302
+
name: tinycode-secret-creator
303
+
subjects:
304
+
- kind: User
305
+
name: alice@example.com
306
+
apiGroup: rbac.authorization.k8s.io
307
+
```
308
+
309
+
### User Workflow (Self-Service)
310
+
311
+
Once the cluster-admin has set up the namespace and RoleBinding, the user can:
oc get tinycodeinstance alice-dev -n tinycode-alice -w
347
+
348
+
# 4. Get the URL
349
+
oc get tinycodeinstance alice-dev -n tinycode-alice -o jsonpath='{.status.url}'
350
+
```
351
+
352
+
### Resource Consumption
353
+
354
+
Each user gets their own pod, PVCs (data and projects), and OpenShift Route. This is **instance-per-user isolation**, not shared multi-tenancy. Resource consumption scales linearly with users:
355
+
356
+
- **Default limits**: 2 CPU, 2Gi memory per instance
357
+
- **Default requests**: 200m CPU, 512Mi memory per instance
358
+
- **Storage**: 1Gi (config/DB) + 10Gi (projects) per instance
359
+
360
+
For 10 users with default settings, the cluster needs capacity for at least 2 CPU cores and 5Gi memory across all tinycode instances, plus infrastructure and other workloads.
0 commit comments