Skip to content

Supply daemon address/name on bootstrap/join#20

Merged
stgraber merged 14 commits into
canonical:mainfrom
masnax:daemon-addr
Sep 21, 2022
Merged

Supply daemon address/name on bootstrap/join#20
stgraber merged 14 commits into
canonical:mainfrom
masnax:daemon-addr

Conversation

@masnax
Copy link
Copy Markdown
Contributor

@masnax masnax commented Sep 20, 2022

Previously, the daemon would require a listen address to be supplied in order to start, and the value would not be stored anywhere. A restart would require specifying this address again.

Additionally, the cluster member name for each daemon was generated by its state directory name (for testing, mainly). This was problematic for scripting as each daemon would need a unique state directory name.

To solve both of these problems, this updates the MicroCluster daemon to accept a name and address argument upon bootstrapping or joining a cluster with a token. These values will then be saved in a daemon.yaml file in the state directory.

  • Updates go mod and lxd-generate code to the most recent updates.
  • Supplies a context to helpers from LXD that now require it.
  • As we want to update the name and address of the daemon, this adds a subtype to Remote called Location (similar to LXD Cloud) that holds location information about the node we are dealing with. This does not include Certificate so that we don't face issues unmarshalling an empty value.
  • Adds a setDaemonConfig helper, on the daemon which will either insert a new daemon.yaml if a Location is supplied, or read the current config from the existing yaml.

This allows us to pass configurable Address/Names to a remote without
having to set the certificate. This will be helpful for setting the
initial address/name of the daemon.

Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
In preparation for adding a configurable address/name to the daemon,
this sets state.Address to a function, so we can ensure that the values
are the same between the daemon and the state.

Additionally adds `Name` to the state and daemon.

Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
…f state dir name

Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
…ter_members db helpers

Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
Comment thread example/micro2 Outdated
Comment thread example/test.go Outdated
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
@stgraber stgraber merged commit 66d4888 into canonical:main Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants