Hability to filter by protocol, tcp
gitea/docker-discover/pipeline/head This commit looks good
Details
gitea/docker-discover/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c84fafb975
commit
7a91807723
|
@ -1,5 +1,5 @@
|
|||
delay: 4
|
||||
debug: false
|
||||
debug: true
|
||||
events: [service, node]
|
||||
docker:
|
||||
socketPath: /var/run/docker.sock
|
||||
|
|
7
index.js
7
index.js
|
@ -57,9 +57,14 @@ async function updateProxy() {
|
|||
let match = name.match(/^(.+)_main$/);
|
||||
if (match) name = match[1];
|
||||
|
||||
let port = ports[0];
|
||||
let protocol = port.Protocol;
|
||||
|
||||
services.push({
|
||||
name,
|
||||
port: ports[0].PublishedPort
|
||||
port: port.PublishedPort,
|
||||
protocol,
|
||||
tcp: protocol == 'tcp'
|
||||
});
|
||||
}
|
||||
services = services.sort(sortFn);
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
# Auto-generated backends
|
||||
|
||||
{{#each services}}
|
||||
{{#if tcp}}
|
||||
backend {{name}}
|
||||
{{#each ../nodes}}
|
||||
server {{name}}:{{../port}} {{address}}:{{../port}} check
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
|
|
17
test.json
17
test.json
|
@ -4,21 +4,30 @@
|
|||
"Spec": {"Name": "foo"},
|
||||
"Endpoint": {
|
||||
"Ports": [
|
||||
{"PublishedPort": 10001}
|
||||
{
|
||||
"PublishedPort": 10001,
|
||||
"Protocol": "tcp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
"Spec": {"Name": "bar_main"},
|
||||
"Endpoint": {
|
||||
"Ports": [
|
||||
{"PublishedPort": 10003}
|
||||
{
|
||||
"PublishedPort": 10003,
|
||||
"Protocol": "tcp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
"Spec": {"Name": "bar_foo"},
|
||||
"Endpoint": {
|
||||
"Ports": [
|
||||
{"PublishedPort": 10003}
|
||||
{
|
||||
"PublishedPort": 10003,
|
||||
"Protocol": "udp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
|
@ -40,4 +49,4 @@
|
|||
"Status": {"Addr": "10.0.0.3"}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue