Skip to content
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

restart: Unsupported value: "OnFailure": supported values: Always #318

Closed
surajssd opened this issue Nov 30, 2016 · 9 comments
Closed

restart: Unsupported value: "OnFailure": supported values: Always #318

surajssd opened this issue Nov 30, 2016 · 9 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@surajssd
Copy link
Member

Using this docker-compose file

$ cat docker-compose.yml 
version: "2"
services:
  mariadb:
    image: centos/mariadb
    restart: on-failure

which fails as

$ kompose up
WARN[0000] [mariadb] Service cannot be created because of missing port. 
We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application. 
If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead. 

FATA[0000] Error while deploying application: Deployment.extensions "mariadb" is invalid: spec.template.spec.restartPolicy: Unsupported value: "OnFailure": supported values: Always 

when converted it looks like this:

$ cat mariadb.yml 
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  name: mariadb
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        service: mariadb
    spec:
      containers:
      - image: centos/mariadb
        name: mariadb
        resources: {}
      restartPolicy: OnFailure
status: {}

so this cannot be OnFailure it always has to be Always which stops us from using docker-compose's restart: on-failure to simulate kubernetes jobs.

@surajssd surajssd added the kind/bug Categorizes issue or PR as related to a bug. label Nov 30, 2016
@surajssd
Copy link
Member Author

So I tried this in continuation with discussion at #236 (comment)

@surajssd
Copy link
Member Author

surajssd commented Dec 1, 2016

But this is perfectly valid thing

$ cat pod-maria.yml 
apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  name: mariadb
spec:
  containers:
  - image: centos/mariadb
    name: mariadb
  restartPolicy: OnFailure

a pod without controller can have restartPolicy as OnFailure

@kadel
Copy link
Member

kadel commented Dec 5, 2016

I'm afraid that this doesn't have easy solution.
I don't think that we can create just pod if there is restartPolicy: on-failure in docker-file.

But we could get away with just ignoring it, and showing warning explaining that this is ignored and Always will be used instead)

@surajssd
Copy link
Member Author

surajssd commented Dec 5, 2016

But we could get away with just ignoring it, and showing warning explaining that this is ignored and Always will be used instead)

@kadel but then this is not solving our original problem of how do we simulate k8s-job like workflow with kompose and docker-compose?

@kadel
Copy link
Member

kadel commented Dec 5, 2016

I'm not even sure if we should simulate Kubernetes job workflow with kompose and docker-compose.

You are proposing creating Job if there is restart: on-failure?

@surajssd surajssd self-assigned this Dec 8, 2016
@ngtuna
Copy link
Contributor

ngtuna commented Dec 13, 2016

so with #334 pod will be created instead of Job if there is restart: on-failure.

@surajssd
Copy link
Member Author

@ngtuna yes you are right!

@surajssd
Copy link
Member Author

surajssd commented Jan 4, 2017

With #334 merged this issue is solved.

@surajssd surajssd closed this as completed Jan 4, 2017
@mhyousefi
Copy link

So, what is the point of having deployment.spec.template.spec.restartPolicy if Always is only allowed option?????

Also, I suppose one could use backoffLimit: 0, though it doesn't seem like a robust solution as the reason why the pod terminated could very well be an actual failure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants