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: modules/administration-guide/pages/configuring-a-user-namespace.adoc
+92-12Lines changed: 92 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,7 @@
8
8
= Configuring a user namespace
9
9
10
10
This procedure walks you through the process of using {prod-short}
11
-
to replicate `ConfigMaps`, `Secrets` and `PersistentVolumeClaim` from `{prod-namespace}` namespace to numerous
12
-
user-specific namespaces. The {prod-short} automates the synchronization of important configuration
13
-
data such as shared credentials, configuration files, and certificates to user namespaces.
11
+
to replicate `ConfigMaps`, `Secrets`, `PersistentVolumeClaim` and other {kubernetes} objects from `{prod-namespace}` namespace to numerous user-specific namespaces. The {prod-short} automates the synchronization of important configuration data such as shared credentials, configuration files, and certificates to user namespaces.
14
12
15
13
If you make changes to a {kubernetes} resource in an {prod-namespace} namespace,
16
14
{prod-short} will immediately replicate the changes across all users namespaces.
@@ -29,7 +27,7 @@ for other possible labels and annotations.
29
27
kind: ConfigMap
30
28
apiVersion: v1
31
29
metadata:
32
-
name: user-configmap
30
+
name: {prod-id-short}-user-configmap
33
31
namespace: {prod-namespace}
34
32
labels:
35
33
app.kubernetes.io/part-of: che.eclipse.org
@@ -45,7 +43,7 @@ data:
45
43
kind: ConfigMap
46
44
apiVersion: v1
47
45
metadata:
48
-
name: user-settings-xml
46
+
name: {prod-id-short}-user-configmap
49
47
namespace: {prod-namespace}
50
48
labels:
51
49
app.kubernetes.io/part-of: che.eclipse.org
@@ -73,7 +71,7 @@ for other possible labels and annotations.
73
71
kind: Secret
74
72
apiVersion: v1
75
73
metadata:
76
-
name: user-secret
74
+
name: {prod-id-short}-user-secret
77
75
namespace: {prod-namespace}
78
76
labels:
79
77
app.kubernetes.io/part-of: che.eclipse.org
@@ -89,7 +87,7 @@ data:
89
87
kind: Secret
90
88
apiVersion: v1
91
89
metadata:
92
-
name: user-certificates
90
+
name: {prod-id-short}-user-secret
93
91
namespace: {prod-namespace}
94
92
labels:
95
93
app.kubernetes.io/part-of: che.eclipse.org
@@ -113,7 +111,7 @@ See the link:https://devfile.io/docs/{devfile-api-version}/adding-event-bindings
113
111
kind: Secret
114
112
apiVersion: v1
115
113
metadata:
116
-
name: user-env
114
+
name: {prod-id-short}-user-secret
117
115
namespace: {prod-namespace}
118
116
labels:
119
117
app.kubernetes.io/part-of: che.eclipse.org
@@ -132,14 +130,14 @@ To enhance the configurability, you can customize the `PersistentVolumeClaim` by
132
130
See the link:https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#automatically-mounting-volumes-configmaps-and-secrets[Automatically mounting volumes, configmaps, and secrets]
133
131
for other possible labels and annotations.
134
132
+
135
-
To modify the 'PersistentVolumeClaim', delete it and create a new one in {prod-namespace} namespace.
133
+
To modify the `PersistentVolumeClaim`, delete it and create a new one in {prod-namespace} namespace.
136
134
+
137
135
[source,yaml,subs="+attributes,+quotes"]
138
136
----
139
137
apiVersion: v1
140
138
kind: PersistentVolumeClaim
141
139
metadata:
142
-
name: user-pvc
140
+
name: {prod-id-short}-user-pvc
143
141
namespace: {prod-namespace}
144
142
labels:
145
143
app.kubernetes.io/part-of: che.eclipse.org
@@ -155,7 +153,7 @@ spec:
155
153
apiVersion: v1
156
154
kind: PersistentVolumeClaim
157
155
metadata:
158
-
name: user-pvc
156
+
name: {prod-id-short}-user-pvc
159
157
namespace: {prod-namespace}
160
158
labels:
161
159
app.kubernetes.io/part-of: che.eclipse.org
@@ -174,9 +172,91 @@ spec:
174
172
----
175
173
====
176
174
175
+
. To leverage the OpenShift Kubernetes Engine, you can create a `Template` object to replicate all resources defined within the template across each user {namespace}.
176
+
+
177
+
Aside from the previously mentioned `ConfigMap`, `Secret`, and `PersistentVolumeClaim`, `Template` objects can include:
178
+
+
179
+
* `LimitRange`
180
+
* `NetworkPolicy`
181
+
* `ResourceQuota`
182
+
* `Role`
183
+
* `RoleBinding`
184
+
+
185
+
[source,yaml,subs="+attributes,+quotes"]
186
+
----
187
+
apiVersion: template.openshift.io/v1
188
+
kind: Template
189
+
metadata:
190
+
name: {prod-id-short}-user-namespace-configurator
191
+
namespace: {prod-namespace}
192
+
labels:
193
+
app.kubernetes.io/part-of: che.eclipse.org
194
+
app.kubernetes.io/component: workspaces-config
195
+
objects:
196
+
...
197
+
parameters:
198
+
- name: PROJECT_NAME
199
+
- name: PROJECT_ADMIN_USER
200
+
201
+
----
202
+
+
203
+
The `parameters` are optional and define which parameters can be used. Currently, only `PROJECT_NAME` and `PROJECT_ADMIN_USER` are supported. `PROJECT_NAME` is the name of the {prod-short} {namespace}, while `PROJECT_ADMIN_USER` is the {prod-short} user of the {namespace}.
204
+
+
205
+
The {namespace} name in objects will be replaced with the user's {namespace} name during synchronization.
206
+
+
207
+
.Replicating {kubernetes} resources to a user namespace:
208
+
====
209
+
[source,yaml,subs="+attributes,+quotes"]
210
+
----
211
+
apiVersion: template.openshift.io/v1
212
+
kind: Template
213
+
metadata:
214
+
name: {prod-id-short}-user-namespace-configurator
215
+
namespace: {prod-namespace}
216
+
labels:
217
+
app.kubernetes.io/part-of: che.eclipse.org
218
+
app.kubernetes.io/component: workspaces-config
219
+
objects:
220
+
- apiVersion: v1
221
+
kind: ResourceQuota
222
+
metadata:
223
+
name: {prod-id-short}-user-resource-quota
224
+
spec:
225
+
...
226
+
- apiVersion: v1
227
+
kind: LimitRange
228
+
metadata:
229
+
name: {prod-id-short}-user-resource-constraint
230
+
spec:
231
+
...
232
+
- apiVersion: rbac.authorization.k8s.io/v1
233
+
kind: Role
234
+
metadata:
235
+
name: {prod-id-short}-user-roles
236
+
rules:
237
+
...
238
+
- apiVersion: rbac.authorization.k8s.io/v1
239
+
kind: RoleBinding
240
+
metadata:
241
+
name: {prod-id-short}-user-rolebinding
242
+
roleRef:
243
+
apiGroup: rbac.authorization.k8s.io
244
+
kind: Role
245
+
name: {prod-id-short}-user-roles
246
+
subjects:
247
+
- kind: User
248
+
apiGroup: rbac.authorization.k8s.io
249
+
name: $\{PROJECT_ADMIN_USER}
250
+
parameters:
251
+
- name: PROJECT_ADMIN_USER
252
+
----
253
+
NOTE: Creating Template Kubernetes resources is supported only on OpenShift.
* link:https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#automatically-mounting-volumes-configmaps-and-secrets[Automatically mounting volumes, configmaps, and secrets]
182
-
261
+
* link:https://docs.openshift.com/container-platform/latest/rest_api/template_apis/template-template-openshift-io-v1.html[OpenShift API reference for `Template`]
0 commit comments