From 295ade4f7c3ede12b47c9ff75418e13c75c68c7d Mon Sep 17 00:00:00 2001 From: Allen Zhong Date: Thu, 17 Dec 2020 21:53:28 +0800 Subject: [PATCH] manager/deploy: do not allow deploying of empty topology (#994) Co-authored-by: SIGSEGV Co-authored-by: Ti Prow Robot <71242396+ti-community-prow-bot@users.noreply.github.com> --- pkg/cluster/manager/deploy.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/cluster/manager/deploy.go b/pkg/cluster/manager/deploy.go index a6053ea31f..14b5f20675 100644 --- a/pkg/cluster/manager/deploy.go +++ b/pkg/cluster/manager/deploy.go @@ -87,6 +87,23 @@ func (m *Manager) Deploy( return err } + instCnt := 0 + topo.IterInstance(func(inst spec.Instance) { + switch inst.ComponentName() { + // monitoring components are only useful when deployed with + // core components, we do not support deploying any bare + // monitoring system. + case spec.ComponentGrafana, + spec.ComponentPrometheus, + spec.ComponentAlertmanager: + return + } + instCnt++ + }) + if instCnt < 1 { + return fmt.Errorf("no valid instance found in the input topology, please check your config") + } + spec.ExpandRelativeDir(topo) base := topo.BaseTopo()