Skip to content

Commit 3a5911e

Browse files
Add support for diagnostics-server to Azure
Signed-off-by: Nathan LeClaire <[email protected]>
1 parent b47c12f commit 3a5911e

File tree

6 files changed

+71
-8
lines changed

6 files changed

+71
-8
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/release/files/custom-data_manager.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ docker run --log-driver=json-file --restart=no -d -e ROLE="$ROLE" -e REGION="$R
2626
docker run --log-driver=json-file --restart=always -d -e ROLE="$ROLE" -e REGION="$REGION" -e TENANT_ID="$TENANT_ID" -e APP_ID="$APP_ID" -e APP_SECRET="$APP_SECRET" -e ACCOUNT_ID="$ACCOUNT_ID" -e GROUP_NAME="$GROUP_NAME" -e PRIVATE_IP="$MANAGER_IP" -e DOCKER_FOR_IAAS_VERSION="$DOCKER_FOR_IAAS_VERSION" -e SWARM_INFO_TABLE="$SWARM_INFO_TABLE" -e SWARM_INFO_STORAGE_ACCOUNT="$SWARM_INFO_STORAGE_ACCOUNT" -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -v /var/log:/var/log docker4x/guide-azure:"$DOCKER_FOR_IAAS_VERSION"
2727
echo default: "$LB_NAME" >> /var/lib/docker/swarm/elb.config
2828
echo "$LB_NAME" > /var/lib/docker/swarm/lb_name
29-
docker run --log-driver=json-file -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/swarm:/var/lib/docker/swarm --name=editions_controller docker4x/l4controller-azure:"$DOCKER_FOR_IAAS_VERSION" run --ad_app_id="$APP_ID" --ad_app_secret="$APP_SECRET" --subscription_id="$SUB_ID" --resource_group="$GROUP_NAME" --log=4 --default_lb_name="$LB_NAME" --environment=AzurePublicCloud
29+
docker run -d --log-driver=json-file -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/swarm:/var/lib/docker/swarm --name=editions_controller docker4x/l4controller-azure:"$DOCKER_FOR_IAAS_VERSION" run --ad_app_id="$APP_ID" --ad_app_secret="$APP_SECRET" --subscription_id="$SUB_ID" --resource_group="$GROUP_NAME" --log=4 --default_lb_name="$LB_NAME" --environment=AzurePublicCloud

azure/templates/editions.template.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,20 @@
342342
"direction": "Inbound"
343343
}
344344
},
345+
{
346+
"name": "diagnostics",
347+
"properties": {
348+
"description": "Allow communication for the diagnostics server",
349+
"protocol": "Tcp",
350+
"sourcePortRange": "*",
351+
"destinationPortRange": "44554",
352+
"sourceAddressPrefix": "[variables('subnetPrefix')]",
353+
"destinationAddressPrefix": "[variables('subnetPrefix')]",
354+
"access": "Allow",
355+
"priority": 205,
356+
"direction": "Inbound"
357+
}
358+
},
345359
{
346360
"name": "docker-port",
347361
"properties": {
@@ -352,7 +366,7 @@
352366
"sourceAddressPrefix": "[variables('subnetPrefix')]",
353367
"destinationAddressPrefix": "[variables('subnetPrefix')]",
354368
"access": "Allow",
355-
"priority": 205,
369+
"priority": 206,
356370
"direction": "Inbound"
357371
}
358372
}

0 commit comments

Comments
 (0)