Skip to content

Commit 28b978a

Browse files
committed
Add extra env and pvc config
1 parent 8ba4265 commit 28b978a

File tree

2 files changed

+69
-16
lines changed

2 files changed

+69
-16
lines changed

modules/configuring/con-mounting-and-container-targeting-details.adoc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,13 @@ The mounting behavior is determined by the combination of the optional `key` and
4141
[NOTE]
4242
====
4343
For security reasons, mounting files from **Secrets** is not supported if both `mountPath` and `key` are unspecified.
44-
====
44+
====
45+
46+
.PersistentVolumeClaim (PVC) path logic
47+
48+
PVCs mount as a directory. The mount path is determined by the first available value in the following order:
49+
50+
. `spec.application.extraFiles.pvcs[].mountPath` (Specific path for the PVC).
51+
. `spec.application.extraFiles.mountPath` (Default path for all extra files).
52+
. The {backstage} container `WorkingDir`.
53+
. The default Kubernetes path: `/opt/app-root/src`.

modules/configuring/proc-injecting-custom-files-and-environment-variables-into-backstage-containers.adoc

Lines changed: 59 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,55 @@
44
[id="proc-injecting-custom-files-and-environment-variables-into-backstage-containers"]
55
= Injecting extra files and environment variables into {backstage} containers
66

7-
You must use the `spec.application.extraFiles|extraEnvs.configMaps|secrets.containers` path to configure the injection of extra files and environment variables into your {backstage} Pod containers. This ensures necessary configurations, credentials, and dependencies (such as certificates) are available at runtime.
7+
You must use the `spec.application` path to configure the injection of extra files and environment variables into your {backstage} Pod containers. This ensures necessary configurations, credentials, and dependencies (such as certificates) are available at runtime.
88

99
By default, files mount only to the `backstage-backend` container. If the `containers` field is not specified, the volume mounts to the `backstage-backend` container only. You can also specify other targets, including a list of containers by name (such as `dynamic-plugin-install` or custom sidecars) or opt to in all containers in the {backstage} Pod.
1010

11-
. To mount extra files, apply the configuration to your `{product-custom-resource-type} custom resource (CR)` as shown in the following code:
11+
. To mount files, PVCs, and injecting environment variables into different container targets., apply the configuration to your `{product-custom-resource-type} custom resource (CR)` as shown in the following code:
1212
+
1313
[source,yaml]
1414
----
1515
spec:
1616
application:
17+
# Default mount path for extraFiles without a specific mountPath
1718
extraFiles:
18-
mountPath: /my/path
19+
mountPath: /my/path
1920
configMaps:
20-
- name: cm1
21+
- name: cm1 # Mounts all entries from cm1 to /my/path/
2122
- name: cm2
22-
key: file21.txt
23+
key: file21.txt # Mounts only 'file21.txt'
2324
containers:
24-
- "*"
25+
- "*" # Targets all containers
2526
- name: cm3
26-
mountPath: /my/cm3/path
27+
mountPath: /my/cm3/path # Mounts all entries as a directory
2728
containers:
2829
- backstage-backend
2930
- install-dynamic-plugins
3031
secrets:
3132
- name: secret1
32-
key: file3.txt
33+
key: file3.txt # Must specify key for security
3334
containers:
3435
- install-dynamic-plugins
3536
- name: secret2
36-
mountPath: /my/secret2/path
37+
mountPath: /my/secret2/path # Mounts all secret entries as a directory
38+
pvcs:
39+
- name: myclaim1 # Mounts to /my/path/myclaim1 (using default mountPath)
40+
- name: myclaim2
41+
mountPath: /vol/my/claim # Overrides default mountPath
42+
43+
extraEnvs:
44+
configMaps:
45+
- name: cm1
46+
key: ENV_VAR1
47+
containers:
48+
- "*" # Injects into all containers
49+
secrets:
50+
- name: secret1 # Injects all keys from secret1
51+
envs:
52+
- name: MY_VAR
53+
value: "my-value"
54+
containers:
55+
- install-dynamic-plugins # Targets only this container
3756
----
3857

3958
The following explicit options are supported:
@@ -46,9 +65,34 @@ The following explicit options are supported:
4665

4766
The files are mounted with the following paths and container targets:
4867

49-
* `/my/path/file11.txt`: Mounted to `backstage-backend` container only.
50-
* `/my/path/file12.txt`: Mounted to `backstage-backend` container only.
51-
* `/my/path/file21.txt`: Mounted to all containers.
52-
* `/my/secret1/path/file3.txt`: Mounted to `install-dynamic-plugins` container only.
53-
* `/my/cm3/path/`: Directory mounted to `backstage-backend` and `install-dynamic-plugins` containers.
54-
* `/my/secret2/path/`: Directory mounted to `backstage-backend` container only.
68+
|===
69+
| Resource | Mount Path / Variable | Target Container(s)
70+
71+
| File (`cm1`)
72+
| `/my/path/file11.txt`, `/my/path/file12.txt`
73+
| `backstage-backend` only
74+
75+
| File (`cm2`)
76+
| `/my/path/file21.txt`
77+
| All containers
78+
79+
| Directory (`cm3`)
80+
| `/my/cm3/path/` (Directory)
81+
| `backstage-backend`, `install-dynamic-plugins`
82+
83+
| PVC (`myclaim1`)
84+
| `/my/path/myclaim1` (Directory)
85+
| `backstage-backend` only
86+
87+
| Env Var (`ENV_VAR1`)
88+
| `ENV_VAR1 = 1`
89+
| All containers
90+
91+
| Env Var (`ENV_VAR3`, `ENV_VAR4`)
92+
| `ENV_VAR3`, `ENV_VAR4` (from `secret1`)
93+
| `backstage-backend` only
94+
95+
| Env Var (`MY_VAR`)
96+
| `MY_VAR = my-value`
97+
| `install-dynamic-plugins` only
98+
|===

0 commit comments

Comments
 (0)