Skip to content

Commit

Permalink
feat(tencent): Support spot instance for tencent provider
Browse files Browse the repository at this point in the history
  • Loading branch information
zsnmwy authored and JacieChao committed Apr 7, 2022
1 parent a687d98 commit c2a0e6d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pkg/providers/tencent/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ func (p *Tencent) sharedFlags() []types.Flag {
Usage: "Specify the type of VM instance, see: https://cloud.tencent.com/document/product/213/11518",
EnvVar: "CVM_INSTANCE_TYPE",
},
{
Name: "instance-charge-type",
P: &p.InstanceChargeType,
V: p.InstanceChargeType,
Usage: "Specify the charge type of VM instance, see: https://cloud.tencent.com/document/product/213/15730",
EnvVar: "CVM_INSTANCE_CHARGE_TYPE",
},
{
Name: "disk-category",
P: &p.SystemDiskType,
Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/tencent/tencent.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func newProvider() *Tencent {
Options: tencent.Options{
ImageID: imageID,
InstanceType: instanceType,
InstanceChargeType: instanceChargeType,
SystemDiskSize: diskSize,
SystemDiskType: diskCategory,
InternetMaxBandwidthOut: internetMaxBandwidthOut,
Expand Down Expand Up @@ -747,7 +748,7 @@ func (p *Tencent) runInstances(num int, master bool, password string) error {
request.Placement = &cvm.Placement{
Zone: tencentCommon.StringPtr(p.Zone),
}
request.InstanceChargeType = tencentCommon.StringPtr(instanceChargeType)
request.InstanceChargeType = tencentCommon.StringPtr(p.InstanceChargeType)
request.SecurityGroupIds = tencentCommon.StringPtrs(strings.Split(p.SecurityGroupIds, ","))
request.VirtualPrivateCloud = &cvm.VirtualPrivateCloud{
SubnetId: tencentCommon.StringPtr(p.SubnetID),
Expand Down
1 change: 1 addition & 0 deletions pkg/types/tencent/tencent.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Options struct {
SubnetID string `json:"subnet,omitempty" yaml:"subnet,omitempty"`
ImageID string `json:"image,omitempty" yaml:"image,omitempty"`
InstanceType string `json:"instance-type,omitempty" yaml:"instance-type,omitempty"`
InstanceChargeType string `json:"instance-charge-type,omitempty" yaml:"instance-charge-type,omitempty"`
SystemDiskType string `json:"disk-category,omitempty" yaml:"disk-category,omitempty"`
SystemDiskSize string `json:"disk-size,omitempty" yaml:"disk-size,omitempty"`
InternetMaxBandwidthOut string `json:"internet-max-bandwidth-out,omitempty" yaml:"internet-max-bandwidth-out,omitempty"`
Expand Down

0 comments on commit c2a0e6d

Please sign in to comment.