Skip to content

Commit

Permalink
Feat (Ocean/AWS) : Added support for cluster_orientation field in str…
Browse files Browse the repository at this point in the history
…ategy (#218)
  • Loading branch information
sharadkesarwani authored Jan 16, 2023
1 parent a9f7b82 commit dbbcb3f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
3 changes: 3 additions & 0 deletions examples/service/ocean/providers/aws/create/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func main() {
Strategy: &aws.Strategy{
SpotPercentage: spotinst.Float64(100),
FallbackToOnDemand: spotinst.Bool(true),
ClusterOrientation: &aws.ClusterOrientation{
AvailabilityVsCost: spotinst.String("cheapest"),
},
},
Compute: &aws.Compute{
InstanceTypes: &aws.InstanceTypes{
Expand Down
40 changes: 32 additions & 8 deletions service/ocean/providers/aws/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,39 @@ type Cluster struct {
}

type Strategy struct {
SpotPercentage *float64 `json:"spotPercentage,omitempty"`
UtilizeReservedInstances *bool `json:"utilizeReservedInstances,omitempty"`
FallbackToOnDemand *bool `json:"fallbackToOd,omitempty"`
DrainingTimeout *int `json:"drainingTimeout,omitempty"`
GracePeriod *int `json:"gracePeriod,omitempty"`
UtilizeCommitments *bool `json:"utilizeCommitments,omitempty"`
SpotPercentage *float64 `json:"spotPercentage,omitempty"`
UtilizeReservedInstances *bool `json:"utilizeReservedInstances,omitempty"`
FallbackToOnDemand *bool `json:"fallbackToOd,omitempty"`
DrainingTimeout *int `json:"drainingTimeout,omitempty"`
GracePeriod *int `json:"gracePeriod,omitempty"`
UtilizeCommitments *bool `json:"utilizeCommitments,omitempty"`
ClusterOrientation *ClusterOrientation `json:"clusterOrientation,omitempty"`
forceSendFields []string
nullFields []string
}
type ClusterOrientation struct {
AvailabilityVsCost *string `json:"availabilityVsCost,omitempty"`
forceSendFields []string
nullFields []string
}

forceSendFields []string
nullFields []string
func (o *ClusterOrientation) SetAvailabilityVsCost(v *string) *ClusterOrientation {
if o.AvailabilityVsCost = v; o.AvailabilityVsCost == nil {
o.nullFields = append(o.nullFields, "AvailabilityVsCost")
}
return o
}

func (o *Strategy) SetClusterOrientation(v *ClusterOrientation) *Strategy {
if o.ClusterOrientation = v; o.ClusterOrientation == nil {
o.nullFields = append(o.nullFields, "ClusterOrientation")
}
return o
}
func (o ClusterOrientation) MarshalJSON() ([]byte, error) {
type noMethod ClusterOrientation
raw := noMethod(o)
return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields)
}

type Capacity struct {
Expand Down

0 comments on commit dbbcb3f

Please sign in to comment.