forked from LaconicNetwork/kompose
Allow controller flag to override restart policy (#1340)
This commit is contained in:
@@ -1154,11 +1154,8 @@ func (k *Kubernetes) Transform(komposeObject kobject.KomposeObject, opt kobject.
|
||||
}
|
||||
|
||||
// Generate pod only and nothing more
|
||||
if service.Restart == "no" || service.Restart == "on-failure" {
|
||||
// Error out if Controller Object is specified with restart: 'on-failure'
|
||||
if opt.IsDeploymentFlag || opt.IsDaemonSetFlag || opt.IsReplicationControllerFlag {
|
||||
return nil, errors.New("Controller object cannot be specified with restart: 'on-failure'")
|
||||
}
|
||||
if (service.Restart == "no" || service.Restart == "on-failure") && !opt.IsPodController() {
|
||||
log.Infof("Create kubernetes pod instead of pod controller due to restart policy: %s", service.Restart)
|
||||
pod := k.InitPod(name, service)
|
||||
objects = append(objects, pod)
|
||||
} else {
|
||||
|
||||
@@ -518,8 +518,8 @@ func TestRestartOnFailure(t *testing.T) {
|
||||
t.Log("Test case:", name)
|
||||
k := Kubernetes{}
|
||||
_, err := k.Transform(test.komposeObject, test.opt)
|
||||
if err == nil {
|
||||
t.Errorf("Expected an error, got %v instead", err)
|
||||
if err != nil {
|
||||
t.Errorf("Expected nil error, got %v instead", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user