| 
6 | 6 | 
 
  | 
7 | 7 | You must use the `spec.application` path to configure the injection of custom files and environment variables into your {backstage} Pod containers. This ensures necessary configurations, credentials, and dependencies (such as certificates) are available at runtime.  | 
8 | 8 | 
 
  | 
9 |  | -By default, resources inject into the **`backstage-backend`** container. 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.  | 
10 |  | - | 
11 |  | -.Procedure  | 
12 |  | -. To configure resource injection, use the following fields under `spec.application`:  | 
13 |  | - | 
14 |  | -.. File Injection (`spec.application.extraFiles`): Define external file resources to be mounted as volumes from pre-created ConfigMaps, Secrets, or PVCs.  | 
15 |  | -** **File Sources:**  | 
16 |  | -*** `configMaps`:: Sources file volumes from Kubernetes ConfigMaps.  | 
17 |  | -*** `secrets`:: Sources file volumes from Kubernetes Secrets.  | 
18 |  | -*** `pvcs`:: Sources volume claims from Kubernetes Persistent Volume Claims (PVCs).  | 
19 |  | - | 
20 |  | -.. Environment Variable Injection (`spec.application.extraEnvs`): Define the environment variables to be injected into the targeted containers.  | 
21 |  | -** **Environment Sources:**  | 
22 |  | -*** `configMaps`:: Injects environment variables sourced from Kubernetes ConfigMaps.  | 
23 |  | -*** `secrets`:: Injects environment variables sourced from Kubernetes Secrets.  | 
24 |  | -*** `envs`:: Injects hardcoded environment variables defined directly in the manifest.  | 
 | 9 | +You can mount extra files, sourced from pre-created Kubernetes ConfigMaps or Secrets, to your {backstage} Pod containers using the `spec.application.extraFiles` path.  | 
 | 10 | + | 
 | 11 | +By default, files mount only to the `backstage-backend` container. 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.  | 
 | 12 | + | 
 | 13 | +. To mount extra files, apply the configuration to your `{product-custom-resource-type} custom resource (CR)` as shown in the following code:  | 
 | 14 | ++  | 
 | 15 | +[source,yaml]  | 
 | 16 | +----  | 
 | 17 | +spec:  | 
 | 18 | +  application:  | 
 | 19 | +    extraFiles:  | 
 | 20 | +      mountPath: /my/path  | 
 | 21 | +      configMaps:  | 
 | 22 | +        - name: cm1  | 
 | 23 | +        - name: cm2  | 
 | 24 | +          key: file21.txt  | 
 | 25 | +          containers:  | 
 | 26 | +            - "*"  | 
 | 27 | +        - name: cm3  | 
 | 28 | +          mountPath: /my/cm3/path  | 
 | 29 | +          containers:  | 
 | 30 | +            - backstage-backend  | 
 | 31 | +            - install-dynamic-plugins  | 
 | 32 | +      secrets:  | 
 | 33 | +        - name: secret1  | 
 | 34 | +          key: file3.txt  | 
 | 35 | +          containers:  | 
 | 36 | +            - install-dynamic-plugins  | 
 | 37 | +        - name: secret2  | 
 | 38 | +          mountPath: /my/secret2/path  | 
 | 39 | +----  | 
 | 40 | + | 
 | 41 | +If the `containers` field is not specified, the volume mounts to the `backstage-backend` container only. The following explicit options are supported:  | 
 | 42 | + | 
 | 43 | +* No or empty field: Mounts only to the `backstage-backend` container.  | 
 | 44 | +* `*` (asterisk) as the first and only array element: Mounts to all containers.  | 
 | 45 | +* Explicit container names (for example, `install-dynamic-plugins`): Mounts only to the listed containers.  | 
 | 46 | + | 
 | 47 | +.Verification  | 
 | 48 | + | 
 | 49 | +The files are mounted with the following paths and container targets:  | 
 | 50 | + | 
 | 51 | +* `/my/path/file11.txt`: Mounted to `backstage-backend` container only.  | 
 | 52 | +* `/my/path/file12.txt`: Mounted to `backstage-backend` container only.  | 
 | 53 | +* `/my/path/file21.txt`: Mounted to all containers.  | 
 | 54 | +* `/my/secret1/path/file3.txt`: Mounted to `install-dynamic-plugins` container only.  | 
 | 55 | +* `/my/cm3/path/`: Directory mounted to `backstage-backend` and `install-dynamic-plugins` containers.  | 
 | 56 | +* `/my/secret2/path/`: Directory mounted to `backstage-backend` container only.  | 
0 commit comments