Skip to content

Commit 822d059

Browse files
authored
chore: Add labels to prevent mounting CM into user containers (#2896)
* chore: Add labels to prevent mounting CM into user containers Signed-off-by: Anatolii Bazko <abazko@redhat.com>
1 parent 1ece63f commit 822d059

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

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

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,21 @@ In reverse, if a {kubernetes} resource is modified in a user namespace,
1717

1818
.Procedure
1919

20-
. Create the `ConfigMap` below to replicate it to every user namespace.
20+
. Create the `ConfigMap` below to replicate into every user {orch-namespace}.
2121
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:
24+
+
25+
[source,yaml,subs="+attributes,+quotes"]
26+
----
27+
controller.devfile.io/watch-configmap: "false"
28+
controller.devfile.io/mount-to-devworkspace: "false"
29+
----
2230
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]
2331
for other possible labels and annotations.
2432
+
33+
.Replicate a ConfigMap into every user {orch-namespace}:
34+
====
2535
[source,yaml,subs="+attributes,+quotes"]
2636
----
2737
kind: ConfigMap
@@ -32,11 +42,14 @@ metadata:
3242
labels:
3343
app.kubernetes.io/part-of: che.eclipse.org
3444
app.kubernetes.io/component: workspaces-config
45+
controller.devfile.io/watch-configmap: "false"
46+
controller.devfile.io/mount-to-devworkspace: "false"
3547
data:
3648
...
3749
----
50+
====
3851
+
39-
.Mounting a `settings.xml` file to a user workspace:
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`:
4053
====
4154
[source,yaml,subs="+attributes,+quotes"]
4255
----
@@ -61,11 +74,21 @@ data:
6174
----
6275
====
6376

64-
. Create the `Secret` below to replicate it to every user namespace.
77+
. Create the `Secret` below to replicate into every user {orch-namespace}.
6578
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:
81+
+
82+
[source,yaml,subs="+attributes,+quotes"]
83+
----
84+
controller.devfile.io/watch-secret: "false"
85+
controller.devfile.io/mount-to-devworkspace: "false"
86+
----
6687
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]
6788
for other possible labels and annotations.
6889
+
90+
.Replicate a Secret into every user {orch-namespace}:
91+
====
6992
[source,yaml,subs="+attributes,+quotes"]
7093
----
7194
kind: Secret
@@ -76,11 +99,16 @@ metadata:
7699
labels:
77100
app.kubernetes.io/part-of: che.eclipse.org
78101
app.kubernetes.io/component: workspaces-config
79-
data:
102+
controller.devfile.io/watch-secret: "false"
103+
controller.devfile.io/mount-to-devworkspace: "false"
104+
annotations:
105+
controller.devfile.io/mount-as: env
106+
stringData:
80107
...
81108
----
109+
====
82110
+
83-
.Mounting certificates to a user workspace:
111+
.Replicate a Secret into every user {orch-namespace} and automatically mount a `trusted-certificates.crt` file into every user container by path `/etc/pki/ca-trust/source/anchors`:
84112
====
85113
[source,yaml,subs="+attributes,+quotes"]
86114
----
@@ -104,7 +132,7 @@ It can be achieved manually or by adding this command to a `postStart` event in
104132
See the link:https://devfile.io/docs/{devfile-api-version}/adding-event-bindings#post-start-object[Adding event bindings in a devfile].
105133
====
106134
+
107-
.Mounting environment variables to a user workspace:
135+
.Replicate a Secret into every user {orch-namespace} and automatically mount as environment variables into every user container:
108136
====
109137
[source,yaml,subs="+attributes,+quotes"]
110138
----
@@ -124,7 +152,8 @@ stringData:
124152
----
125153
====
126154

127-
. Create the `PersistentVolumeClaim` below to replicate it to every user namespace.
155+
156+
. Create the `PersistentVolumeClaim` below to replicate it to every user {orch-namespace}.
128157
+
129158
To enhance the configurability, you can customize the `PersistentVolumeClaim` by adding additional labels and annotations.
130159
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]
@@ -172,7 +201,7 @@ spec:
172201
----
173202
====
174203

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}.
204+
. 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}.
176205
+
177206
Aside from the previously mentioned `ConfigMap`, `Secret`, and `PersistentVolumeClaim`, `Template` objects can include:
178207
+
@@ -204,7 +233,7 @@ The `parameters` are optional and define which parameters can be used. Currently
204233
+
205234
The {namespace} name in objects will be replaced with the user's {namespace} name during synchronization.
206235
+
207-
.Replicating {kubernetes} resources to a user namespace:
236+
.Replicating {kubernetes} resources to a user {orch-namespace}:
208237
====
209238
[source,yaml,subs="+attributes,+quotes"]
210239
----

modules/administration-guide/pages/editor-configurations-for-microsoft-visual-studio-code.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ apiVersion: v1
3434
kind: ConfigMap
3535
metadata:
3636
name: vscode-editor-configurations
37-
data:
37+
labels:
38+
app.kubernetes.io/part-of: che.eclipse.org
39+
data:
3840
extensions.json: |
3941
{
4042
"recommendations": [

0 commit comments

Comments
 (0)