Merge pull request #950 from hangyan/support-old-restart-policy

Support old restart policy in compose v3
This commit is contained in:
Charlie Drage
2018-03-07 08:41:46 -05:00
committed by GitHub
7 changed files with 241 additions and 4 deletions
+7 -1
View File
@@ -285,10 +285,16 @@ func dockerComposeToKomposeMapping(composeObject *types.Config) (kobject.Kompose
}
// restart-policy:
// restart-policy: deploy.restart_policy.condition will rewrite restart option
// see: https://docs.docker.com/compose/compose-file/#restart_policy
serviceConfig.Restart = composeServiceConfig.Restart
if composeServiceConfig.Deploy.RestartPolicy != nil {
serviceConfig.Restart = composeServiceConfig.Deploy.RestartPolicy.Condition
}
if serviceConfig.Restart == "unless-stopped" {
log.Warnf("Restart policy 'unless-stopped' in service %s is not supported, convert it to 'always'", name)
serviceConfig.Restart = "always"
}
// replicas:
if composeServiceConfig.Deploy.Replicas != nil {
+1 -1
View File
@@ -512,7 +512,7 @@ func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.Servic
case "on-failure":
template.Spec.RestartPolicy = api.RestartPolicyOnFailure
default:
return errors.New("Unknown restart policy " + service.Restart + " for service" + name)
return errors.New("Unknown restart policy " + service.Restart + " for service " + name)
}
return nil
}