Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmd/kops/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/json"
"encoding/pem"
"fmt"
"os"
Expand Down Expand Up @@ -1203,10 +1204,19 @@ func (i *integrationTest) runTest(t *testing.T, ctx context.Context, h *testutil
options.ClusterName = i.clusterName
options.LifecycleOverrides = i.lifecycleOverrides

_, err := RunUpdateCluster(ctx, factory, &stdout, options)
updateClusterResults, err := RunUpdateCluster(ctx, factory, &stdout, options)
if err != nil {
t.Fatalf("error running update cluster %q: %v", i.clusterName, err)
}

// Verify that we can print all the tasks
// Catches bugs like https://github.com/kubernetes/kops/issues/17316
for key, task := range updateClusterResults.TaskMap {
if _, err := json.Marshal(task); err != nil {
t.Errorf("unable to marshal task %q of type %T to json: %v", key, task, err)
}
}

}

// Compare main files
Expand Down
10 changes: 5 additions & 5 deletions pkg/model/awsmodel/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.CloudupModelBuilderContext) e

// @step: now lets build the autoscaling group task
if ig.Spec.Manager != "Karpenter" {
tsk, err := b.buildAutoScalingGroupTask(c, name, ig)
asg, err := b.buildAutoScalingGroupTask(c, name, ig)
if err != nil {
return err
}
tsk.LaunchTemplate = task
c.AddTask(tsk)
asg.LaunchTemplate = task
c.AddTask(asg)

warmPool := b.Cluster.Spec.CloudProvider.AWS.WarmPool.ResolveDefaults(ig)

Expand All @@ -103,9 +103,9 @@ func (b *AutoscalingGroupModelBuilder) Build(c *fi.CloudupModelBuilderContext) e
if warmPool.MaxSize != nil {
warmPoolTask.MaxSize = fi.PtrTo(int32(aws.ToInt64(warmPool.MaxSize)))
}
tsk.WarmPool = warmPoolTask
asg.WarmPool = warmPoolTask
} else {
tsk.WarmPool = nil
asg.WarmPool = nil
}
c.AddTask(warmPoolTask)

Expand Down
6 changes: 4 additions & 2 deletions upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ type AutoscalingGroup struct {
TargetGroups []*TargetGroup
// CapacityRebalance makes ASG proactively replace spot instances when ASG receives a rebalance recommendation
CapacityRebalance *bool
// WarmPool is the WarmPool config for the ASG
WarmPool *WarmPool

// WarmPool is the WarmPool config for the ASG.
// It is marked to be ignored in JSON marshalling to avoid a circular dependency.
WarmPool *WarmPool `json:"-"`

deletions []fi.CloudupDeletion
}
Expand Down
1 change: 1 addition & 0 deletions upup/pkg/fi/cloudup/awstasks/warmpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type WarmPool struct {
// MinSize is the smallest number of nodes in the warm pool.
MinSize int32

// AutoscalingGroup is the AutoscalingGroup on which we configure this warmpool.
AutoscalingGroup *AutoscalingGroup
}

Expand Down
Loading