mirror of
				https://github.com/siderolabs/talos.git
				synced 2025-10-31 16:31:13 +01:00 
			
		
		
		
	chore: allow mounting files from the host
Allow mounting files from host into extension services as per the [OCI spec](https://github.com/opencontainers/runtime-spec/blob/main/config.md#mounts) Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
		
							parent
							
								
									f3e330a0aa
								
							
						
					
					
						commit
						51a68c31ff
					
				| @ -6,6 +6,7 @@ package services | |||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
|  | 	"errors" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
| @ -102,6 +103,13 @@ func (svc *Extension) Runner(r runtime.Runtime) (runner.Runner, error) { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	for _, mount := range svc.Spec.Container.Mounts { | 	for _, mount := range svc.Spec.Container.Mounts { | ||||||
|  | 		if _, err := os.Stat(mount.Source); err == nil { | ||||||
|  | 			// already exists, skip | ||||||
|  | 			continue | ||||||
|  | 		} else if !errors.Is(err, os.ErrNotExist) { | ||||||
|  | 			return nil, err | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		if err := os.MkdirAll(mount.Source, 0o700); err != nil { | 		if err := os.MkdirAll(mount.Source, 0o700); err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user