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 mesos provider inspired by mesos-dns & marathon provider #353

Merged
merged 1 commit into from
Jul 20, 2016

Conversation

skydjol
Copy link
Contributor

@skydjol skydjol commented May 4, 2016

Backend Implementation Proposal

We use Marathon, Chronos and homemade Framework on Mesos, and we want to have a universal backend to manage both.

The Marathon backend works well, and we, first, want to implement a Chronos Backend. But Chronos don't manage callback as Marathon. And what about our handmade Mesos Framework ?

So we decide to lookup in the Mesos DNS code (https://github.com/mesosphere/mesos-dns) to see how callbacks are managed in Mesos.
Mesos DNS uses a pull mecanism (https://github.com/mesosphere/mesos-dns/blob/master/records%2Fgenerator.go#L190) to check every changes.

We think that having a unified backend for Mesos is a very good point (because we don't know all Mesos frameworks we'll using in the future) using same behavior as Mesos DNS.

It's our first time we use Go (and we don't have yet a correct IDE integration for now ... ), so we hope this pull request is good and we don't commit huge mistakes ...
We add this project in our travis instance (https://travis-ci.org/saagie/traefik) and the build passes (of course we generate a binary and test it on our machines).
The only things we don't do is ... tests. Shame on us ... But we follow the Commit Strip principle : http://www.commitstrip.com/shop/fr/affiches/11-affiche-tester-c-est-douter.html .
But it's not easy when your dev env is not fully OK.

Don't hesitate if you have any remarks or questions.

BTW : Your TiA at DevoxxFR was very good and it's after this we decide to test traefik

@emilevauge
Copy link
Member

Hi @skydjol, thanks a lot !
There is currently an issue with travis on go cross compilations. I need to investigate on it before reviewing your PR.

@emilevauge
Copy link
Member

You can now rebase to master to get travis working again ;) The issue was in https://github.com/mitchellh/gox.

@skydjol
Copy link
Contributor Author

skydjol commented May 5, 2016

Hi,
I rebase and now travis built correctly.
;-)

if sj, err = provider.loadWrap(ip, port); err == nil && sj.Leader != "" {
return sj, nil
}
log.Debugf("Warning: Zookeeper is wrong about leader")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe log.Warn here?

@emilevauge
Copy link
Member

emilevauge commented May 7, 2016

Hey @skydjol, what a great PR :)
Here are few comments:

  • I find a bit confusing the naming of loadWrap.
  • the code located in provider/mesos/ has been directly copied from https://github.com/mesosphere/mesos-dns. This is not a good idea ;) Could you reuse it importing the project as a dependency instead?
  • It would be really great to have unit-tests (like those in integration/), and if possible, integration tests (in integration/) on this. The test environment is entirely in Docker, you should get it working easily. If not, of course, we would be glad to help on this :)
  • a bit of documentation (in docs/)?
    Again, thanks a lot for your great contribution :)

@vdemeester, any comments?

@emilevauge
Copy link
Member

@skydjol WDYT?

@PierreLeresteux
Copy link

Hi Emile,
I work with @skydjol and we talk a lot about your answer. We don't have enough time now to do one of all ... but we don't forget this PR ... Hope the next week, we'll work on it.

We'll try to focus on mesos-dns import as depencency , documentation then tests ... First, we'll retry to have a fully work env for Go ... If we fail, we'll ask you :)

@PierreLeresteux
Copy link

Hi Emile,

I've added some Unit and Integration tests (based on the work done for Marathon).

I, also, renamed the "loadWrap" method to explain a little bit more.

To integrate the "mesos-dns" dependency, we have some errors because some of visibility of some functions in mesos-dns. Moreover we integrate the healthy feature (and maybe other).

One more thing to do is documentation (and test in "real situation" after the master branch merge).

@emilevauge
Copy link
Member

Hi @PierreLeresteux, thanks for your work :)
As I said, I will not merge this one while taking all that code from mesos-dns project.
May I suggest to make a PR on this mesos-dns fork instead: https://github.com/containous/mesos-dns ?
WDYT?

@PierreLeresteux
Copy link

Hi Emile ... We'll try to do this today.

It sounds very interresting...

@skydjol skydjol force-pushed the feature/mesos branch 3 times, most recently from 1c36552 to 2ac68bf Compare June 17, 2016 11:53
@emilevauge emilevauge added this to the 1.1 milestone Jun 18, 2016
@emilevauge
Copy link
Member

Thanks a lot @PierreLeresteux :)
If you don't mind, this PR will be merged after the 1.0.0 release as we are already in RC2 :)

