mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-11 01:30:06 -04:00
supported preemptible in googlecompute builder
This commit is contained in:
parent
b97f343776
commit
afd314959b
4 changed files with 6 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ type Config struct {
|
|||
MachineType string `mapstructure:"machine_type"`
|
||||
Metadata map[string]string `mapstructure:"metadata"`
|
||||
Network string `mapstructure:"network"`
|
||||
Preemptible bool `mapstructure:"preemptible"`
|
||||
SourceImage string `mapstructure:"source_image"`
|
||||
SourceImageProjectId string `mapstructure:"source_image_project_id"`
|
||||
RawStateTimeout string `mapstructure:"state_timeout"`
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ type InstanceConfig struct {
|
|||
Metadata map[string]string
|
||||
Name string
|
||||
Network string
|
||||
Preemptible bool
|
||||
Tags []string
|
||||
Zone string
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,6 +255,9 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
|||
Network: network.SelfLink,
|
||||
},
|
||||
},
|
||||
Scheduling: &compute.Scheduling{
|
||||
Preemptible: c.Preemptible,
|
||||
},
|
||||
ServiceAccounts: []*compute.ServiceAccount{
|
||||
&compute.ServiceAccount{
|
||||
Email: "default",
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
|||
Metadata: config.getInstanceMetadata(sshPublicKey),
|
||||
Name: name,
|
||||
Network: config.Network,
|
||||
Preemptible: config.Preemptible,
|
||||
Tags: config.Tags,
|
||||
Zone: config.Zone,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue