Make nameserver overridable for provider
Adds a flag to the provider command that allows to override the default nameserver in for example the systemd unit file for faasd-provider.
Description
Added a single string flag to cmd/provider.go called nameserver.
That flag has a default value of 8.8.8.8 and will get used when resolve.conf created later in the source.
Motivation and Context
- [X] I have raised an issue to propose this change this is required
Will probably solve #174 and #176. Edit: made my own issue #181
How Has This Been Tested?
I ran the test provided in the code.
Built a version of it and deployed to my raspberry pi instance of faasd.
Then I modified the unit file /usr/lib/systemd/system/faasd-provider.service and restarted everything.
[Unit]
Description=faasd-provider
[Service]
MemoryLimit=500M
Environment="secret_mount_path=/var/lib/faasd/secrets"
Environment="basic_auth=true"
ExecStart=/usr/local/bin/faasd provider --nameserver 172.16.10.252
Restart=on-failure
RestartSec=10s
WorkingDirectory=/var/lib/faasd-provider
[Install]
WantedBy=multi-user.target
Then I deployed a function that looked up a database server using a hostname that is only resolvable from the defined internal DNS and everything worked.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
Commits:
- [X] I've read the CONTRIBUTION guide
- [X] My commit message has a body and describe how this was tested and why it is required.
- [X] I have signed-off my commits with
git commit -sfor the Developer Certificate of Origin (DCO)
Code:
- [X] My code follows the code style of this project.
- [ ] I have added tests to cover my changes.
Docs:
- [X] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
I think if you are already doing a remake for the resolve.conf for the sake of stability we should include a fallback nameserver.
What do you think about this @kmpm , @alexellis ?
Commented @Shikachuu
The suggestions are great. Will probably get to it this weekend.