From 8bf3f8a6f6ad8998ae58c369fef3ad8cdb320b64 Mon Sep 17 00:00:00 2001 From: d-kuro Date: Wed, 22 Nov 2023 11:37:55 +0900 Subject: [PATCH] Display a message when stopping and resuming Signed-off-by: d-kuro --- cmd/kubectl-moco/cmd/start.go | 5 +++++ cmd/kubectl-moco/cmd/stop.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/cmd/kubectl-moco/cmd/start.go b/cmd/kubectl-moco/cmd/start.go index 0916fb8e9..f25f58802 100644 --- a/cmd/kubectl-moco/cmd/start.go +++ b/cmd/kubectl-moco/cmd/start.go @@ -3,6 +3,7 @@ package cmd import ( "context" "fmt" + "os" mocov1beta2 "github.com/cybozu-go/moco/api/v1beta2" "github.com/cybozu-go/moco/pkg/constants" @@ -56,6 +57,8 @@ func startClustering(ctx context.Context, name string) error { return fmt.Errorf("failed to start clustering of MySQLCluster: %w", err) } + fmt.Fprintf(os.Stdout, "started clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name) + return nil } @@ -92,5 +95,7 @@ func startReconciliation(ctx context.Context, name string) error { return fmt.Errorf("failed to start reconciliation of MySQLCluster: %w", err) } + fmt.Fprintf(os.Stdout, "started reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name)) + return nil } diff --git a/cmd/kubectl-moco/cmd/stop.go b/cmd/kubectl-moco/cmd/stop.go index 225895215..805429fc4 100644 --- a/cmd/kubectl-moco/cmd/stop.go +++ b/cmd/kubectl-moco/cmd/stop.go @@ -3,6 +3,7 @@ package cmd import ( "context" "fmt" + "os" mocov1beta2 "github.com/cybozu-go/moco/api/v1beta2" "github.com/cybozu-go/moco/pkg/constants" @@ -57,6 +58,8 @@ func stopClustering(ctx context.Context, name string) error { return fmt.Errorf("failed to stop clustering of MySQLCluster: %w", err) } + fmt.Fprintf(os.Stdout, "stopped clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name)) + return nil } @@ -94,5 +97,7 @@ func stopReconciliation(ctx context.Context, name string) error { return fmt.Errorf("failed to stop reconciliation of MySQLCluster: %w", err) } + fmt.Fprintf(os.Stdout, "stopped reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name)) + return nil }