-
Notifications
You must be signed in to change notification settings - Fork 672
Conversation
@errordeveloper Can you have a look and review this, please? it is for the use case we discussed where weaveDNS is being used without the weave SDN, but I think it might be useful in other circumstances also. |
Why do you want to make IP addresses for containers outside the weave network resolvable in the weave domain? |
# This function is only called where we know $2 is a valid container name | ||
tell_dns() { | ||
METHOD="$1" | ||
CONTAINER_ID="$2" | ||
shift 2 | ||
|
||
collect_cidr_args "$@" | ||
shift $CIDR_COUNT |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Is Also, surely there should be an inverse operation. |
NB: this partially addresses #364. Note the major caveat listed there: all these "manually" inserted records are lost on weavedns restart. Nevertheless, I suggest that this PR closes #364, and that we open separate issues for the two remaining points identified there (lossy restart, and lack of support for CNAMEs). |
@rade @errordeveloper For the inverse, I assume I just call |
@rade How about |
e115e97
to
9adad5d
Compare
You should have to worry about the FQDN. After all, what if you have one IP under multiple names and want to remove just one of records? However, it looks like this functionality is missing from the DNS API. |
I pass in the domain name inside |
@@ -28,6 +28,8 @@ usage() { | |||
echo "weave start <cidr> [<cidr> ...] <container_id>" | |||
echo "weave attach <cidr> [<cidr> ...] <container_id>" | |||
echo "weave detach <cidr> [<cidr> ...] <container_id>" | |||
echo "weave add-dns <cidr> [<cidr> ...] <container_id> [-fqdn fqdn]" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
still not sure about the command names. |
@rade happy to change to |
Let's see what other suggestions come up from interested bike shed painters. |
OK, I have left it as Thanks for taking the time to review this @rade |
1568ddd
to
46ca784
Compare
I added a test script (called |
Are
|
Just discussing with @squaremo - further to this line of thought we could contextualise the existing router commands:
obviously we'd still support the existing script commands, but they would become deprecated - this would allow us to address #602 cleanly... |
I like @awh proposal. I think we should move to a format like weave |
let's go with |
|
||
```bash | ||
$ docker stop $shell2 | ||
$ weave dns-remove 10.2.1.27/24 $shell2 |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
265e1d1
to
d6f9410
Compare
@rade should be ready to merge, rebased and sqashed, with tests passing |
weave dns-add/remove
commands
|
||
weave_on $HOST1 dns-remove $C2/24 c2 | ||
|
||
assert_raises "exec_on $HOST1 c1 getent hosts $C2 | grep $NAME" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
I suspect this is going to make things a fair bit more involved since all the existing functions you are calling expect CIDRs. :( |
weave_on $HOST1 dns-add $C2/24 c2 -h $NAME2 | ||
weave_on $HOST1 dns-remove $C2/24 c2 | ||
|
||
assert_raises "exec_on $HOST1 c1 getent hosts $NAME2 | grep $C2" 1 |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
0ec9b63
to
457866f
Compare
@rade try again 🐨 this has IP addresses instead of CIDRs and improved tests as suggested. |
457866f
to
2fee13c
Compare
@@ -97,6 +99,32 @@ collect_cidr_args() { | |||
fi | |||
} | |||
|
|||
is_ip() { | |||
# The regexp here is far from precise, but good enough. | |||
echo "$1" | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' >/dev/null |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
61dabd7
to
8fad155
Compare
- Commands dns-add and dns-remove added to weave script - Updated documentation for WeaveDNS - Added test script for dns-add and dns-remove - Added IP address functions matching existing CIDR ones
8fad155
to
633d539
Compare
@rade we'll get there eventually... thanks again for helping me get this straightened out |
add `weave dns-add/remove` commands Closes #364.
@grkvlt thanks for your patience. Merged. |
Added two new commands
dns-add
anddns-remove
that call thetell_dns
function method to store addresses and optionally a specific FQDN for a container ID.This is useful for circumstances where containers may be configured with IP addresses outside weave, perhaps by some contaienr orchestration service or using a different SDN, but those addresses should still be resolvable and usable by the weaveDNS.