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: 6 additions & 6 deletions providers/aws/eks/async_settle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func TestAsyncSettleClusterCreateUpdate(t *testing.T) {
t.Fatalf("update cluster version: %v", err)
}

if updated.Status != "Successful" {
t.Fatalf("update record status = %q, want Successful", updated.Status)
if updated.Status != updateInProgress {
t.Fatalf("update record status = %q, want InProgress", updated.Status)
}

if got := clusterStatus(t, m, "c1"); got != eksdriver.ClusterStatusUpdating {
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestAsyncSettleNodegroupCreateUpdate(t *testing.T) {
created, err := m.CreateNodegroup(ctx, eksdriver.NodegroupConfig{
ClusterName: "c1",
NodegroupName: "ng1",
ScalingConfig: eksdriver.NodegroupScalingConfig{MinSize: 1, MaxSize: 3, DesiredSize: 2},
ScalingConfig: &eksdriver.NodegroupScalingConfig{MinSize: 1, MaxSize: 3, DesiredSize: 2},
})
if err != nil {
t.Fatalf("create nodegroup: %v", err)
Expand All @@ -158,15 +158,15 @@ func TestAsyncSettleNodegroupCreateUpdate(t *testing.T) {
t.Fatalf("settled status = %q, want %q", got, eksdriver.NodegroupStatusActive)
}

scaling := eksdriver.NodegroupScalingConfig{MinSize: 2, MaxSize: 5, DesiredSize: 4}
scaling := eksdriver.NodegroupScalingUpdate{MinSize: intPtr(2), MaxSize: intPtr(5), DesiredSize: intPtr(4)}

upd, err := m.UpdateNodegroupConfig(ctx, "c1", "ng1", eksdriver.NodegroupConfigUpdate{Scaling: &scaling})
if err != nil {
t.Fatalf("update nodegroup config: %v", err)
}

if upd.Status != "Successful" {
t.Fatalf("update record status = %q, want Successful", upd.Status)
if upd.Status != updateInProgress {
t.Fatalf("update record status = %q, want InProgress", upd.Status)
}

if got := nodegroupStatus(t, m, "c1", "ng1"); got != eksdriver.NodegroupStatusUpdating {
Expand Down
26 changes: 18 additions & 8 deletions providers/aws/eks/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ type NodegroupScalingConfig struct {
DesiredSize int
}

// NodegroupScalingUpdate is a partial scaling change for UpdateNodegroupConfig.
// Only the non-nil sizes change; the rest keep their current values.
type NodegroupScalingUpdate struct {
MinSize *int
MaxSize *int
DesiredSize *int
}

// Taint is a Kubernetes taint applied to a managed node group's nodes. Effect
// is one of NO_SCHEDULE, PREFER_NO_SCHEDULE, or NO_EXECUTE. A taint is
// identified by its Key+Effect pair.
Expand Down Expand Up @@ -226,11 +234,13 @@ type NodegroupConfig struct {
DiskSize int
Version string
ReleaseVersion string
ScalingConfig NodegroupScalingConfig
UpdateConfig NodegroupUpdateConfig
Labels map[string]string
Taints []Taint
Tags map[string]string
// ScalingConfig is optional; nil gets the EKS default of min 1, max 2,
// desired 2.
ScalingConfig *NodegroupScalingConfig
UpdateConfig NodegroupUpdateConfig
Labels map[string]string
Taints []Taint
Tags map[string]string
// LaunchTemplate is optional; when set, it names the EC2 launch template
// backing the node group's instances.
LaunchTemplate *LaunchTemplateSpecification
Expand Down Expand Up @@ -273,11 +283,11 @@ type Nodegroup struct {
}

// NodegroupConfigUpdate carries the mutable fields UpdateNodegroupConfig
// applies. Scaling, when non-nil, is the already-merged target sizing (the
// caller overlays partial requests). Label and taint changes are expressed as
// applies. Scaling, when non-nil, names the sizes to change; they are merged
// onto the current config and the result is validated. Label and taint changes are expressed as
// add/update and remove deltas, matching the real EKS request shape.
type NodegroupConfigUpdate struct {
Scaling *NodegroupScalingConfig
Scaling *NodegroupScalingUpdate
UpdateConfig *NodegroupUpdateConfig
AddOrUpdateLabels map[string]string
RemoveLabels []string
Expand Down
Loading
Loading