From 4e06282dacfa73e7f0d7fd20f82c492c09c6003d Mon Sep 17 00:00:00 2001 From: Smityz Date: Sat, 6 May 2023 19:07:44 +0800 Subject: [PATCH 1/2] skip destroy monitor when ignore_exporter is true Signed-off-by: Smityz --- pkg/cluster/operation/destroy.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cluster/operation/destroy.go b/pkg/cluster/operation/destroy.go index 0d44613bf3..0736da64ea 100644 --- a/pkg/cluster/operation/destroy.go +++ b/pkg/cluster/operation/destroy.go @@ -241,6 +241,9 @@ func DeletePublicKey(ctx context.Context, host string) error { // DestroyMonitored destroy the monitored service. func DestroyMonitored(ctx context.Context, inst spec.Instance, options *spec.MonitoredOptions, timeout uint64) error { + if inst.IgnoreMonitorAgent(){ + return nil + } e := ctxt.GetInner(ctx).Get(inst.GetManageHost()) logger := ctx.Value(logprinter.ContextKeyLogger).(*logprinter.Logger) From 8025e3ae50f03c1a99ef66733cdb0b1d09059ba3 Mon Sep 17 00:00:00 2001 From: Smityz Date: Wed, 17 May 2023 17:26:06 +0800 Subject: [PATCH 2/2] update --- pkg/cluster/operation/destroy.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/cluster/operation/destroy.go b/pkg/cluster/operation/destroy.go index 0736da64ea..595babf5aa 100644 --- a/pkg/cluster/operation/destroy.go +++ b/pkg/cluster/operation/destroy.go @@ -57,7 +57,7 @@ func Destroy( for _, inst := range insts { instCount[inst.GetManageHost()]-- if instCount[inst.GetManageHost()] == 0 { - if cluster.GetMonitoredOptions() != nil { + if cluster.GetMonitoredOptions() != nil && !inst.IgnoreMonitorAgent(){ if err := DestroyMonitored(ctx, inst, cluster.GetMonitoredOptions(), options.OptTimeout); err != nil && !options.Force { return err } @@ -241,9 +241,6 @@ func DeletePublicKey(ctx context.Context, host string) error { // DestroyMonitored destroy the monitored service. func DestroyMonitored(ctx context.Context, inst spec.Instance, options *spec.MonitoredOptions, timeout uint64) error { - if inst.IgnoreMonitorAgent(){ - return nil - } e := ctxt.GetInner(ctx).Get(inst.GetManageHost()) logger := ctx.Value(logprinter.ContextKeyLogger).(*logprinter.Logger)