- package: github.com/jarcoal/httpmock
- package: github.com/mesosphere/mesos-dns
vcs: git
repo: https://github.com/saagie/mesos-dns.git
Copy link
Member

Choose a reason for hiding this comment

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

Could you change it to github.com/containous/mesos-dns ?

@emilevauge
Copy link
Member

Hi @skydjol & @PierreLeresteux, I made few comments :)
@containous/traefik could you also review this one?

@PierreLeresteux
Copy link

Hi @emilevauge . Last friday, I've commited some modifications regarding your comments. My travis said it's ok, but on this PR, strange behavior, travis seems to be unhappy ... (mark "In progress", but when I jump to see more details, the status is marked as broken ... )

Let me know if you or someone else in the team have some remarks on this PR.

@PierreLeresteux
Copy link

Regarding your comments @errm , I make some changes (My bad for "marathon")

@errm
Copy link
Contributor

errm commented Jul 12, 2016

Awesome LGTM

@emilevauge
Copy link
Member

Thanks @errm for the review :) Thanks @PierreLeresteux for the fixes.
As this PR is quite big, I will wait for another review from @vdemeester before merging ;)

@@ -272,9 +273,16 @@ func NewTraefikDefaultPointersConfiguration() *TraefikConfiguration {
//default Kubernetes
var defaultKubernetes provider.Kubernetes
defaultKubernetes.Watch = true
defaultKubernetes.Endpoint = "http://127.0.0.1:8080"
defaultKubernetes.Endpoint = "127.0.0.1:8080"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hum, this change doesn't seem realetd…

@vdemeester
Copy link
Contributor

Few nits and I feel there is room for improvement (in few places)
But overall LGTM 🐸

This is really cool 👍

@emilevauge
Copy link
Member

Ping ?

@PierreLeresteux
Copy link

Hi, we've pushed some modifications regarding the comment from @vdemeester ...

Is it ok for you now ?

@emilevauge
Copy link
Member

On last thing, could you squash your commits ? 19 commits is a bit too much and we want to avoid Merge branch 'master' ... in history ;)
Thanks a lot for this great contribution 🎉 !

@PierreLeresteux
Copy link

Hi, sure ... here is a one commit for this feature ...
Hope it'll be a part of the "camembert" 1.1 version of Traefik ('cause we're Normands)

@emilevauge
Copy link
Member

Thanks a lot @PierreLeresteux @skydjol for you great contribution 👏
LGTM :)

Hope it'll be a part of the "camembert" 1.1 version of Traefik ('cause we're Normands)

Let the cheese lobbying start ^^
camembert-de-normandie-rustique

@emilevauge emilevauge merged commit 8e333d0 into traefik:master Jul 20, 2016
@ldez ldez mentioned this pull request Jun 11, 2017
ldez added a commit to ldez/traefik that referenced this pull request Jun 12, 2017
`golang/glog` is used by:
- `github.com/mesos/mesos-go` (no version)
- `k8s.io/client-go` (`44145f04b68cf362d9c4df2182967c2275eaefed`)

In traefik#353 (add Mesos provider, 20 Jul 2016), the `golang/glog` hash is `fca8c8854093a154ff1eb580aae10276ad6b1b5f`.

The problem appear in traefik#836 (use k8s client, 1 Dec 2016).

Refs:
- Traefik:
  - traefik#836
  - traefik@131f581
- Glog
  - https://github.com/golang/glog/commits/master
  - golang/glog#13
  - golang/glog@44145f0
  - golang/glog@fca8c88
- k8s
  - https://github.com/kubernetes/client-go/blob/e121606b0d09b2e1c467183ee46217fa85a6b672/Godeps/Godeps.json
  - https://github.com/kubernetes/client-go/blob/master/Godeps/Godeps.json
ldez added a commit that referenced this pull request Jun 12, 2017
`golang/glog` is used by:
- `github.com/mesos/mesos-go` (no version)
- `k8s.io/client-go` (`44145f04b68cf362d9c4df2182967c2275eaefed`)

In #353 (add Mesos provider, 20 Jul 2016), the `golang/glog` hash is `fca8c8854093a154ff1eb580aae10276ad6b1b5f`.

The problem appear in #836 (use k8s client, 1 Dec 2016).

Refs:
- Traefik:
  - #836
  - 131f581
- Glog
  - https://github.com/golang/glog/commits/master
  - golang/glog#13
  - golang/glog@44145f0
  - golang/glog@fca8c88
- k8s
  - https://github.com/kubernetes/client-go/blob/e121606b0d09b2e1c467183ee46217fa85a6b672/Godeps/Godeps.json
  - https://github.com/kubernetes/client-go/blob/master/Godeps/Godeps.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants