Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for non-preemptible secondary dataproc workers #5686

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ebdffd6
add configuration for nonpreemptible secondary dataproc nodes
tsamaras Jan 28, 2022
40d4e9f
Allow extension of default user agent in GetConfig (#5639)
melinath Jan 24, 2022
e9c908a
Use utility functions to reduce the need for strconv, validation impo…
rileykarson Jan 24, 2022
b4941f9
Remove the invalidupgradesettings test. … (#5640)
rileykarson Jan 24, 2022
4588de6
ignore redis instance tests to unblock pr 5557 (#5643)
ScottSuarez Jan 25, 2022
f62b26f
Add CDN load balancer with Cloud Storage buckets as backend (#5575)
msampathkumar Jan 25, 2022
01d8ad2
Upstream firewalls DSF update to allow unknown values coming from int…
slevenick Jan 25, 2022
5224e6f
Remove "KERBEROS" from list of accepted values for "optional_componen…
jpellman Jan 25, 2022
2b01f82
Added maintenancePolicy attribute to redis instance (#5557)
jaceq Jan 25, 2022
6abd6b6
check in tpg into tfv repository (#5641)
ScottSuarez Jan 26, 2022
7a57c79
Add EXTERNAL_MANAGED option to global forwarding rule and add example…
Jan 26, 2022
8f695a1
Update google_sql_database_instance documentation (#5649)
megan07 Jan 26, 2022
12ce646
vpc access connector use self_link or name (#5623)
drandell Jan 26, 2022
23f8341
Update downstream builder to use the updated package reference (#5651)
ScottSuarez Jan 26, 2022
383570b
Fix new-ish vet errors (#5658)
rileykarson Jan 27, 2022
1b00f3a
run `go mod tidy` after ingesting lastest build to accound for depend…
ScottSuarez Jan 27, 2022
67eb8ed
Fix kms crypto key iam asset name (#5654)
iyabchen Jan 28, 2022
b28455f
Adding support for zone and region via env (#5646)
prateek2408 Jan 28, 2022
0cc13cd
Merge remote-tracking branch 'origin/master' into non_premptible_seco…
tsamaras Jan 28, 2022
eb52d7b
adding test for isPreemptible property
tsamaras Jan 31, 2022
1725489
Merge remote-tracking branch 'origin/master' into non_premptible_seco…
tsamaras Jan 31, 2022
06bca2c
final cleanup and documentation
tsamaras Feb 3, 2022
8288898
Merge remote-tracking branch 'origin/master' into non_premptible_seco…
tsamaras Feb 3, 2022
f1856ae
revert api changes
tsamaras Feb 3, 2022
dcce0ed
set default for preemptibility
tsamaras Feb 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions mmv1/products/dataproc/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,19 @@ objects:
Number of attached SSDs, from 0 to 4.
- !ruby/object:Api::Type::Boolean
name: 'isPreemptible'
output: true
description: |
Specifies if this instance group contains preemptible instances.
- !ruby/object:Api::Type::Enum
name: 'preemptibility'
description: |
Specifies the preemptibility of the instance group.
The default value for master and worker groups is NON_PREEMPTIBLE. This default cannot be changed.
The default value for secondary instances is PREEMPTIBLE.
values:
- :PREEMPTIBILITY_UNSPECIFIED
- :NON_PREEMPTIBLE
- :PREEMPTIBLE
- !ruby/object:Api::Type::NestedObject
name: 'managedGroupConfig'
output: true
Expand Down Expand Up @@ -387,8 +398,19 @@ objects:
Number of attached SSDs, from 0 to 4.
- !ruby/object:Api::Type::Boolean
name: 'isPreemptible'
output: true
description: |
Specifies if this instance group contains preemptible instances.
- !ruby/object:Api::Type::Enum
name: 'preemptibility'
description: |
Specifies the preemptibility of the instance group.
The default value for master and worker groups is NON_PREEMPTIBLE. This default cannot be changed.
The default value for secondary instances is PREEMPTIBLE.
values:
- :PREEMPTIBILITY_UNSPECIFIED
- :NON_PREEMPTIBLE
- :PREEMPTIBLE
- !ruby/object:Api::Type::NestedObject
name: 'managedGroupConfig'
output: true
Expand Down Expand Up @@ -448,8 +470,19 @@ objects:
Number of attached SSDs, from 0 to 4.
- !ruby/object:Api::Type::Boolean
name: 'isPreemptible'
output: true
description: |
Specifies if this instance group contains preemptible instances.
- !ruby/object:Api::Type::Enum
name: 'preemptibility'
description: |
Specifies the preemptibility of the instance group.
The default value for master and worker groups is NON_PREEMPTIBLE. This default cannot be changed.
The default value for secondary instances is PREEMPTIBLE.
values:
- :PREEMPTIBILITY_UNSPECIFIED
- :NON_PREEMPTIBLE
- :PREEMPTIBLE
- !ruby/object:Api::Type::NestedObject
name: 'managedGroupConfig'
output: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ func resourceDataprocCluster() *schema.Resource {
Description: `Specifies the number of preemptible nodes to create. Defaults to 0.`,
AtLeastOneOf: []string{
"cluster_config.0.preemptible_worker_config.0.num_instances",
"cluster_config.0.preemptible_worker_config.0.preemptibility",
"cluster_config.0.preemptible_worker_config.0.disk_config",
},
},
Expand All @@ -344,13 +345,28 @@ func resourceDataprocCluster() *schema.Resource {
// It always uses whatever is specified for the worker_config
// "machine_type": { ... }
// "min_cpu_platform": { ... }
"preemptibility": {
Type: schema.TypeString,
Optional: true,
Description: `Specifies the preemptibility of the secondary nodes. Defaults to PREEMPTIBLE.`,
AtLeastOneOf: []string{
"cluster_config.0.preemptible_worker_config.0.num_instances",
"cluster_config.0.preemptible_worker_config.0.preemptibility",
"cluster_config.0.preemptible_worker_config.0.disk_config",
},
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"PREEMPTIBILITY_UNSPECIFIED", "NON_PREEMPTIBLE", "PREEMPTIBLE"}, false),
Default: "PREEMPTIBLE",
},

"disk_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: `Disk Config`,
AtLeastOneOf: []string{
"cluster_config.0.preemptible_worker_config.0.num_instances",
"cluster_config.0.preemptible_worker_config.0.preemptibility",
"cluster_config.0.preemptible_worker_config.0.disk_config",
},
MaxItems: 1,
Expand Down Expand Up @@ -982,9 +998,6 @@ func expandClusterConfig(d *schema.ResourceData, config *Config) (*dataproc.Clus
if cfg, ok := configOptions(d, "cluster_config.0.preemptible_worker_config"); ok {
log.Println("[INFO] got preemptible worker config")
conf.SecondaryWorkerConfig = expandPreemptibleInstanceGroupConfig(cfg)
if conf.SecondaryWorkerConfig.NumInstances > 0 {
conf.SecondaryWorkerConfig.IsPreemptible = true
}
}
return conf, nil
}
Expand Down Expand Up @@ -1221,6 +1234,9 @@ func expandPreemptibleInstanceGroupConfig(cfg map[string]interface{}) *dataproc.
}
}
}
if p, ok := cfg["preemptibility"]; ok {
icg.Preemptibility = p.(string)
}
return icg
}

Expand Down Expand Up @@ -1662,6 +1678,7 @@ func flattenPreemptibleInstanceGroupConfig(d *schema.ResourceData, icg *dataproc
if icg != nil {
data["num_instances"] = icg.NumInstances
data["instance_names"] = icg.InstanceNames
data["preemptibility"] = icg.Preemptibility
if icg.DiskConfig != nil {
disk["boot_disk_size_gb"] = icg.DiskConfig.BootDiskSizeGb
disk["num_local_ssds"] = icg.DiskConfig.NumLocalSsds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,27 @@ func TestAccDataprocCluster_updatable(t *testing.T) {
})
}

func TestAccDataprocCluster_nonPreemptibleSecondary(t *testing.T) {
t.Parallel()

rnd := randString(t, 10)
var cluster dataproc.Cluster
vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDataprocClusterDestroy(t),
Steps: []resource.TestStep{
{
Config: testAccDataprocCluster_nonPreemptibleSecondary(rnd),
Check: resource.ComposeTestCheckFunc(
testAccCheckDataprocClusterExists(t, "google_dataproc_cluster.non_preemptible_secondary", &cluster),
resource.TestCheckResourceAttr("google_dataproc_cluster.non_preemptible_secondary", "cluster_config.0.preemptible_worker_config.0.preemptibility", "NON_PREEMPTIBLE"),
),
},
},
})
}

func TestAccDataprocCluster_withStagingBucket(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -1352,6 +1373,41 @@ resource "google_dataproc_cluster" "updatable" {
`, rnd, w, p)
}

func testAccDataprocCluster_nonPreemptibleSecondary(rnd string) string {
return fmt.Sprintf(`
resource "google_dataproc_cluster" "non_preemptible_secondary" {
name = "tf-test-dproc-%s"
region = "us-central1"

cluster_config {
master_config {
num_instances = "1"
machine_type = "e2-medium"
disk_config {
boot_disk_size_gb = 35
}
}

worker_config {
num_instances = "2"
machine_type = "e2-medium"
disk_config {
boot_disk_size_gb = 35
}
}

preemptible_worker_config {
num_instances = "1"
preemptibility = "NON_PREEMPTIBLE"
disk_config {
boot_disk_size_gb = 35
}
}
}
}
`, rnd)
}

func testAccDataprocCluster_withStagingBucketOnly(bucketName string) string {
return fmt.Sprintf(`
resource "google_storage_bucket" "bucket" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,12 @@ will be set for you based on whatever was set for the `worker_config.machine_typ
* `num_instances`- (Optional) Specifies the number of preemptible nodes to create.
Defaults to 0.

* `preemptibility`- (Optional) Specifies the preemptibility of the secondary workers. The default value is `PREEMPTIBLE`
Accepted values are:
* PREEMPTIBILITY_UNSPECIFIED
* NON_PREEMPTIBLE
* PREEMPTIBLE

* `disk_config` (Optional) Disk Config

* `boot_disk_type` - (Optional) The disk type of the primary disk attached to each preemptible worker node.
Expand Down