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 support for Config, endpoint_mode and 3.3 support #994

Merged
merged 4 commits into from
Aug 1, 2018

Conversation

xianlubird
Copy link
Contributor

@xianlubird xianlubird commented Apr 27, 2018

Version 3.3
An upgrade of version 3 that introduces new parameters only available with Docker Engine version 17.06.0+, and higher.

Introduces the following additional parameters:

    build labels
    credential_spec
    configs
    deploy endpoint_mode

Docker compose v3.3 add four attributes. For credential_spec we shouldn't support. I will work on it , support v3.3 ASAP.

Issue: #914 and #865

@cdrage

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 27, 2018
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 3, 2018
@xianlubird xianlubird force-pushed the features/v3.3 branch 2 times, most recently from 5f922e4 to 7d4d0fb Compare May 4, 2018 02:16
@xianlubird xianlubird changed the title [WIP] Do Not Merge Support docker compose v3.3 Support docker compose v3.3 for kubernetes transform May 4, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 4, 2018
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 4, 2018
@xianlubird
Copy link
Contributor Author

xianlubird commented May 4, 2018

@cdrage @hangyan @surajnarwade
A brief introduction:

  • This PR implement compose v3.3 support for kubernetes transform. For openshift, it will be implemented in another PR later.
  • credential_spec can only be used in windows container, so we ignore it
  • configs convert to configmap in kubernetes and can be mount into deployment pod
  • endpoint_mode vip mode is similar to nodePort type service, dnsrr should ignore

@cdrage @hangyan Pls review this PR if you are free. Review this PR maybe cost much time. If you have any comments , I will refactor my code. Thanks . :-)

@youyajie
Copy link

youyajie commented May 5, 2018

What's update on this ? Waiting it to be merged, so we can use it.

@xianlubird
Copy link
Contributor Author

xianlubird commented May 5, 2018

@youyajie Thank you for notice this pr. @cdrage and @hangyan are reviewing code , hope it will be merged soon :-)

@xianlubird xianlubird force-pushed the features/v3.3 branch 2 times, most recently from 20d79d5 to 5d919a7 Compare May 8, 2018 12:10
Copy link
Member

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

This is a great start! However, we really need to add more documentation.

With this PR, we are actually adding: Configuration support, 3.3 support as well as new key support (endpoint_mode for deploy).

