Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions pkg/model/gcemodel/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ func (b *AutoscalingGroupModelBuilder) buildInstanceTemplate(c *fi.CloudupModelB
{
var volumeSize int32
var volumeType string
var volumeIops int32
var volumeThroughput int32
if ig.Spec.RootVolume != nil {
volumeSize = fi.ValueOf(ig.Spec.RootVolume.Size)
volumeType = fi.ValueOf(ig.Spec.RootVolume.Type)
volumeIops = fi.ValueOf(ig.Spec.RootVolume.IOPS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait - did GCP add the fields we already had in our schema? That was very kind of them :-)

volumeThroughput = fi.ValueOf(ig.Spec.RootVolume.Throughput)
}
if volumeSize == 0 {
volumeSize, err = defaults.DefaultInstanceGroupVolumeSize(ig.Spec.Role)
Expand Down Expand Up @@ -120,6 +124,13 @@ func (b *AutoscalingGroupModelBuilder) buildInstanceTemplate(c *fi.CloudupModelB
},
}

if volumeIops > 0 {
t.BootDiskIOPS = i64(int64(volumeIops))
}
if volumeThroughput > 0 {
t.BootDiskThroughput = i64(int64(volumeThroughput))
}

if startupScript != nil {
if !fi.ValueOf(b.Cluster.Spec.CloudProvider.GCE.UseStartupScript) {
// Use "user-data" instead of "startup-script", for compatibility with cloud-init
Expand Down
10 changes: 10 additions & 0 deletions pkg/model/master_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ func (b *MasterVolumeBuilder) addGCEVolume(c *fi.CloudupModelBuilderContext, pre
}
name := gce.ClusterSuffixedName(prefix, b.Cluster.ObjectMeta.Name, 63)

volumeIops := fi.ValueOf(m.VolumeIOPS)
volumeThroughput := fi.ValueOf(m.VolumeThroughput)

t := &gcetasks.Disk{
Name: fi.PtrTo(name),
Lifecycle: b.Lifecycle,
Expand All @@ -303,6 +306,13 @@ func (b *MasterVolumeBuilder) addGCEVolume(c *fi.CloudupModelBuilderContext, pre
Labels: tags,
}

if volumeIops > 0 {
t.VolumeIops = fi.PtrTo(int64(volumeIops))
}
if volumeThroughput > 0 {
t.VolumeThroughput = fi.PtrTo(int64(volumeThroughput))
}

c.AddTask(t)
}

Expand Down
96 changes: 52 additions & 44 deletions tests/integration/update_cluster/ha_gce/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -603,17 +603,19 @@ resource "google_compute_instance_group_manager" "c-nodes-ha-gce-example-com" {
resource "google_compute_instance_template" "master-us-test1-a-ha-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "ha-gce-example-com"
Expand Down Expand Up @@ -655,17 +657,19 @@ resource "google_compute_instance_template" "master-us-test1-a-ha-gce-example-co
resource "google_compute_instance_template" "master-us-test1-b-ha-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "ha-gce-example-com"
Expand Down Expand Up @@ -707,17 +711,19 @@ resource "google_compute_instance_template" "master-us-test1-b-ha-gce-example-co
resource "google_compute_instance_template" "master-us-test1-c-ha-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "ha-gce-example-com"
Expand Down Expand Up @@ -759,17 +765,19 @@ resource "google_compute_instance_template" "master-us-test1-c-ha-gce-example-co
resource "google_compute_instance_template" "nodes-ha-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "ha-gce-example-com"
Expand Down
48 changes: 26 additions & 22 deletions tests/integration/update_cluster/many-addons-gce/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -459,17 +459,19 @@ resource "google_compute_instance_group_manager" "a-nodes-minimal-example-com" {
resource "google_compute_instance_template" "master-us-test1-a-minimal-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "minimal-example-com"
Expand Down Expand Up @@ -511,17 +513,19 @@ resource "google_compute_instance_template" "master-us-test1-a-minimal-example-c
resource "google_compute_instance_template" "nodes-minimal-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "minimal-example-com"
Expand Down
48 changes: 26 additions & 22 deletions tests/integration/update_cluster/minimal_gce/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,19 @@ resource "google_compute_instance_group_manager" "a-nodes-minimal-gce-example-co
resource "google_compute_instance_template" "master-us-test1-a-minimal-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "minimal-gce-example-com"
Expand Down Expand Up @@ -487,17 +489,19 @@ resource "google_compute_instance_template" "master-us-test1-a-minimal-gce-examp
resource "google_compute_instance_template" "nodes-minimal-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "minimal-gce-example-com"
Expand Down
48 changes: 26 additions & 22 deletions tests/integration/update_cluster/minimal_gce_dns-none/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -499,17 +499,19 @@ resource "google_compute_instance_group_manager" "a-nodes-minimal-gce-example-co
resource "google_compute_instance_template" "master-us-test1-a-minimal-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 64
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "minimal-gce-example-com"
Expand Down Expand Up @@ -549,17 +551,19 @@ resource "google_compute_instance_template" "master-us-test1-a-minimal-gce-examp
resource "google_compute_instance_template" "nodes-minimal-gce-example-com" {
can_ip_forward = true
disk {
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
auto_delete = true
boot = true
device_name = "persistent-disks-0"
disk_name = ""
disk_size_gb = 128
disk_type = "pd-standard"
interface = ""
mode = "READ_WRITE"
provisioned_iops = 0
provisioned_throughput = 0
source = ""
source_image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2004-focal-v20221018"
type = "PERSISTENT"
}
labels = {
"k8s-io-cluster-name" = "minimal-gce-example-com"
Expand Down
Loading
Loading