mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-07 21:59:15 +00:00
feat(runtime-templates): add support for runtime templates in bind mounts (#412)
This commit is contained in:
1 parent
88dda435e7
commit
5c33e4be86
17 files changed
+571
-10
No files matched your search
@@ -538,6 +538,15 @@ func (s *Server) CreateServiceContainer(
|
||||
containerName = fmt.Sprintf("%s-%s", spec.Name, suffix)
|
||||
}
|
||||
|
||||
desiredSpec := spec
|
||||
renderedSpec, renderErr := desiredSpec.RenderRuntimeTemplates(api.RuntimeTemplateContext{
|
||||
Container: api.RuntimeTemplateContainerContext{Name: containerName},
|
||||
})
|
||||
if renderErr != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "render runtime templates: %v", renderErr)
|
||||
}
|
||||
spec = renderedSpec
|
||||
|
||||
envVars := maps.Clone(spec.Container.Env)
|
||||
if envVars == nil {
|
||||
envVars = make(api.EnvVars)
|
||||
@@ -745,7 +754,7 @@ func (s *Server) CreateServiceContainer(
|
||||
_ = s.client.ContainerRemove(ctx, resp.ID, container.RemoveOptions{RemoveVolumes: true})
|
||||
}
|
||||
|
||||
specBytes, err := json.Marshal(spec)
|
||||
specBytes, err := json.Marshal(desiredSpec)
|
||||
if err != nil {
|
||||
removeContainer()
|
||||
return nil, status.Errorf(codes.Internal, "marshal service spec: %v", err)
|
||||
|
||||
Reference in new issue
Block a user