MCPcopy
hub / github.com/moby/moby / validateServiceSpec

Function validateServiceSpec

client/service_create.go:195–206  ·  view source on GitHub ↗
(s swarm.ServiceSpec)

Source from the content-addressed store, hash-verified

193}
194
195func validateServiceSpec(s swarm.ServiceSpec) error {
196 if s.TaskTemplate.ContainerSpec != nil && s.TaskTemplate.PluginSpec != nil {
197 return errors.New("must not specify both a container spec and a plugin spec in the task template")
198 }
199 if s.TaskTemplate.PluginSpec != nil && s.TaskTemplate.Runtime != swarm.RuntimePlugin {
200 return errors.New("mismatched runtime with plugin spec")
201 }
202 if s.TaskTemplate.ContainerSpec != nil && (s.TaskTemplate.Runtime != "" && s.TaskTemplate.Runtime != swarm.RuntimeContainer) {
203 return errors.New("mismatched runtime with container spec")
204 }
205 return nil
206}

Callers 2

ServiceCreateMethod · 0.85
ServiceUpdateMethod · 0.85

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…