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
10 changes: 6 additions & 4 deletions docs/getting_started/spot-ocean.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,13 @@ metadata:
```


| Label | Description | Default |
|-----------------------------------------------------------------|----------------------------------------------------------------------------------------|---|
| `spotinst.io/strategy-cluster-spread-nodes-by` | Specify how Ocean will spread the nodes across markets by this value [vcpu,count]. | `count` |

| Label | Description | Default |
|---|----------------------------------------------------------------------------------------|---|
| `spotinst.io/strategy-cluster-spread-nodes-by` | Specify how Ocean will spread the nodes across markets by this value [vcpu,count]. | `count` |
| `spotinst.io/strategy-cluster-orientation-availability-vs-cost` | Specify approach [cost,balanced,cheapest] that Ocean takes while launching nodes. | `balanced` |
| `spotinst.io/resource-tag-specification-volumes` | Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags. | `false` |
| `spotinst.io/resource-tag-specification-volumes` | Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags. | `false` |
| `spotinst.io/autoscaler-aggressive-scale-down` | Specify if nodes to be promptly scaled down without any waiting period. | `false` |

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ require (
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/spotinst/spotinst-sdk-go v1.171.0
github.com/spotinst/spotinst-sdk-go v1.372.0
github.com/stretchr/testify v1.9.0
github.com/weaveworks/mesh v0.0.0-20191105120815-58dbcc3e8e63
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/spotinst/spotinst-sdk-go v1.171.0 h1:ZihMPEjkpIkSpawWLJt9RtCRY4mOQMGlfrkVmA03000=
github.com/spotinst/spotinst-sdk-go v1.171.0/go.mod h1:Ku9c4p+kRWnQqmXkzGcTMHLcQKgLHrQZISxeKY7mPqE=
github.com/spotinst/spotinst-sdk-go v1.372.0 h1:B4/+HK3D2Fe0821DOmw5RO4Lrzo2gi7oa6QWWjr5/7A=
github.com/spotinst/spotinst-sdk-go v1.372.0/go.mod h1:Tn4/eb0SFY6IXmxz71CClujvbD/PuT+EO6Ta8v6AML4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
Expand Down
9 changes: 9 additions & 0 deletions pkg/model/awsmodel/spotinst.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ const (
// SpotClusterLabelResourceTagSpecificationVolumes
// Specify if Volume resources will be tagged with Virtual Node Group tags or Ocean tags.
SpotClusterLabelResourceTagSpecificationVolumes = "spotinst.io/resource-tag-specification-volumes"

// SpotClusterLabelAutoScalerAggressiveScaleDown
// configure the aggressive scale down feature, the default is false. cluster.autoScaler.down.aggressiveScaleDown.isEnabled
SpotClusterLabelAutoScalerAggressiveScaleDown = "spotinst.io/autoscaler-aggressive-scale-down"
)

// SpotInstanceGroupModelBuilder configures SpotInstanceGroup objects
Expand Down Expand Up @@ -406,6 +410,11 @@ func (b *SpotInstanceGroupModelBuilder) buildOcean(c *fi.CloudupModelBuilderCont
if err != nil {
return err
}
case SpotClusterLabelAutoScalerAggressiveScaleDown:
ocean.AutoScalerAggressiveScaleDown, err = parseBool(v)
if err != nil {
return err
}
}
}

Expand Down
31 changes: 28 additions & 3 deletions upup/pkg/fi/cloudup/spotinsttasks/ocean.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type Ocean struct {
SpreadNodesBy *string
AvailabilityVsCost *string
ResourceTagSpecificationVolumes *bool
AutoScalerAggressiveScaleDown *bool
}

var (
Expand Down Expand Up @@ -324,9 +325,14 @@ func (o *Ocean) Find(c *fi.CloudupContext) (*Ocean, error) {

// Scale down.
if down := ocean.AutoScaler.Down; down != nil {
actual.AutoScalerOpts.Down = &AutoScalerDownOpts{
MaxPercentage: down.MaxScaleDownPercentage,
EvaluationPeriods: down.EvaluationPeriods,
if down.MaxScaleDownPercentage != nil || down.EvaluationPeriods != nil {
actual.AutoScalerOpts.Down = &AutoScalerDownOpts{
MaxPercentage: down.MaxScaleDownPercentage,
EvaluationPeriods: down.EvaluationPeriods,
}
}
if down.AggressiveScaleDown != nil {
actual.AutoScalerAggressiveScaleDown = down.AggressiveScaleDown.IsEnabled
}
}

Expand Down Expand Up @@ -585,6 +591,16 @@ func (_ *Ocean) create(cloud awsup.AWSCloud, a, e, changes *Ocean) error {
MaxMemoryGiB: limits.MaxMemory,
}
}
// create AutoScalerAggressiveScaleDown
{
if e.AutoScalerAggressiveScaleDown != nil {
aggressiveScaleDown := new(aws.AggressiveScaleDown)
if down := autoScaler.Down; down == nil {
autoScaler.Down = new(aws.AutoScalerDown)
}
autoScaler.Down.SetAggressiveScaleDown(aggressiveScaleDown.SetIsEnabled(fi.PtrTo(*e.AutoScalerAggressiveScaleDown)))
}
}

ocean.SetAutoScaler(autoScaler)
}
Expand Down Expand Up @@ -1084,6 +1100,15 @@ func (_ *Ocean) update(cloud awsup.AWSCloud, a, e, changes *Ocean) error {
} else if a.AutoScalerOpts.ResourceLimits != nil {
autoScaler.SetResourceLimits(nil)
}
// AutoScaler aggressive scale down
if changes.AutoScalerAggressiveScaleDown != nil {
aggressiveScaleDown := new(aws.AggressiveScaleDown)
if down := autoScaler.Down; down == nil {
autoScaler.Down = new(aws.AutoScalerDown)
}
autoScaler.Down.SetAggressiveScaleDown(aggressiveScaleDown.SetIsEnabled(fi.PtrTo(*changes.AutoScalerAggressiveScaleDown)))
changes.AutoScalerAggressiveScaleDown = nil
}

ocean.SetAutoScaler(autoScaler)
changed = true
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading