Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions docs/docs/provider-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,21 @@ the value zero will be omitted from the request because GCP client
will not write any &ldquo;empty&rdquo; values to the request</p>
</td>
</tr>
<tr>
<td>
<code>storagePool</code>
</td>
<td>
<em>
string
</em>
</td>
<td>
<p>StoragePool in which the new disk is created.
You can provide this as a partial or full URL to the resource. For example
<a href="https://www.googleapis.com/compute/v1/projects/project/zones/zone">https://www.googleapis.com/compute/v1/projects/project/zones/zone</a></p>
</td>
</tr>
</tbody>
</table>
<br>
Expand Down
1 change: 1 addition & 0 deletions kubernetes/machine-class.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ providerSpec:
# kmsKeyServiceAccount: "[email protected]" # email of service account (optional)
# provisionedIops: 3000 # IOPS that the disk can handle (optional)
# provisionedThroughput: 140 # throughput unit in MB per sec (optional)
# storagePool: zones/zone/storagePools/storagePool # StoragePool where the new disk is created (optional)
Copy link
Member

Choose a reason for hiding this comment

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

Are these values fair and sensible defaults?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if I interpreted your comment exactly right, but I tweaked the storagePool field in the example to make it a bit clearer.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this is clear enough now
Thank you!

labels:
name: test-mc # Label assigned to the disk
labels:
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/v1alpha1/provider_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ type GCPDisk struct {
// the value zero will be omitted from the request because GCP client
// will not write any "empty" values to the request
ProvisionedThroughput int64 `json:"provisionedThroughput,omitempty"`

// StoragePool in which the new disk is created.
// You can provide this as a partial or full URL to the resource. For example
// https://www.googleapis.com/compute/v1/projects/project/zones/zone
StoragePool string `json:"storagePool,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

For backward compatibility, shouldn't this field be optional, i.e. of type *string and use it only when it is set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only place where we use this param is here.
And by default, AttachedDiskInitializeParams fields with empty or default values are omitted from API requests.
So unless we set it from outside it will be basically ignored.

Copy link
Member

Choose a reason for hiding this comment

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

I know this is not real API resource, it is just used for parsing yaml documents which are usually coming from providerConfig somewhere in a shoot manifest. In this case, it could be safe to not use pointers, but generally it would be nice to follow some conventions like https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md#new-field-in-existing-api-version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adjusted the PR to use *string instead.

}

// GCPDiskEncryption holds references to encryption data
Expand Down
1 change: 1 addition & 0 deletions pkg/gcp/machine_controller_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func createAttachedDisks(disks []*api.GCPDisk, zone, machineName string) []*comp
SourceImage: disk.Image,
ProvisionedIops: disk.ProvisionedIops,
ProvisionedThroughput: disk.ProvisionedThroughput,
StoragePool: disk.StoragePool,
},
}
}
Expand Down