[lxc-devel] [lxd/master] lxd/cluster: Initialize candid on join

stgraber on Github lxc-bot at linuxcontainers.org
Wed Mar 20 18:49:18 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190320/a08acb87/attachment.bin>
-------------- next part --------------
From 3447e0b9cf8628203844248b248276205a655a60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 20 Mar 2019 11:48:43 -0700
Subject: [PATCH] lxd/cluster: Initialize candid on join
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/api_cluster.go | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/lxd/api_cluster.go b/lxd/api_cluster.go
index 1ef38eee0a..3a5c5dfeea 100644
--- a/lxd/api_cluster.go
+++ b/lxd/api_cluster.go
@@ -494,10 +494,7 @@ func clusterPutJoin(d *Daemon, req api.ClusterPut) Response {
 			}
 		}
 
-		// FIXME: special case handling MAAS connection if the config
-		// in the cluster is different than what we had locally before
-		// joining. Ideally this should be something transparent or
-		// more generic, perhaps triggering some parts of Daemon.Init.
+		// Handle optional service integration on cluster join
 		var clusterConfig *cluster.Config
 		err = d.cluster.Transaction(func(tx *db.ClusterTx) error {
 			var err error
@@ -516,6 +513,8 @@ func clusterPutJoin(d *Daemon, req api.ClusterPut) Response {
 		if err != nil {
 			return err
 		}
+
+		// Connect to MAAS
 		url, key := clusterConfig.MAASController()
 		machine := nodeConfig.MAASMachine()
 		err = d.setupMAASController(url, key, machine)
@@ -523,6 +522,17 @@ func clusterPutJoin(d *Daemon, req api.ClusterPut) Response {
 			return err
 		}
 
+		// Connect to Candid
+		endpoint := clusterConfig.CandidEndpoint()
+		endpointKey := clusterConfig.CandidEndpointKey()
+		expiry := clusterConfig.CandidExpiry()
+		domains := clusterConfig.CandidDomains()
+
+		err = d.setupExternalAuthentication(endpoint, endpointKey, expiry, domains)
+		if err != nil {
+			return err
+		}
+
 		// Re-use the client handler and import the images from the leader node which
 		// owns all available images to the joined node
 		go func() {


More information about the lxc-devel mailing list