Skip to content

Commit c703dda

Browse files
chore: Update configuring-a-user-namespace.adoc (#2979)
* chore: Update configuring-a-user-namespace.adoc Signed-off-by: Anatolii Bazko <[email protected]> * Update modules/administration-guide/pages/configuring-a-user-namespace.adoc Co-authored-by: Jana Vrbkova <[email protected]> * Update modules/administration-guide/pages/configuring-a-user-namespace.adoc Co-authored-by: Jana Vrbkova <[email protected]> * Update modules/administration-guide/pages/configuring-a-user-namespace.adoc Co-authored-by: Jana Vrbkova <[email protected]> --------- Signed-off-by: Anatolii Bazko <[email protected]> Co-authored-by: Jana Vrbkova <[email protected]>
1 parent 7f970e8 commit c703dda

File tree

1 file changed

+46
-115
lines changed

1 file changed

+46
-115
lines changed

modules/administration-guide/pages/configuring-a-user-namespace.adoc

Lines changed: 46 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,21 @@
77
[id="configuring-a-user-namespace"]
88
= Configuring a user namespace
99

10-
This procedure walks you through the process of using {prod-short}
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.
10+
Learn how to use {prod-short}
11+
to synchronize `ConfigMaps`, `Secrets`, `PersistentVolumeClaim` and other {kubernetes} objects
12+
from `{prod-namespace}` namespace to numerous user-specific namespaces.
13+
The {prod-short} automates the synchronization of important configuration data, such as
14+
shared credentials, configuration files, and certificates to user namespaces.
1215

1316
If you make changes to a {kubernetes} resource in an {prod-namespace} namespace,
14-
{prod-short} will immediately replicate the changes across all users namespaces.
17+
{prod-short} will immediately synchronize the changes across all users namespaces.
1518
In reverse, if a {kubernetes} resource is modified in a user namespace,
1619
{prod-short} will immediately revert the changes.
1720

1821
.Procedure
1922

20-
. Create the `ConfigMap` below to replicate into every user {orch-namespace}.
21-
To enhance the configurability, you can customize the `ConfigMap` by adding additional labels and annotations.
22-
By default, the ConfigMap is automatically mounted into user workspaces.
23-
If you do not want the ConfigMap to be mounted, explicitly add the following labels to override the behavior:
23+
. Create the `ConfigMap` below to create and mount it into every workspace.
2424
+
25-
[source,yaml,subs="+attributes,+quotes"]
26-
----
27-
controller.devfile.io/watch-configmap: "false"
28-
controller.devfile.io/mount-to-devworkspace: "false"
29-
----
30-
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]
31-
for other possible labels and annotations.
32-
+
33-
.Replicate a ConfigMap into every user {orch-namespace}:
3425
====
3526
[source,yaml,subs="+attributes,+quotes"]
3627
----
@@ -42,52 +33,34 @@ metadata:
4233
labels:
4334
app.kubernetes.io/part-of: che.eclipse.org
4435
app.kubernetes.io/component: workspaces-config
45-
controller.devfile.io/watch-configmap: "false"
46-
controller.devfile.io/mount-to-devworkspace: "false"
4736
data:
4837
...
4938
----
5039
====
40+
To enhance the configurability, you can customize the `ConfigMap` by adding additional labels and annotations.
41+
+
42+
Add the following labels if you do not want the ConfigMap to be mounted automatically:
5143
+
52-
.Replicate a ConfigMap into every user {orch-namespace} and automatically mount a `settings.xml` file into every user container by path `/home/user/.m2`:
53-
====
5444
[source,yaml,subs="+attributes,+quotes"]
5545
----
56-
kind: ConfigMap
57-
apiVersion: v1
58-
metadata:
59-
name: {prod-id-short}-user-configmap
60-
namespace: {prod-namespace}
61-
labels:
62-
app.kubernetes.io/part-of: che.eclipse.org
63-
app.kubernetes.io/component: workspaces-config
64-
annotations:
65-
controller.devfile.io/mount-as: subpath
66-
controller.devfile.io/mount-path: /home/user/.m2
67-
data:
68-
settings.xml: |
69-
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
70-
<localRepository>/home/user/.m2/repository</localRepository>
71-
<interactiveMode>true</interactiveMode>
72-
<offline>false</offline>
73-
</settings>
46+
controller.devfile.io/watch-configmap: "false"
47+
controller.devfile.io/mount-to-devworkspace: "false"
7448
----
75-
====
76-
77-
. Create the `Secret` below to replicate into every user {orch-namespace}.
78-
To enhance the configurability, you can customize the `Secret` by adding additional labels and annotations.
79-
By default, the Secret is automatically mounted into user workspaces.
80-
If you do not want the Secret to be mounted, explicitly add the following labels to override the behavior:
49+
+
50+
Add the annotation below if you want the ConfigMap to be retained in a user {namespace}
51+
after being deleted from {prod-namespace} namespace:
8152
+
8253
[source,yaml,subs="+attributes,+quotes"]
8354
----
84-
controller.devfile.io/watch-secret: "false"
85-
controller.devfile.io/mount-to-devworkspace: "false"
55+
che.eclipse.org/sync-retain-on-delete: "true"
8656
----
87-
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]
57+
+
58+
See the link:https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#automatically-mounting-volumes-configmaps-and-secrets[mounting volumes, configmaps, and secrets]
8859
for other possible labels and annotations.
60+
61+
62+
. Create the `Secret` below to create and mount it into every workspace.
8963
+
90-
.Replicate a Secret into every user {orch-namespace}:
9164
====
9265
[source,yaml,subs="+attributes,+quotes"]
9366
----
@@ -99,64 +72,33 @@ metadata:
9972
labels:
10073
app.kubernetes.io/part-of: che.eclipse.org
10174
app.kubernetes.io/component: workspaces-config
102-
controller.devfile.io/watch-secret: "false"
103-
controller.devfile.io/mount-to-devworkspace: "false"
104-
annotations:
105-
controller.devfile.io/mount-as: env
10675
stringData:
107-
...
76+
...
10877
----
10978
====
79+
To enhance the configurability, you can customize the `Secret` by adding additional labels and annotations.
80+
+
81+
Add the labels if you do not want the Secret to be mounted automatically:
11082
+
111-
.Replicate a Secret into every user {orch-namespace} and automatically mount a `secret.data` file into every user container by path `/home/user/secrets`:
112-
====
11383
[source,yaml,subs="+attributes,+quotes"]
11484
----
115-
kind: Secret
116-
apiVersion: v1
117-
metadata:
118-
name: {prod-id-short}-user-secret
119-
namespace: {prod-namespace}
120-
labels:
121-
app.kubernetes.io/part-of: che.eclipse.org
122-
app.kubernetes.io/component: workspaces-config
123-
annotations:
124-
controller.devfile.io/mount-as: subpath
125-
controller.devfile.io/mount-path: /home/user/secrets
126-
stringData:
127-
secret.data: |
128-
...
85+
controller.devfile.io/watch-secret: "false"
86+
controller.devfile.io/mount-to-devworkspace: "false"
12987
----
130-
====
13188
+
132-
.Replicate a Secret into every user {orch-namespace} and automatically mount as environment variables into every user container:
133-
====
89+
Add the annotation below if you want the Secret to be retained in a user {namespace}
90+
after being deleted from {prod-namespace} namespace:
91+
+
13492
[source,yaml,subs="+attributes,+quotes"]
13593
----
136-
kind: Secret
137-
apiVersion: v1
138-
metadata:
139-
name: {prod-id-short}-user-secret
140-
namespace: {prod-namespace}
141-
labels:
142-
app.kubernetes.io/part-of: che.eclipse.org
143-
app.kubernetes.io/component: workspaces-config
144-
annotations:
145-
controller.devfile.io/mount-as: env
146-
stringData:
147-
ENV_VAR_1: value_1
148-
ENV_VAR_2: value_2
94+
che.eclipse.org/sync-retain-on-delete: "true"
14995
----
150-
====
151-
152-
153-
. Create the `PersistentVolumeClaim` below to replicate it to every user {orch-namespace}.
15496
+
155-
To enhance the configurability, you can customize the `PersistentVolumeClaim` by adding additional labels and annotations.
156-
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]
97+
See the link:https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#automatically-mounting-volumes-configmaps-and-secrets[mounting volumes, configmaps, and secrets]
15798
for other possible labels and annotations.
158-
+
159-
To modify the `PersistentVolumeClaim`, delete it and create a new one in {prod-namespace} namespace.
99+
100+
101+
. Create the `PersistentVolumeClaim` below to create it to every user {orch-namespace}.
160102
+
161103
[source,yaml,subs="+attributes,+quotes"]
162104
----
@@ -172,31 +114,20 @@ spec:
172114
...
173115
----
174116
+
175-
.Mounting a `PersistentVolumeClaim` to a user workspace:
176-
====
117+
To enhance the configurability, you can customize the `PersistentVolumeClaim` by adding additional labels and annotations.
118+
+
119+
The `PersistentVolumeClaim` is not deleted in a user {namespace} by default, if the one from {prod-namespace} is deleted.
120+
Add the annotation below if you want the `PersistentVolumeClaim` to be deleted in a user {namespace} as well:
121+
122+
+
177123
[source,yaml,subs="+attributes,+quotes"]
178124
----
179-
apiVersion: v1
180-
kind: PersistentVolumeClaim
181-
metadata:
182-
name: {prod-id-short}-user-pvc
183-
namespace: {prod-namespace}
184-
labels:
185-
app.kubernetes.io/part-of: che.eclipse.org
186-
app.kubernetes.io/component: workspaces-config
187-
controller.devfile.io/mount-to-devworkspace: 'true'
188-
annotations:
189-
controller.devfile.io/mount-path: /home/user/data
190-
controller.devfile.io/read-only: 'true'
191-
spec:
192-
accessModes:
193-
- ReadWriteOnce
194-
resources:
195-
requests:
196-
storage: 5Gi
197-
volumeMode: Filesystem
125+
che.eclipse.org/sync-retain-on-delete: "false"
198126
----
199-
====
127+
+
128+
See the link:https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#automatically-mounting-volumes-configmaps-and-secrets[mounting volumes, configmaps, and secrets]
129+
for other possible labels and annotations.
130+
+
200131

201132
. To leverage the OpenShift Kubernetes Engine, you can create a `Template` object to replicate all resources defined within the template across each user {orch-namespace}.
202133
+

0 commit comments

Comments
 (0)