From 89e8631882832275050965f894cef89ca2ea4bda Mon Sep 17 00:00:00 2001 From: Ryota Sakamoto Date: Sun, 16 Jun 2024 18:09:59 +0900 Subject: [PATCH] logging for creating instance --- pkg/provisioner/cluster.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/provisioner/cluster.go b/pkg/provisioner/cluster.go index 5e37057..b6f62dd 100644 --- a/pkg/provisioner/cluster.go +++ b/pkg/provisioner/cluster.go @@ -24,11 +24,15 @@ type Config struct { } func CreateMaster(clusterName string, config Config) error { + slog.Debug("create master", slog.String("clusterName", clusterName), slog.Any("config", config)) + instanceName := fmt.Sprintf("%s-%s", clusterName, "master") instance, err := multipass.GetInstance(instanceName) if err != nil { return fmt.Errorf("failed to get instance: %w", err) } + + slog.Debug("get instance", slog.String("instanceName", instanceName), slog.Any("instance", instance)) if instance != nil { return nil } @@ -51,16 +55,21 @@ func CreateMaster(clusterName string, config Config) error { } func CreateWorker(clusterName string, config Config) error { + slog.Debug("create worker", slog.String("clusterName", clusterName), slog.Any("config", config)) + name := config.Name if name == "" { name = GetRandomName() } instanceName := fmt.Sprintf("%s-%s", clusterName, name) + instance, err := multipass.GetInstance(instanceName) if err != nil { return fmt.Errorf("failed to get instance: %w", err) } + + slog.Debug("get instance", slog.String("instanceName", instanceName), slog.Any("instance", instance)) if instance != nil { return nil }