Skip to content

Commit e40a20e

Browse files
Merge pull request docker-archive#432 from nathanleclaire/azure_diagnostics_server
Add support for diagnostics-server to Azure
2 parents 0d68e08 + 3a5911e commit e40a20e

File tree

5 files changed

+70
-7
lines changed

5 files changed

+70
-7
lines changed

aws/dockerfiles/files/bin/docker-diagnose

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,54 @@
11
#!/bin/sh
22

3+
set -e
4+
35
DIAGNOSTICS_MAGIC_PORT=44554
4-
NODES=$(docker node inspect $(docker node ls -q) | jq -r '.[] | .Description.Hostname' | tr '\n' ' ')
6+
7+
platform()
8+
{
9+
# TODO: This will need to be changed if the current configuration of
10+
# system containers are not invoked via 'docker run' anymore
11+
#
12+
# (and/or might be more elegant to pass in the platform via environment
13+
# variables, etc.)
14+
PLATFORM=$(docker images | grep aws)
15+
if [ $? -eq 0 ]
16+
echo "aws"
17+
then
18+
echo "azure"
19+
fi
20+
}
21+
22+
node_hostnames()
23+
{
24+
docker node inspect $(docker node ls -q) | jq -r '.[] | .Description.Hostname'
25+
}
26+
27+
azure_resolver()
28+
{
29+
# Sample /etc/resolv.conf on Azure:
30+
#
31+
# # Generated by dhcpcd from eth0.dhcp
32+
# # /etc/resolv.conf.head can replace this line
33+
# domain zopqyteo2tpuxc1cyzroivpijh.gx.internal.cloudapp.net
34+
# nameserver 168.63.129.16
35+
# # /etc/resolv.conf.tail can replace this line
36+
#
37+
cat /etc/resolv.conf | grep domain | awk '{ print $2; }'
38+
}
39+
40+
if [ "$(platform)" = "aws" ]
41+
then
42+
NODES=$(node_hostnames)
43+
else
44+
# We need to append to the hostnames with the DNS resolver address, or
45+
# else they won't resolve properly.
46+
#
47+
# We could potentially modify swarm to accept a "hostname" (more
48+
# properly nodename) type flag on join, but no such option seems
49+
# available today.
50+
NODES=$(node_hostnames | sed -e "s/$/.$(azure_resolver)/")
51+
fi
552

653
# Session is set to a pseudo-random string combined with the current timestamp.
754
# This should minimize the probability of collision while also providing

azure/dockerfiles/walinuxagent/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN apk add --no-cache --update \
2020

2121
# Windows Azure Linux agent section
2222
RUN pip install pyasn1
23-
ENV AGENT_REVISION ef3d68857cf08b65bbe7dfeb7a811cc9f1aa5bc1
23+
ENV AGENT_REVISION 5d66b1c923fcccf1f00b6004627f7f3d46172142
2424

2525
# TODO: Move back to upstream (a PR is out for this on the Azure agent --
2626
# https://github.com/Azure/WALinuxAgent/pull/341), for now we have to use this
@@ -35,7 +35,7 @@ RUN cp bin/* /usr/sbin/
3535
# TODO: If upstream shell Dockerfile changes this will also need to be changed.
3636
# Should be implemented more elegantly.
3737
RUN mkdir /daemons && \
38-
mv /entry.sh /daemons/sshd-entrypoint.sh && \
38+
rm /entry.sh && \
3939
mv /etc/ssh/sshd_config /opt/sshd_config && \
4040
mv /etc/motd /opt/motd
4141

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
TAG := latest
2+
13
default: build
24

35
build:
4-
docker build -t docker4x/agent-azure .
6+
docker build -t docker4x/agent-azure:$(TAG) .
57

68
push: build
7-
docker push docker4x/agent-azure
9+
docker push docker4x/agent-azure:$(TAG)

azure/dockerfiles/walinuxagent/supervisord.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ user=root
1111
childlogdir=/var/log/
1212

1313
[program:sshd]
14-
command=bash -c "sleep 5; /daemons/sshd-entrypoint.sh /usr/sbin/sshd -D -f /etc/ssh/sshd_config"
14+
command=bash -c "sleep 5; /usr/sbin/sshd -D -f /etc/ssh/sshd_config"
1515
startretries=100
1616
autorestart=true
1717

azure/templates/editions.template.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,20 @@
350350
"direction": "Inbound"
351351
}
352352
},
353+
{
354+
"name": "diagnostics",
355+
"properties": {
356+
"description": "Allow communication for the diagnostics server",
357+
"protocol": "Tcp",
358+
"sourcePortRange": "*",
359+
"destinationPortRange": "44554",
360+
"sourceAddressPrefix": "[variables('subnetPrefix')]",
361+
"destinationAddressPrefix": "[variables('subnetPrefix')]",
362+
"access": "Allow",
363+
"priority": 205,
364+
"direction": "Inbound"
365+
}
366+
},
353367
{
354368
"name": "docker-port",
355369
"properties": {
@@ -360,7 +374,7 @@
360374
"sourceAddressPrefix": "[variables('subnetPrefix')]",
361375
"destinationAddressPrefix": "[variables('subnetPrefix')]",
362376
"access": "Allow",
363-
"priority": 205,
377+
"priority": 206,
364378
"direction": "Inbound"
365379
}
366380
}

0 commit comments

Comments
 (0)