From c621f5fc1336522b96fc9d464b8f0aa01e145c90 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Thu, 18 Jan 2024 08:03:27 +0530 Subject: [PATCH] fix: creation of multiple inline canaries for a component --- pkg/topology/component_check.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/topology/component_check.go b/pkg/topology/component_check.go index 62a223bba..b79ac123c 100644 --- a/pkg/topology/component_check.go +++ b/pkg/topology/component_check.go @@ -75,7 +75,7 @@ func createComponentCanaryFromInline(gormDB *gorm.DB, id, name, namespace, sched func GetChecksForComponent(ctx context.Context, component *pkg.Component) ([]models.CheckComponentRelationship, error) { var relationships []models.CheckComponentRelationship - for _, componentCheck := range component.ComponentChecks { + for idx, componentCheck := range component.ComponentChecks { hash := componentCheck.Hash() if componentCheck.Selector.LabelSelector != "" { checks, err := duty.FindChecks(ctx, types.ResourceSelectors{componentCheck.Selector}, duty.PickColumns("id", "canary_id")) @@ -98,8 +98,9 @@ func GetChecksForComponent(ctx context.Context, component *pkg.Component) ([]mod inlineSchedule = componentCheck.Inline.Schedule } + canaryName := fmt.Sprintf("%s-%d", component.Name, idx) canary, err := createComponentCanaryFromInline(ctx.DB(), - component.ID.String(), component.Name, component.Namespace, + component.ID.String(), canaryName, component.Namespace, inlineSchedule, component.Owner, componentCheck.Inline, )