-
Notifications
You must be signed in to change notification settings - Fork 49
feat: host_path support in recipes #401
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,8 +116,9 @@ type YAMLServiceConfig struct { | |
| } | ||
|
|
||
| type YAMLVolumeMappedConfig struct { | ||
| Name string `yaml:"name"` | ||
| IsLocal bool `yaml:"is_local"` | ||
| Name string `yaml:"name"` | ||
| IsLocal bool `yaml:"is_local"` | ||
| HostPath string `yaml:"host_path"` | ||
| } | ||
|
|
||
| // YAMLReleaseConfig specifies a GitHub release to download | ||
|
|
@@ -481,9 +482,7 @@ func applyServiceOverrides(svc *Service, config *YAMLServiceConfig, root *Compon | |
| applyFilesToService(svc, config.Files) | ||
| } | ||
| if config.Volumes != nil { | ||
| for containerPath, volumeMapping := range config.Volumes { | ||
| svc.WithVolume(volumeMapping.Name, containerPath, volumeMapping.IsLocal) | ||
| } | ||
| applyVolumesToService(svc, config.Volumes) | ||
| } | ||
| if config.DependsOn != nil { | ||
| applyDependsOn(svc, config.DependsOn, root) | ||
|
|
@@ -574,6 +573,16 @@ func yamlReleaseToRelease(cfg *YAMLReleaseConfig) *release { | |
| } | ||
|
|
||
| // applyFilesToService maps files to a service | ||
| func applyVolumesToService(svc *Service, volumes map[string]*YAMLVolumeMappedConfig) { | ||
| for containerPath, volumeMapping := range volumes { | ||
| if volumeMapping.HostPath != "" { | ||
julio4 marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No validation when a user sets conflicting fields (e.g. both Also, unlike service-level if volumeMapping.HostPath != "" {
hostPath, err := filepath.Abs(volumeMapping.HostPath)
// handle err
svc.WithHostVolume(hostPath, containerPath)
} |
||
| svc.WithHostVolume(volumeMapping.HostPath, containerPath) | ||
| } else { | ||
| svc.WithVolume(volumeMapping.Name, containerPath, volumeMapping.IsLocal) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| func applyFilesToService(svc *Service, files map[string]string) { | ||
| for containerPath, fileSource := range files { | ||
| var artifactName string | ||
|
|
@@ -662,9 +671,7 @@ func createServiceFromConfig(name string, config *YAMLServiceConfig, root *Compo | |
| applyFilesToService(svc, config.Files) | ||
| } | ||
| if config.Volumes != nil { | ||
| for containerPath, volumeMapping := range config.Volumes { | ||
| svc.WithVolume(volumeMapping.Name, containerPath, volumeMapping.IsLocal) | ||
| } | ||
| applyVolumesToService(svc, config.Volumes) | ||
| } | ||
| if config.DependsOn != nil { | ||
| applyDependsOn(svc, config.DependsOn, root) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.