Skip to content

Commit

Permalink
Merge pull request #9683 from spotinst/fix-max-scale-down
Browse files Browse the repository at this point in the history
Spotinst: Change `ScaleDown.MaxPercentage` from int to float64
  • Loading branch information
k8s-ci-robot authored Aug 5, 2020
2 parents 6ae2bf8 + 4d88668 commit d61ab29
Show file tree
Hide file tree
Showing 22 changed files with 949 additions and 126 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ require (
github.com/spf13/cobra v0.0.5
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.4.0
github.com/spotinst/spotinst-sdk-go v1.49.0
github.com/spotinst/spotinst-sdk-go v1.56.0
github.com/stretchr/testify v1.5.1
github.com/urfave/cli v1.20.0
github.com/weaveworks/mesh v0.0.0-20170419100114-1f158d31de55
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,8 @@ github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/spotinst/spotinst-sdk-go v1.49.0 h1:JmsLlsgd/cCKpcn04HrParo5r34owDzIC12IW1SpSEs=
github.com/spotinst/spotinst-sdk-go v1.49.0/go.mod h1:nWi2DyjUi1WUZclpsqZFXvImsU0T39ppqqHwC4/T5mw=
github.com/spotinst/spotinst-sdk-go v1.56.0 h1:w7OnAWXWPxvOvqjYv4i0kN70KWGTNcyoNB72suIA30g=
github.com/spotinst/spotinst-sdk-go v1.56.0/go.mod h1:nWi2DyjUi1WUZclpsqZFXvImsU0T39ppqqHwC4/T5mw=
github.com/storageos/go-api v0.0.0-20180912212459-343b3eff91fc/go.mod h1:ZrLn+e0ZuF3Y65PNF6dIwbJPZqfmtCXxFm9ckv0agOY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
Expand Down
4 changes: 2 additions & 2 deletions pkg/model/spotinstmodel/instance_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,14 +815,14 @@ func (b *InstanceGroupModelBuilder) buildAutoScalerOpts(clusterID string, ig *ko

case InstanceGroupLabelAutoScalerScaleDownMaxPercentage:
{
v, err := parseInt(v)
v, err := parseFloat(v)
if err != nil {
return nil, err
}
if opts.Down == nil {
opts.Down = new(spotinsttasks.AutoScalerDownOpts)
}
opts.Down.MaxPercentage = fi.Int(int(fi.Int64Value(v)))
opts.Down.MaxPercentage = v
}

case InstanceGroupLabelAutoScalerScaleDownEvaluationPeriods:
Expand Down
6 changes: 3 additions & 3 deletions upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type AutoScalerHeadroomOpts struct {
}

type AutoScalerDownOpts struct {
MaxPercentage *int
MaxPercentage *float64
EvaluationPeriods *int
}

Expand Down Expand Up @@ -1349,8 +1349,8 @@ type terraformAutoScalerHeadroom struct {
}

type terraformAutoScalerDown struct {
MaxPercentage *int `json:"max_scale_down_percentage,omitempty" cty:"max_scale_down_percentage"`
EvaluationPeriods *int `json:"evaluation_periods,omitempty" cty:"evaluation_periods"`
MaxPercentage *float64 `json:"max_scale_down_percentage,omitempty" cty:"max_scale_down_percentage"`
EvaluationPeriods *int `json:"evaluation_periods,omitempty" cty:"evaluation_periods"`
}

type terraformKV struct {
Expand Down

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

Loading

0 comments on commit d61ab29

Please sign in to comment.