Please:

  • Update the conversion documentation (the table)
  • Change the title of this PR (add support for Config, endpoint_mode and 3.3 support).
  • Change your commit message (can be modified using git commit --amend

If possible, could you also change this to three separate commits? (one for adding config support, one for adding deployment endpoint_mode support, and one for adding docker compose 3.3 support). I know it's a pain to do, but maybe @hangyan could help you?

Many thanks! 👍

noSupKeys := checkUnsupportedKeyForV3(config)
for _, keyName := range noSupKeys {
log.Warningf("Unsupported %s key - ignoring", keyName)
}
Copy link
Member

Choose a reason for hiding this comment

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

👍

deploy:
mode: replicated
replicas: 2
endpoint_mode: vip
Copy link
Member

Choose a reason for hiding this comment

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

this needs to be added to the documentation: http://kompose.io/conversion/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @cdrage

keysFound = append(keysFound, "credential_spec")
}
if service.Deploy.EndpointMode == "dnsrr" {
keysFound = append(keysFound, "dnsrr")
Copy link
Member

Choose a reason for hiding this comment

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

A bit confused, we're manipulating "vip" and that makes sense (using an IP endpoint). But what is the Kubernetes equivalent with dnsrr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cdrage dnsrr means user can use service name to connect, so in k8s, a normal service type can connect through service name. Change code to that, dnsrr convert to a normal service type.

Copy link
Member

Choose a reason for hiding this comment

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

ah, that makes sense. thank you.

@hangyan
Copy link
Contributor

hangyan commented May 8, 2018

@cdrage Sure. I am current working on the secret support, separate the commit can also reduce the potentially conflict

@xianlubird xianlubird changed the title Support docker compose v3.3 for kubernetes transform Add support for Config, endpoint_mode and 3.3 support May 9, 2018
@xianlubird
Copy link
Contributor Author

@cdrage @hangyan
Already done these things

  • Change PR name to add support for Config, endpoint_mode and 3.3 support
  • Change this pr to three separate commits
  • Add document

Pls review again if you are free, thanks.

@xianlubird
Copy link
Contributor Author

@cdrage Any update ?

@@ -4,7 +4,7 @@ This document outlines all possible conversion details regarding `docker-compose

The current table covers all **current** possible Docker Compose keys.

__Note:__ due to the fast-pace nature of Docker Compose version revisions, minor versions such as 2.1, 2.2, 3.3 are not supported until they are cut into a major version release such as 2 or 3.
__Note:__ due to the fast-pace nature of Docker Compose version revisions, minor versions such as 2.1, 2.2 are not supported until they are cut into a major version release such as 2 or 3.
Copy link
Member

Choose a reason for hiding this comment

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

Go ahead and completely remove this line.. We should simply state that we don't support anything 3.4 and above at the moment.

keysFound = append(keysFound, "credential_spec")
}
if service.Deploy.EndpointMode == "dnsrr" {
keysFound = append(keysFound, "dnsrr")
Copy link
Member

Choose a reason for hiding this comment

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

ah, that makes sense. thank you.

Copy link
Member

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

Other than one small comment, this LGTM. Although this is a big PR. Could you have a quick-look @hangyan before we merge?

@hangyan
Copy link
Contributor

hangyan commented May 10, 2018

@cdrage @xianlubird

A few thoughts:

  1. OpenShfit support should be added
  2. About deploy mode. In my opinion, vip -> ClusterIP , dnsrr-> Headless

@xianlubird
Copy link
Contributor Author

xianlubird commented May 10, 2018

@hangyan

  1. OpenShfit will be implemented in another pr later, this pr focus on kubernetes
  2. VIP means user can visit any ip:port in the cluster node, so it equals to NodePort service. ClusterIP can't be visited outside the cluster. dnsrr means user can use service name to connect, so in k8s, a normal service type can connect through service name.

@hangyan
Copy link
Contributor

hangyan commented May 10, 2018

@xianlubird

  1. OpenShift support is just a few commands, it would't take many time. I don't think it's a good idea to seperate this

  2. According to the compose doc. vip mode acts like a normal load balancer, the client wouldn't known what the backends are. With NodePort, you have to known how many nodes are in the kubernetes cluster, and what are there ips, I think these principle take preceder over the access from outside of the cluster rule.

dnsrr works very similar to Headless Service. In Headless service, when you do a dns-lookup for the service name, a range of ips will returned(the ip list of the pods).

@hangyan
Copy link
Contributor

hangyan commented May 10, 2018

@cdrage Please take a look at my reviews and share some of your thoughts on this

@hangyan hangyan added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 10, 2018
@xianlubird
Copy link
Contributor Author

xianlubird commented May 10, 2018

@hangyan

  1. For vip mode, I don't agree with you. In vip mode, user should use ip:port to visit service. User also should know node ip, it totally equals to NodePort service. If convert to Cluster IP, how should user to visit service outside cluster? Cloud they use node ip with port ? It can not equals to ClusterIP type.

dnsrr means user visit service name, headless is a external service. I think cluster ip is better. Both of them can visit through service name, but cluster ip type is more used.

  1. I am not similar to OpenShift. So this pr first name is add support 3.3 for kubernetes. It will cost much time for me to implement OpenShift. So I will implement it later in another pr. And for OpenShift, I think it should split to another pr, it will more clear.

Need your opinion @cdrage

@xianlubird xianlubird force-pushed the features/v3.3 branch 2 times, most recently from ba97063 to 5892a51 Compare May 11, 2018 03:50
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 11, 2018
@xianlubird
Copy link
Contributor Author

xianlubird commented May 11, 2018

@cdrage @hangyan Discuss with @hangyan , I change some code for this pr:

  • Ignore short syntax config. Because short syntax config mount path in Deployment must be /, but docker daemon don't allow mount path is /, so we have to ignore it.
  • For long syntax config, if target path is /, ignore this. The reason is similar to above.
  • Add openshift support, thanks @hangyan insist
  • Change document according to @cdrage advice

Now this PR has become a XXL size, very exciting to see that it will be merged.

Thanks all for your review.

@xianlubird xianlubird force-pushed the features/v3.3 branch 2 times, most recently from 64592be to dccb995 Compare May 13, 2018 12:42
@xianlubird
Copy link
Contributor Author

@cdrage
We still have some differences between @hangyan at which service type we should convert.

  • For compose network_mode: vip, according to docker's document link, vip mode is the swarm mode routing mesh, equals to docker service --publish. So user can visit any node ip in the cluster, the address is ip:port. It is especially like NodePort service in kubernetes cluster which user can visit any node ip in the cluster, the address is also ip:port.

  • For compose network_mode: dnsrr. This allow user to visit service name in a container in swarm mode cluster. It's similar to Cluster IP type in kubernetes cluster. For Headless service type, it is very similar to compose attribute external_links.

Now we need @cdrage opinion to push this pr going on. Hope you have time to see this and give us some advice. So we can merge this important pr soon. :-)

Many thanks.

@cdrage
Copy link
Member

cdrage commented May 14, 2018

@xianlubird For NodePort it's actually the user can visit any node port. You still have to figure out the IP. network_mode: vip in my opinion is closer to LoadBalancer.

I agree however with dnsrr.

I will do another review in the next few days!

@xianlubird
Copy link
Contributor Author

xianlubird commented May 18, 2018

@cdrage any update on this ? .........

@hangyan
Copy link
Contributor

hangyan commented May 26, 2018

@xianlubird @cdrage I have re-check the kubernetes documents, it seems like subPath(https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath) can bring the full support for compose config.

@fentas
Copy link

fentas commented Jul 22, 2018

@hangyan any progress?

@cdrage
Copy link
Member

cdrage commented Jul 24, 2018

@hangyan @xianlubird Minor conflicting file, otherwise this LGTM. I can do another review after the conflicted file is resolved!

@xianlubird
Copy link
Contributor Author

@cdrage All check have passed. conflicting solved.

@hangyan
Copy link
Contributor

hangyan commented Jul 26, 2018

@xianlubird As i have point out before, subPath can bring the full support for compose config, otherwise this PR is too limited. @cdrage Or we can merge this first and create a new one to improve it

@cdrage
Copy link
Member

cdrage commented Jul 27, 2018

@hangyan Adding subPath may be best before merging, so that config support is fully supported (short-syntax and all).

Although to be honest, 3.3 support seems to be important as well as endpoint_mode. Maybe we should merge and then open an issue indicating that we should implement subPath / syntax support for config.

@hangyan
Copy link
Contributor

hangyan commented Jul 29, 2018

@cdrage Let's merge this first so we can move on

@cdrage
Copy link
Member

cdrage commented Aug 1, 2018

@hangyan I agree. It's been way too long. Any issues that we encounter in the future can be resolved.

Merging this massive PR.

Special thanks to @xianlubird ! 💯

@cdrage cdrage merged commit 0252213 into kubernetes:master Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants