Skip to content

Commit

Permalink
Merge pull request #1592 from flanksource/update-inline-canary-name
Browse files Browse the repository at this point in the history
fix: creation of multiple inline canaries for a component
  • Loading branch information
moshloop authored Jan 18, 2024
2 parents e404a77 + c621f5f commit 04cd87a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/topology/component_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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,
)

Expand Down

0 comments on commit 04cd87a

Please sign in to comment.