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

Print warning for unsupported fields in docker-compose format #71

Closed
janetkuo opened this issue Jul 30, 2016 · 9 comments
Closed

Print warning for unsupported fields in docker-compose format #71

janetkuo opened this issue Jul 30, 2016 · 9 comments

Comments

@janetkuo
Copy link
Member

janetkuo commented Jul 30, 2016

Follow up #3

We're now printing warnings of unsupported fields in their names defined in libcompose, but not their names in docker-compose file format.

For example, this

$ cat nginx.yml
nginx:
  image: nginx
  dockerfile: foobar
  build: ./foobar
  cap_add:
    - ALL
  container_name: foobar

$ kompose convert -f nginx.yml
WARNING: Unsupported key Build - ignoring
WARNING: Unsupported key CapAdd - ignoring
WARNING: Unsupported key ContainerName - ignoring
WARNING: Unsupported key Dockerfile - ignoring

should give me the following warnings instead:

$ kompose convert -f nginx.yml
WARNING: Unsupported key build - ignoring
WARNING: Unsupported key cap_add - ignoring
WARNING: Unsupported key container_name - ignoring
WARNING: Unsupported key dockerfile - ignoring
@janetkuo janetkuo added the bug label Jul 30, 2016
@surajssd
Copy link
Member

@janetkuo and @ngtuna why can we use logrus.Warningf instead of fmt.Println at https://github.com/skippbox/kompose/blob/master/cli/app/app.go#L1076 ?

@surajssd
Copy link
Member

surajssd commented Jul 31, 2016

Also when doing --stdout the warnings should be either printed in a way so that user can still pipe the output to a kubectl. I am not sure if I should create a new issue for this?

@surajssd
Copy link
Member

Using following docker-compose file

$ cat docker-compose.yml 
version: "2"

services:
  mariadb:
    image: centos/mariadb
    container_name: mariadb
    ports:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: etherpad
      MYSQL_DATABASE: etherpad
      MYSQL_PASSWORD: etherpad
      MYSQL_USER: etherpad

When directly piped fails

$ kompose convert  --stdout | kubectl --namespace=kompose create -f -
yaml: line 2: could not find expected ':'

Because the output starts with

$ kompose convert  --stdout
WARNING: Unsupported key Networks - ignoring
{
  "kind": "Service",
  "apiVersion": "v1",
[SNIP]

@ngtuna
Copy link
Contributor

ngtuna commented Aug 1, 2016

Good catch @janetkuo and @surajssd . Thanks. I will update shortly

@janetkuo
Copy link
Member Author

janetkuo commented Aug 1, 2016

Closing as this is now fixed by 55ae6e7

@janetkuo janetkuo closed this as completed Aug 1, 2016
ngtuna added a commit that referenced this issue Aug 2, 2016
@janetkuo janetkuo reopened this Aug 3, 2016
@janetkuo
Copy link
Member Author

janetkuo commented Aug 4, 2016

Right now there are unsupported keys / fields not covered by warnings, such as volume configs.

@surajssd
Copy link
Member

surajssd commented Aug 6, 2016

@ngtuna yes its good that we have we now don't print the output to stdout so I can pipe output right now! 👍
And this can be closed it seems.

@ngtuna
Copy link
Contributor

ngtuna commented Aug 6, 2016

@janetkuo Agree. We haven't covered both volume configs and network configs.

ngtuna added a commit that referenced this issue Aug 10, 2016
enhance warning: networks, network config, volume config. Fixes #88, #71
@ngtuna
Copy link
Contributor

ngtuna commented Aug 10, 2016

Closed by 14cf356

@ngtuna ngtuna closed this as completed Aug 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants