Skip to content

Commit

Permalink
Clarify doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bpineau committed Mar 15, 2018
1 parent e49d859 commit 12ab667
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
# cloud-floating-ip

Implement a floating IP by modifying GCP or AWS routes.
Implement a floating/virtual IP by modifying GCP or AWS routes.

## Usage

All ec2/gce instances that may carry the floating IP (become "primary")
should be allowed to route traffic: SourceDestCheck (EC2) or canIpForward
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.

Those instances should accept the traffic to the floating IP. The IP may
Those instances should accept the traffic to the floating IP, which may
be assigned to a loopback or a dummy interface on all instances:

```bash
ip link add dummy0 type dummy
ip address add 10.200.0.50/32 dev dummy0
```

To route the floating IP to the current instance (which becomes "primary"):
To route the floating IP to the current instance (becomes "primary"):
```bash
# see what would be changed
cloud-floating-ip -i 10.200.0.50 --dry-run preempt
# see what would change
cloud-floating-ip -i 10.200.0.50 preempt --dry-run

# apply the change
# apply the changes
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.
The IP can be preempted by other instances in the VP, by using the same
`preempt` command.

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):
To store the configuration (and get rid of repetitive `-i ...` arguments):
```bash
cat<<EOF > /etc/cloud-floating-ip.yaml
ip: 10.200.0.50
Expand All @@ -43,10 +43,14 @@ EOF

## Options

The --ip argument is mandatory. Other settings can be collected from
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.

Those settings can be stored in the `/etc/cloud-floating-ip.yaml`
configuration file. Or pass them through environments (upper case,
prefixed by `CFI_`).


```
Usage:
Expand All @@ -70,8 +74,8 @@ Flags:
-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
-p, --project string (GCP) project id
-z, --zone string (GCP) zone name
```

Expand All @@ -80,18 +84,18 @@ Flags:
On EC2, the account running `cloud-floating-ip` must have the following rights:
```
ec2:DescribeInstances
ec2:CreateRoute
ec2:DescribeRouteTables
ec2:CreateRoute
ec2:ReplaceRoute
ec2:DeleteRoute
```

On GCE:
```
compute.instances.get
compute.routes.get
compute.routes.create
compute.routes.delete
compute.instances.get
container.operations.get
container.operations.list
```
Expand Down

0 comments on commit 12ab667

Please sign in to comment.