Skip to content

Commit

Permalink
Use ModifyLister to modify the default rules
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kikuc committed Dec 21, 2023
1 parent d51df79 commit d79472e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions pkg/app/piped/platformprovider/ecs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,23 @@ func (c *client) ModifyListeners(ctx context.Context, listenerArns []string, rou
}
}

_, err := c.elbClient.ModifyRule(ctx, &elasticloadbalancingv2.ModifyRuleInput{
RuleArn: rule.RuleArn,
Actions: modifiedActions,
})
if err != nil {
return fmt.Errorf("failed to modify rule %s: %w", *rule.RuleArn, err)
// The default rule needs to be modified by ModifyListener API.
if rule.IsDefault {
_, err := c.elbClient.ModifyListener(ctx, &elasticloadbalancingv2.ModifyListenerInput{
ListenerArn: &listenerArn,
DefaultActions: modifiedActions,
})
if err != nil {
return fmt.Errorf("failed to modify default rule %s: %w", *rule.RuleArn, err)
}
} else {
_, err := c.elbClient.ModifyRule(ctx, &elasticloadbalancingv2.ModifyRuleInput{
RuleArn: rule.RuleArn,
Actions: modifiedActions,
})
if err != nil {
return fmt.Errorf("failed to modify rule %s: %w", *rule.RuleArn, err)
}

Check warning on line 491 in pkg/app/piped/platformprovider/ecs/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/piped/platformprovider/ecs/client.go#L476-L491

Added lines #L476 - L491 were not covered by tests
}
}
}
Expand Down

0 comments on commit d79472e

Please sign in to comment.