generated from redhat-developer/new-project-template
    
        
        - 
                Notifications
    
You must be signed in to change notification settings  - Fork 55
 
RHIDP-8828: Injecting resources for backstage containers #1464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            pabel-rh
  wants to merge
  18
  commits into
  redhat-developer:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
pabel-rh:rhidp-8828
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from 11 commits
      Commits
    
    
            Show all changes
          
          
            18 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      29d7027
              
                Injecting resources for backstage containers
              
              
                pabel-rh 9fd9908
              
                Added missing content
              
              
                pabel-rh 242e83c
              
                More changes
              
              
                pabel-rh 21fc7c8
              
                Minor changes
              
              
                pabel-rh 9aef630
              
                Add extra env and pvc config
              
              
                pabel-rh a3bf506
              
                Incorporated Gennady's comments
              
              
                pabel-rh 5fb358d
              
                Adding close table asciidoc format
              
              
                pabel-rh 36aa4de
              
                Removed redundant file
              
              
                pabel-rh 921a791
              
                Updated the table
              
              
                pabel-rh a63d4ce
              
                Minor updates to the table
              
              
                pabel-rh 24312ec
              
                Incorporated Judy's comments
              
              
                pabel-rh d864737
              
                Incorporated some of Jana's comments
              
              
                pabel-rh 3189aa3
              
                Incorporated Jana's feedback
              
              
                pabel-rh 63983a7
              
                Consolidating procedure with similar info
              
              
                pabel-rh e1c0002
              
                Minor change
              
              
                pabel-rh fb283f1
              
                A few changes
              
              
                pabel-rh f3c9243
              
                Changes
              
              
                pabel-rh b4403b8
              
                Merge them all!
              
              
                pabel-rh File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            127 changes: 127 additions & 0 deletions
          
          127 
        
  ...injecting-custom-files-and-environment-variables-into-backstage-containers.adoc
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| 
     | 
||
| :_mod-docs-content-type: PROCEDURE | ||
| 
     | 
||
| [id="proc-injecting-custom-files-and-environment-variables-into-backstage-containers"] | ||
| = Injecting extra files and environment variables into {backstage} containers | ||
| 
     | 
||
| By default, files mount only to the `backstage-backend` container. If the `containers` field is not specified, the volume mounts 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 selectcustom sidecars) or select all containers in the {backstage} Pod. | ||
| 
     | 
||
                
      
                  pabel-rh marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| . To mount files 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: | ||
                
      
                  pabel-rh marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
                
      
                  pabel-rh marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
                
      
                  pabel-rh marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| + | ||
| [source,yaml] | ||
| ---- | ||
| spec: | ||
| application: | ||
| extraFiles: | ||
| mountPath: /my/path | ||
| configMaps: | ||
| - name: cm1 | ||
                
      
                  pabel-rh marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| - name: cm2 | ||
| key: file21.txt | ||
| containers: | ||
| - "*" | ||
| - name: cm3 | ||
| mountPath: /my/cm3/path | ||
| containers: | ||
| - backstage-backend | ||
| - install-dynamic-plugins | ||
| secrets: | ||
| - name: secret1 | ||
| key: file3.txt | ||
| containers: | ||
| - install-dynamic-plugins | ||
| - name: secret2 | ||
| mountPath: /my/secret2/path | ||
| pvcs: | ||
| - name: myclaim1 | ||
| - name: myclaim2 | ||
| mountPath: /vol/my/claim | ||
| 
     | 
||
| extraEnvs: | ||
| configMaps: | ||
| - name: cm1 | ||
| key: ENV_VAR1 | ||
| containers: | ||
| - "*" | ||
| secrets: | ||
| - name: secret1 | ||
| envs: | ||
| - name: MY_VAR | ||
| value: "my-value" | ||
| containers: | ||
| - install-dynamic-plugins | ||
| ---- | ||
| where: | ||
| 
     | 
||
| `spec.application.extraFiles.mountPath`:: Specifies default mount path for extraFiles without a specific mountPath | ||
| `spec.application.extraFiles.configMaps.name`:: Mounts all entries from cm1 to `/my/path/` | ||
| `spec.application.extraFiles.configMaps.key`:: Mounts only `file21.txt` | ||
| `spec.application.extraFiles.configMaps.container`:: Targets all containers | ||
| `spec.application.extraFiles.configMaps.mountPath`:: Mounts all entries as a directory | ||
| `spec.application.extraFiles.configMaps.secrets.key`:: Specify key for security | ||
| `spec.application.extraFiles.configMaps.secrets.mountPath`:: Mounts all secret entries as a directory | ||
| `spec.application.extraFiles.configMaps.pvcs.name`:: Mounts to /my/path/myclaim1 (using default mountPath) | ||
| `spec.application.extraFiles.configMaps.pvcs.mountPath`:: Overrides default mountPath | ||
| `spec.application.extraEnvs.configMaps.containers`:: Injects into all containers | ||
| `spec.application.secrets.configMaps.containers`:: Injects all keys from secret1 | ||
| `spec.application.envs.containers`:: Targets only this container. | ||
| 
     | 
||
| The following explicit options are supported: | ||
                
      
                  pabel-rh marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| * *No* or an empty field: Mounts only to the `backstanamege-backend` container. | ||
| * `*` (asterisk) as the first and only array element: Mounts to all containers. | ||
| * Explicit container names, for example, `install-dynamic-plugins`: Mounts only to the listed containers. | ||
| 
     | 
||
| .Verification | ||
| 
     | 
||
| The files are mounted with the following paths and container targets: | ||
                
      
                  pabel-rh marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| [cols="1,2,3,2", options="header"] | ||
| |=== | ||
| | Resource | Target type | Path(s) or name(s) | Container(s) | ||
                
      
                  pabel-rh marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| | ConfigMap (`cm1`) | ||
| | File | ||
| | `/my/path/file11.txt`, `/my/path/file12.txt` | ||
| | `backstage-backend` | ||
| 
     | 
||
| | ConfigMap (`cm2`) | ||
| | File | ||
| | `/my/path/file21.txt` | ||
| | All | ||
| 
     | 
||
| | ConfigMap (`cm3`) | ||
| | Directory | ||
| | `/my/cm3/path/` | ||
| | `backstage-backend`, `install-dynamic-plugins` | ||
| 
     | 
||
                
      
                  pabel-rh marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| | Secret (`secret1`) | ||
| | File | ||
| | `/my/path/file3.txt` | ||
| | `install-dynamic-plugins` | ||
| 
     | 
||
| | Secret (`secret2`) | ||
| | Directory | ||
| | `/my/secret2/path/` | ||
| | `backstage-backend` | ||
| 
     | 
||
| | PVC (`myclaim1`) | ||
| | Directory | ||
| | `/my/path/myclaim1` | ||
| | `backstage-backend` | ||
| 
     | 
||
| | ConfigMap (`cm1`) | ||
| | Env Var | ||
| | `ENV_VAR1` | ||
| | All | ||
| 
     | 
||
| | Secret (`secret1`) | ||
| | Env Var | ||
| | `ENV_VAR3`, `ENV_VAR4` | ||
| | `backstage-backend` | ||
| 
     | 
||
| | CRD (`envs`) | ||
| | Env Var | ||
| | `MY_VAR = my-value` | ||
| | `install-dynamic-plugins` | ||
| |=== | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.