Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor DHCP relay docker in sonicv2 style #217

Merged
merged 7 commits into from
Jan 27, 2017
6 changes: 4 additions & 2 deletions dockers/docker-dhcp-relay/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ RUN apt-get update \
&& apt-get autoclean -y \
&& apt-get autoremove -y

COPY isc-dhcp-relay /etc/default/isc-dhcp-relay
COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"]
COPY ["config.sh", "/usr/bin/"]

ENTRYPOINT service rsyslog start \
ENTRYPOINT /usr/bin/config.sh \
&& service rsyslog start \
&& service isc-dhcp-relay start \
&& /bin/bash

4 changes: 4 additions & 0 deletions dockers/docker-dhcp-relay/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/dhcp_relay.yml -t /usr/share/dhcp-relay/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay

6 changes: 0 additions & 6 deletions dockers/docker-dhcp-relay/isc-dhcp-relay

This file was deleted.

7 changes: 7 additions & 0 deletions dockers/docker-dhcp-relay/isc-dhcp-relay.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SERVERS="{{ dhcp_servers | join(' ') }}"

INTERFACES="{{ minigraph_vlan_interfaces | join(' ') }}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only generate this for the tor device?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This template will only be used to generate the config file if the docker is deployed and started, which will only occur if the device is a ToR. The actual decision on whether or not to deploy the docker will be controlled by the mgmt repo. I felt that logic was best left out of the docker itself.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, since we are in the process to build one image (an image that can be deployed to the field) without any controller by the mgmt repo.

but I agree with you to let this outside the docker, so we can do this in the base image to decide whether to start this docker or not.


# '-a' option provides option 82 circuit id information
OPTIONS="-a"