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

Vault-driven Consul TTL checks #1349

Merged
merged 21 commits into from Apr 26, 2016
Merged

Vault-driven Consul TTL checks #1349

merged 21 commits into from Apr 26, 2016

Commits on Apr 26, 2016

  1. Comment nits

    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    f2dc2f6 View commit details
    Browse the repository at this point in the history
  2. Stub out service discovery functionality

    Hook asynchronous notifications into Core to change the status of vault based on its active/standby, and sealed/unsealed status.
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    bd5305e View commit details
    Browse the repository at this point in the history
  3. Update vendor'ed version of hashicorp/consul/lib

    Note: Godeps.json not updated
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    0d3ce59 View commit details
    Browse the repository at this point in the history
  4. Teach Vault how to register with Consul

    Vault will now register itself with Consul.  The active node can be found using `active.vault.service.consul`.  All standby vaults are available via `standby.vault.service.consul`.  All unsealed vaults are considered healthy and available via `vault.service.consul`.  Change in status and registration is event driven and should happen at the speed of a write to Consul (~network RTT + ~1x fsync(2)).
    
    Healthy/active:
    
    ```
    curl -X GET 'http://127.0.0.1:8500/v1/health/service/vault?pretty' && echo;
    [
        {
            "Node": {
                "Node": "vm1",
                "Address": "127.0.0.1",
                "TaggedAddresses": {
                    "wan": "127.0.0.1"
                },
                "CreateIndex": 3,
                "ModifyIndex": 20
            },
            "Service": {
                "ID": "vault:127.0.0.1:8200",
                "Service": "vault",
                "Tags": [
                    "active"
                ],
                "Address": "127.0.0.1",
                "Port": 8200,
                "EnableTagOverride": false,
                "CreateIndex": 17,
                "ModifyIndex": 20
            },
            "Checks": [
                {
                    "Node": "vm1",
                    "CheckID": "serfHealth",
                    "Name": "Serf Health Status",
                    "Status": "passing",
                    "Notes": "",
                    "Output": "Agent alive and reachable",
                    "ServiceID": "",
                    "ServiceName": "",
                    "CreateIndex": 3,
                    "ModifyIndex": 3
                },
                {
                    "Node": "vm1",
                    "CheckID": "vault-sealed-check",
                    "Name": "Vault Sealed Status",
                    "Status": "passing",
                    "Notes": "Vault service is healthy when Vault is in an unsealed status and can become an active Vault server",
                    "Output": "",
                    "ServiceID": "vault:127.0.0.1:8200",
                    "ServiceName": "vault",
                    "CreateIndex": 19,
                    "ModifyIndex": 19
                }
            ]
        }
    ]
    ```
    
    Healthy/standby:
    
    ```
    [snip]
            "Service": {
                "ID": "vault:127.0.0.2:8200",
                "Service": "vault",
                "Tags": [
                    "standby"
                ],
                "Address": "127.0.0.2",
                "Port": 8200,
                "EnableTagOverride": false,
                "CreateIndex": 17,
                "ModifyIndex": 20
            },
            "Checks": [
                {
                    "Node": "vm2",
                    "CheckID": "serfHealth",
                    "Name": "Serf Health Status",
                    "Status": "passing",
                    "Notes": "",
                    "Output": "Agent alive and reachable",
                    "ServiceID": "",
                    "ServiceName": "",
                    "CreateIndex": 3,
                    "ModifyIndex": 3
                },
                {
                    "Node": "vm2",
                    "CheckID": "vault-sealed-check",
                    "Name": "Vault Sealed Status",
                    "Status": "passing",
                    "Notes": "Vault service is healthy when Vault is in an unsealed status and can become an active Vault server",
                    "Output": "",
                    "ServiceID": "vault:127.0.0.2:8200",
                    "ServiceName": "vault",
                    "CreateIndex": 19,
                    "ModifyIndex": 19
                }
            ]
        }
    ]
    ```
    
    Sealed:
    
    ```
            "Checks": [
                {
                    "Node": "vm2",
                    "CheckID": "serfHealth",
                    "Name": "Serf Health Status",
                    "Status": "passing",
                    "Notes": "",
                    "Output": "Agent alive and reachable",
                    "ServiceID": "",
                    "ServiceName": "",
                    "CreateIndex": 3,
                    "ModifyIndex": 3
                },
                {
                    "Node": "vm2",
                    "CheckID": "vault-sealed-check",
                    "Name": "Vault Sealed Status",
                    "Status": "critical",
                    "Notes": "Vault service is healthy when Vault is in an unsealed status and can become an active Vault server",
                    "Output": "Vault Sealed",
                    "ServiceID": "vault:127.0.0.2:8200",
                    "ServiceName": "vault",
                    "CreateIndex": 19,
                    "ModifyIndex": 38
                }
            ]
    ```
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    c0bbeba View commit details
    Browse the repository at this point in the history
  5. go fmt the PostgreSQL backend

    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    afa6c22 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c92f9cb View commit details
    Browse the repository at this point in the history
  7. Detect type conversion failure

    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    e54c990 View commit details
    Browse the repository at this point in the history
  8. Improve error handling re: homedir expansion

    Useful if the HOME envvar is not set because `vault` was launched in a clean environment (e.g. `env -i vault ...`).
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    9a21151 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    40a3c53 View commit details
    Browse the repository at this point in the history
  10. Various refactoring to clean up code organization

    Brought to you by: Dept of 2nd thoughts before pushing enter on `git push`
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    53dd436 View commit details
    Browse the repository at this point in the history
  11. Use spaces in tests to be consistent

    The rest of the tests here use spaces, not tabs
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    3e43da2 View commit details
    Browse the repository at this point in the history
  12. Consistently skip Consul checks

    Hide all Consul checks behind `CONSUL_HTTP_ADDR` env vs `CONSUL_ADDR` which is non-standard.
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    1601508 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    529f3e5 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    38a3ea3 View commit details
    Browse the repository at this point in the history
  15. Add a small bit of wording re: disable_registration

    Consul service registration for Vault requires Consul 0.6.4.
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    f1c170e View commit details
    Browse the repository at this point in the history
  16. Persistently retry to update service registration

    If the local Consul agent is not available while attempting to step down from active or up to active, retry once a second.  Allow for concurrent changes to the state with a single registration updater.  Fix standby initialization.
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    f4e1594 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    85ca7b3 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    9647f2e View commit details
    Browse the repository at this point in the history
  19. Change to the pre-0.6.4 Consul Check API

    Consul is never going to pass in more than 1K of output.  This mitigates the pre-0.6.4 concern.
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    341abca View commit details
    Browse the repository at this point in the history
  20. Change to the pre-0.6.4 Consul Check API

    Consul is never going to pass in more than 1K of output.  This mitigates the pre-0.6.4 concern.
    sean- committed Apr 26, 2016
    Configuration menu
    Copy the full SHA
    00d1e5a View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    4db1635 View commit details
    Browse the repository at this point in the history