Skip to content

Commit

Permalink
Merge pull request #16603 from HealthengineAU/automated-cherry-pick-o…
Browse files Browse the repository at this point in the history
…f-#16583-upstream-release-1.29

Automated cherry pick of #16583: Make ASG Warmpool depend on ASG Lifecycle hook
  • Loading branch information
k8s-ci-robot committed Jun 8, 2024
2 parents 5b8e06d + b025e1c commit a054e4d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions upup/pkg/fi/cloudup/awstasks/warmpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ type WarmPool struct {
AutoscalingGroup *AutoscalingGroup
}

var _ fi.CloudupHasDependencies = &WarmPool{}

// Warmpool depends on any Lifecycle hooks being in place first.
func (e *WarmPool) GetDependencies(tasks map[string]fi.CloudupTask) []fi.CloudupTask {
var deps []fi.CloudupTask

// Depend on the ASG.
if e.AutoscalingGroup != nil {
deps = append(deps, e.AutoscalingGroup)
}

// Depend on any Lifecycle hooks assigned to the ASG.
for _, task := range tasks {
if l, ok := task.(*AutoscalingLifecycleHook); ok {
if l.AutoscalingGroup == e.AutoscalingGroup {
deps = append(deps, task)
}
}
}
return deps
}

// Find is used to discover the ASG in the cloud provider.
func (e *WarmPool) Find(c *fi.CloudupContext) (*WarmPool, error) {
ctx := c.Context()
Expand Down

0 comments on commit a054e4d

Please sign in to comment.