Code Monkey home page Code Monkey logo

Comments (4)

gfdsa avatar gfdsa commented on August 30, 2024

The SSH-ing does only one thing there, it replaces the consul.hcl.tmpl with one that contains a placeholder for the token:

   {{ with secret "consul/creds/consul-agent-role" }}tokens = { default = "{{ .Data.token }}" }{{ end }}

this can already be done in the consul-cluster. The consul-server.hcl.tmpl there is not being used until the vault-agent auto-authenticates. At which point it already has access to consul/role/... backend and can replace the token.
As soon as the token is there, the consul watcher should take care of restarting it.
This is the shady part:

"while [ \"$(curl -s 'http://127.0.0.1:8500/v1/status/peers' | jq '. | length')\" != \"3\"  ]; do echo \"Consul: no enough peers\"; sleep 3; done",

What the purpose of it and can we move to the consul watcher @efbar ? There is already a 60s sleep before the restart and we can add this waiter too before or after the restart with a sane TTL.

from caravan-platform.

efbar avatar efbar commented on August 30, 2024

That "wait_and_restart" part was added due to the fact that we had to be sure that a complete (number of nodes) cluster is formed before restart vault-agent and nomad. The culprit was that if you have a not complete cluster formed, with tokens and ca applied, you cannot add the last lonely node without acting through api or stuff like that.
Without that "wait and restart", at the end of the platform automation, you could have a not complete and unstable consul cluster going up and down.

from caravan-platform.

gfdsa avatar gfdsa commented on August 30, 2024

Which probably happens because the vault's cluster backend is not available so the vault-agent can't get a token so only one node has time to reload with token. I get it. We should try to move this waiting to the restarter then and we should be all set.

from caravan-platform.

efbar avatar efbar commented on August 30, 2024

Probably it could involve also the gcp auth too (and in this case it could be also google fault). Anyway you got the point: that "wait" is a sort buffer time for the right alignment of the consul cluster.

from caravan-platform.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.