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

docker-compose service with no ports is mapped to k8s svc with no ports #58

Closed
surajssd opened this issue Jul 22, 2016 · 6 comments
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@surajssd
Copy link
Member

When a docker-compose service is given with no ports, a corresponding k8s service is created with no port info, and this is wrong config, because port is required value.

docker-compose.yml file I used.

$ cat docker-compose-no-ports.yml 
  mariadb:
    image: centos/mariadb
    environment:
      MYSQL_ROOT_PASSWORD: etherpad
      MYSQL_DATABASE: etherpad
      MYSQL_PASSWORD: etherpad
      MYSQL_USER: etherpad

convert

$ ./kompose convert -f docker-compose-no-ports.yml -o output -y
file "output" created
$ cat output 
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    service: mariadb
  name: mariadb
spec:
  ports: []
  selector:
    service: mariadb
status:
  loadBalancer: {}

---
[SNIP]

When this definition is fed to kubernetes it says:

$ kubectl create -f svc 
The Service "mariadb" is invalid.
spec.ports: Required value

Where svc is:

$ cat svc 
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    service: mariadb
  name: mariadb
spec:
  ports: []
  selector:
    service: mariadb
status:
  loadBalancer: {}

IMO this should error out or should not create service, give warning loud and clear that service is not created, but still we can have deployment or ReplicationController depending on the provider(k8s/openshift).

@ngtuna
Copy link
Contributor

ngtuna commented Jul 22, 2016

@surajssd Good catch. Thanks for that. I will add a validation.

@sebgoa
Copy link
Contributor

sebgoa commented Jul 22, 2016

@ngtuna maybe @surajssd wants to assign this one to himself :)

@kadel
Copy link
Member

kadel commented Jul 22, 2016

In Henge we have solved this by interactively asking user to provide missing information.
But I don't think that interactive mode is good fit for Kompose.

@ngtuna
Copy link
Contributor

ngtuna commented Jul 22, 2016

Somehow, sometimes we might need interactive mode... but I am not sure at this moment we need it..

@ngtuna
Copy link
Contributor

ngtuna commented Jul 25, 2016

@surajssd can you take this one ?

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

@ngtuna sorry for late comment I will take this one!

surajssd added a commit to surajssd/kompose that referenced this issue Jul 27, 2016
Now when user will not provide any port information
a warning will be shown and also service will not
be created.

Fixes kubernetes#58
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

5 participants