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

Add --compose-file option to skaffold init #1282

Merged
merged 3 commits into from
Nov 16, 2018

Conversation

nkubala
Copy link
Contributor

@nkubala nkubala commented Nov 15, 2018

This adds a --compose-file flag to skaffold init, which enables users to quickly get started with skaffold with a docker-compose application. The flag simply runs kompose convert on the docker-compose file, which generates kubernetes manifests in the application directory, and then runs skaffold init as normal to generate a skaffold.yaml.

#674 already took a stab at adding direct compose file support, and was closed since there wasn't consensus around the implementation. I also had issues vendoring in kubernetes/kompose, but the precedent for shelling out to k8s-related binaries has already been set with kustomize, so I think this is ok.

We can also extend this to a ComposeDeployer (a la what @r2d4 had in #674) if we want to go that route, depending on what people want, but I think at the very least it makes sense in init.

Fixes #1195

@codecov-io
Copy link

codecov-io commented Nov 15, 2018

Codecov Report

Merging #1282 into master will decrease coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1282      +/-   ##
==========================================
- Coverage    44.3%   44.24%   -0.06%     
==========================================
  Files         104      104              
  Lines        4623     4629       +6     
==========================================
  Hits         2048     2048              
- Misses       2366     2372       +6     
  Partials      209      209
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/init.go 15.42% <0%> (-0.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 412ec74...52bbc9b. Read the comment docs.

if composeFile != "" {
// run kompose first to generate k8s manifests, then run skaffold init
logrus.Infof("running 'kompose convert' for file %s", composeFile)
komposeCmd := exec.Command("kompose", "convert", "-f", composeFile)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a preference around supported version for kompose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just added it to the dockerfile with a pinned version. I only tried with the latest (v1.17.0), but I'm assuming any older version that does what it's supposed to do will work with skaffold.

Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is nice and simple :)

@nkubala nkubala merged commit f2c01a2 into GoogleContainerTools:master Nov 16, 2018
@nkubala nkubala deleted the compose branch November 16, 2018 18:10
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

Successfully merging this pull request may close these issues.

skaffold init --docker-compose
3 participants