Support multi-port service routing for containers running on Marathon
This commit is contained in:
parent
0367034f93
commit
ec3e2c08b8
9 changed files with 498 additions and 134 deletions
|
@ -75,6 +75,13 @@ func (s *MarathonSuite) extendDockerHostsFile(host, ipAddr string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func deployApplication(c *check.C, client marathon.Marathon, application *marathon.Application) {
|
||||
deploy, err := client.UpdateApplication(application, false)
|
||||
c.Assert(err, checker.IsNil)
|
||||
// Wait for deployment to complete.
|
||||
c.Assert(client.WaitOnDeployment(deploy.DeploymentID, 1*time.Minute), checker.IsNil)
|
||||
}
|
||||
|
||||
func (s *MarathonSuite) TestConfigurationUpdate(c *check.C) {
|
||||
// Start Traefik.
|
||||
file := s.adaptFile(c, "fixtures/marathon/simple.toml", struct {
|
||||
|
@ -117,13 +124,28 @@ func (s *MarathonSuite) TestConfigurationUpdate(c *check.C) {
|
|||
Container("emilevauge/whoami")
|
||||
|
||||
// Deploy the test application.
|
||||
deploy, err := client.UpdateApplication(app, false)
|
||||
c.Assert(err, checker.IsNil)
|
||||
// Wait for deployment to complete.
|
||||
c.Assert(client.WaitOnDeployment(deploy.DeploymentID, 1*time.Minute), checker.IsNil)
|
||||
deployApplication(c, client, app)
|
||||
|
||||
// Query application via Traefik.
|
||||
err = try.GetRequest("http://127.0.0.1:8000/service", 30*time.Second, try.StatusCodeIs(http.StatusOK))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
// Create test application with services to be deployed.
|
||||
app = marathon.NewDockerApplication().
|
||||
Name("/whoami").
|
||||
CPU(0.1).
|
||||
Memory(32).
|
||||
AddLabel(types.ServiceLabel(types.LabelFrontendRule, "app"), "PathPrefix:/app")
|
||||
app.Container.Docker.Bridged().
|
||||
Expose(80).
|
||||
Container("emilevauge/whoami")
|
||||
|
||||
// Deploy the test application.
|
||||
deployApplication(c, client, app)
|
||||
|
||||
// Query application via Traefik.
|
||||
err = try.GetRequest("http://127.0.0.1:8000/app", 30*time.Second, try.StatusCodeIs(http.StatusOK))
|
||||
c.Assert(err, checker.IsNil)
|
||||
|
||||
showTraefikLog = false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue