-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support AWS, implement dry-run and quiet modes
- Loading branch information
Showing
10 changed files
with
518 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,103 @@ | ||
# cloud-floating-ip | ||
|
||
NOT YET READY. | ||
Implement a floating IP by modifying GCP or AWS routes. | ||
|
||
Implement a floating IP by modifying GCE or AWS routes. | ||
## Usage | ||
|
||
## Build | ||
All ec2/gce instances that may carry the floating IP (become "primary") | ||
should be allowed to route traffic: SourceDestCheck (EC2) or canIpForward | ||
(GCE) must be enabled. | ||
|
||
Assuming you have go 1.9 and glide in the path, and GOPATH configured: | ||
Those instances should accept the traffic to the floating IP. The IP may | ||
be assigned to a loopback or a dummy interface on all instances: | ||
|
||
```shell | ||
make deps | ||
make build | ||
```bash | ||
ip link add dummy0 type dummy | ||
ip address add 10.200.0.50/32 dev dummy0 | ||
``` | ||
|
||
## Usage | ||
To route the floating IP to the current instance (which becomes "primary"): | ||
```bash | ||
# see what would be changed | ||
cloud-floating-ip -i 10.200.0.50 --dry-run preempt | ||
|
||
# apply the change | ||
cloud-floating-ip -i 10.200.0.50 preempt | ||
``` | ||
|
||
The IP can be preempted, using the same `preempt` command, by other | ||
instances in the VPC. | ||
|
||
To verify the status ("primary" or "standby") of any instance: | ||
```bash | ||
cloud-floating-ip -i 10.200.0.50 status | ||
``` | ||
|
||
To store the configuration (avoid those repetitive `-i ...` arguments): | ||
```bash | ||
cat<<EOF > /etc/cloud-floating-ip.yaml | ||
ip: 10.200.0.50 | ||
quiet: true | ||
EOF | ||
``` | ||
|
||
## Options | ||
|
||
The --ip argument is mandatory. Other settings can be collected from | ||
instance's metadata (and instance profile or service account) when | ||
running from an AWS or GCE instance. | ||
|
||
|
||
``` | ||
Usage: | ||
cloud-floating-ip [flags] | ||
cloud-floating-ip [command] | ||
Available Commands: | ||
destroy Delete the routes managed by cloud-floating-ip | ||
help Help about any command | ||
preempt Preempt an IP address and route it to the instance | ||
status Display the status of the instance (owner or standby) | ||
Flags: | ||
-c, --config string config file (default is /etc/cloud-floating-ip.yaml) | ||
-i, --ip string IP address | ||
-d, --dry-run dry-run mode | ||
-q, --quiet quiet mode | ||
-h, --help help for cloud-floating-ip | ||
-o, --hoster string hosting provider (aws or gce) | ||
-t, --instance string instance name | ||
-m, --ignore-main-table (AWS) ignore routes in main table | ||
-a, --aws-access-key-id string (AWS) access key Id | ||
-k, --aws-secret-key string (AWS) secret key | ||
-p, --project string (GCP) project id | ||
-r, --region string (AWS) region name | ||
-z, --zone string (GCP) zone name | ||
``` | ||
|
||
## Required privileges | ||
|
||
On EC2, the account running `cloud-floating-ip` must have the following rights: | ||
``` | ||
ec2:DescribeInstances | ||
ec2:CreateRoute | ||
ec2:DescribeRouteTables | ||
ec2:ReplaceRoute | ||
ec2:DeleteRoute | ||
``` | ||
|
||
On GCE: | ||
``` | ||
compute.routes.get | ||
compute.routes.create | ||
compute.routes.delete | ||
compute.instances.get | ||
container.operations.get | ||
container.operations.list | ||
``` | ||
|
||
## Limitations | ||
|
||
* `cloud-floating-ip` does not support instances with multiple interfaces in the VPC yet. | ||
* On GCE, `cloud-floating-ip` won't remove already created, pre-existing routes with a custom name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.