Skip to content

Commit

Permalink
fix: creation of multiple inline canaries for a component
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Jan 18, 2024
1 parent bc5aeef commit c621f5f
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 c621f5f

Please sign in to comment.