Skip to content

Commit

Permalink
Added support for ephemeralStorage in ocean-aws-k8s-launchspec. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadkesarwani authored Mar 28, 2024
1 parent 2ed7604 commit 0b4cbd9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/service/ocean/providers/aws/launchSpec/create/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ func main() {
RootDeviceTypes: []string{"ebs"},
MaxNetworkPerformance: spotinst.Int(20),
MinNetworkPerformance: spotinst.Int(2),
},
BlockDeviceMappings: []*aws.BlockDeviceMapping{
&aws.BlockDeviceMapping{
DeviceName: spotinst.String("/dev/xvdb"),
EBS: &aws.EBS{
DeleteOnTermination: spotinst.Bool(true),
Encrypted: spotinst.Bool(false),
IOPS: spotinst.Int(100),
Throughput: spotinst.Int(125),
VolumeType: spotinst.String("gp3"),
SnapshotID: spotinst.String("snap-12345"),
VolumeSize: spotinst.Int(35),
},
}},
EphemeralStorage: &aws.EphemeralStorage{
DeviceName: spotinst.String("/dev/xvdb"),
}},
})
if err != nil {
Expand Down
31 changes: 31 additions & 0 deletions service/ocean/providers/aws/launchspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type LaunchSpec struct {
AutoScale *AutoScale `json:"autoScale,omitempty"`
ElasticIPPool *ElasticIPPool `json:"elasticIpPool,omitempty"`
BlockDeviceMappings []*BlockDeviceMapping `json:"blockDeviceMappings,omitempty"`
EphemeralStorage *EphemeralStorage `json:"ephemeralStorage,omitempty"`
Labels []*Label `json:"labels,omitempty"`
Taints []*Taint `json:"taints,omitempty"`
Tags []*Tag `json:"tags,omitempty"`
Expand Down Expand Up @@ -299,6 +300,13 @@ type InstanceTypesFilters struct {
nullFields []string
}

type EphemeralStorage struct {
DeviceName *string `json:"deviceName,omitempty"`

forceSendFields []string
nullFields []string
}

type ListLaunchSpecsInput struct {
OceanID *string `json:"oceanId,omitempty"`
}
Expand Down Expand Up @@ -679,6 +687,12 @@ func (o *LaunchSpec) SetInstanceTypesFilters(v *InstanceTypesFilters) *LaunchSpe
}
return o
}
func (o *LaunchSpec) SetEphemeralStorage(v *EphemeralStorage) *LaunchSpec {
if o.EphemeralStorage = v; o.EphemeralStorage == nil {
o.nullFields = append(o.nullFields, "EphemeralStorage")
}
return o
}

// endregion

Expand Down Expand Up @@ -1317,3 +1331,20 @@ func (o *InstanceTypesFilters) SetVirtualizationTypes(v []string) *InstanceTypes
}

// endregion

// region EphemeralStorage

func (o *EphemeralStorage) SetDeviceName(v *string) *EphemeralStorage {
if o.DeviceName = v; o.DeviceName == nil {
o.nullFields = append(o.nullFields, "DeviceName")
}
return o
}

func (o EphemeralStorage) MarshalJSON() ([]byte, error) {
type noMethod EphemeralStorage
raw := noMethod(o)
return jsonutil.MarshalJSON(raw, o.forceSendFields, o.nullFields)
}

// endregion

0 comments on commit 0b4cbd9

Please sign in to comment.