Merge pull request #168 from emilevauge/add-marathon-basic-authentication
Add basic authentication support in Marathon
This commit is contained in:
commit
587b17c120
4 changed files with 26 additions and 14 deletions
|
@ -18,9 +18,16 @@ type Marathon struct {
|
||||||
Endpoint string
|
Endpoint string
|
||||||
Domain string
|
Domain string
|
||||||
NetworkInterface string
|
NetworkInterface string
|
||||||
|
Basic *MarathonBasic
|
||||||
marathonClient lightMarathonClient
|
marathonClient lightMarathonClient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarathonBasic holds basic authentication specific configurations
|
||||||
|
type MarathonBasic struct {
|
||||||
|
HTTPBasicAuthUser string
|
||||||
|
HTTPBasicPassword string
|
||||||
|
}
|
||||||
|
|
||||||
type lightMarathonClient interface {
|
type lightMarathonClient interface {
|
||||||
Applications(url.Values) (*marathon.Applications, error)
|
Applications(url.Values) (*marathon.Applications, error)
|
||||||
AllTasks(v url.Values) (*marathon.Tasks, error)
|
AllTasks(v url.Values) (*marathon.Tasks, error)
|
||||||
|
@ -32,6 +39,10 @@ func (provider *Marathon) Provide(configurationChan chan<- types.ConfigMessage)
|
||||||
config := marathon.NewDefaultConfig()
|
config := marathon.NewDefaultConfig()
|
||||||
config.URL = provider.Endpoint
|
config.URL = provider.Endpoint
|
||||||
config.EventsInterface = provider.NetworkInterface
|
config.EventsInterface = provider.NetworkInterface
|
||||||
|
if provider.Basic != nil {
|
||||||
|
config.HTTPBasicAuthUser = provider.Basic.HTTPBasicAuthUser
|
||||||
|
config.HTTPBasicPassword = provider.Basic.HTTPBasicPassword
|
||||||
|
}
|
||||||
client, err := marathon.NewClient(config)
|
client, err := marathon.NewClient(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Failed to create a client for marathon, error: %s", err)
|
log.Errorf("Failed to create a client for marathon, error: %s", err)
|
||||||
|
|
|
@ -6,7 +6,7 @@ zk:
|
||||||
ZK_ID: 1
|
ZK_ID: 1
|
||||||
|
|
||||||
master:
|
master:
|
||||||
image: mesosphere/mesos-master:0.23.0-1.0.ubuntu1404
|
image: mesosphere/mesos-master:0.26.0-0.2.145.ubuntu1404
|
||||||
net: host
|
net: host
|
||||||
environment:
|
environment:
|
||||||
MESOS_ZK: zk://127.0.0.1:2181/mesos
|
MESOS_ZK: zk://127.0.0.1:2181/mesos
|
||||||
|
@ -17,7 +17,7 @@ master:
|
||||||
MESOS_WORK_DIR: /var/lib/mesos
|
MESOS_WORK_DIR: /var/lib/mesos
|
||||||
|
|
||||||
slave:
|
slave:
|
||||||
image: mesosphere/mesos-slave:0.23.0-1.0.ubuntu1404
|
image: mesosphere/mesos-slave:0.26.0-0.2.145.ubuntu1404
|
||||||
net: host
|
net: host
|
||||||
pid: host
|
pid: host
|
||||||
privileged: true
|
privileged: true
|
||||||
|
@ -33,7 +33,7 @@ slave:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
marathon:
|
marathon:
|
||||||
image: mesosphere/marathon:v0.9.2
|
image: mesosphere/marathon:v0.13.0
|
||||||
net: host
|
net: host
|
||||||
environment:
|
environment:
|
||||||
MARATHON_MASTER: zk://127.0.0.1:2181/mesos
|
MARATHON_MASTER: zk://127.0.0.1:2181/mesos
|
||||||
|
|
|
@ -10,14 +10,7 @@
|
||||||
"network": "BRIDGE",
|
"network": "BRIDGE",
|
||||||
"portMappings": [
|
"portMappings": [
|
||||||
{ "containerPort": 80, "hostPort": 0, "protocol": "tcp" }
|
{ "containerPort": 80, "hostPort": 0, "protocol": "tcp" }
|
||||||
],
|
]
|
||||||
"parameters": [{
|
|
||||||
"key": "log-driver",
|
|
||||||
"value": "gelf"
|
|
||||||
}, {
|
|
||||||
"key": "log-opt",
|
|
||||||
"value": "gelf-address=udp://172.17.42.1:12201"
|
|
||||||
}]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"healthChecks": [
|
"healthChecks": [
|
||||||
|
@ -32,8 +25,6 @@
|
||||||
],
|
],
|
||||||
"labels": {
|
"labels": {
|
||||||
"traefik.weight": "1",
|
"traefik.weight": "1",
|
||||||
"traefik.protocole": "https",
|
"traefik.protocole": "http"
|
||||||
"traefik.frontend.rule": "Path",
|
|
||||||
"traefik.frontend.value": "/test"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,8 @@
|
||||||
|
|
||||||
# Enable docker TLS connection
|
# Enable docker TLS connection
|
||||||
#
|
#
|
||||||
|
# Optional
|
||||||
|
#
|
||||||
# [docker.tls]
|
# [docker.tls]
|
||||||
# ca = "/etc/ssl/ca.crt"
|
# ca = "/etc/ssl/ca.crt"
|
||||||
# cert = "/etc/ssl/docker.crt"
|
# cert = "/etc/ssl/docker.crt"
|
||||||
|
@ -192,6 +194,14 @@
|
||||||
#
|
#
|
||||||
# filename = "marathon.tmpl"
|
# filename = "marathon.tmpl"
|
||||||
|
|
||||||
|
# Enable Marathon basic authentication
|
||||||
|
#
|
||||||
|
# Optional
|
||||||
|
#
|
||||||
|
# [marathon.basic]
|
||||||
|
# httpBasicAuthUser = "foo"
|
||||||
|
# httpBasicPassword = "bar"
|
||||||
|
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Consul KV configuration backend
|
# Consul KV configuration backend
|
||||||
|
|
Loading…
Add table
Reference in a new issue