✨Allow diskSetup to include partition layout#11634
✨Allow diskSetup to include partition layout#11634miltalex wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
|
|
|
This PR is currently missing an area label, which is used to identify the modified component when generating release notes. Area labels can be added by org members by writing Please see the labels list for possible areas. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Welcome @miltalex! |
|
Hi @miltalex. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
JoelSpeed
left a comment
There was a problem hiding this comment.
Some initial thoughts on the API changes within this PR
| // Percentage of disk that partition will take (1-100) | ||
| // +kubebuilder:validation:Minimum=1 | ||
| // +kubebuilder:validation:Maximum=100 | ||
| Percentage int32 `json:"percentage"` |
There was a problem hiding this comment.
You should include a required marker to show explicitly that this is required
|
|
||
| // PartitionType is the numerical value of the partition type (optional) | ||
| // +optional | ||
| PartitionType *int32 `json:"partitionType,omitempty"` |
There was a problem hiding this comment.
What are the valid values for this value? And how would I, as an end user, understand those?
Is there a limit on this? Is 0 a valid value? Are negative values valid?
There was a problem hiding this comment.
Actually I can use a string here to reflect the correct linux partition types. It was an attempt to purely map the disk layout as described in the cloud init docs.
There was a problem hiding this comment.
There's a choice to make here. Either you can allow all of the valid values there, in which case this should be a 2 character lowercase hex value. Or, you can allow specific, common types, and do that by creating an Enum here and creating PascalCase aliases to the formats we actually want to support.
IMO, the latter provides a better UX
There was a problem hiding this comment.
Updated the code to reflect common types using enum
| } | ||
|
|
||
| // DiskLayout represents an array of partition specifications | ||
| type DiskLayout []PartitionSpec |
There was a problem hiding this comment.
I would avoid a type alias to a slice, it makes it harder to understand the API when looking at the go types (it looks like a struct for example if I look at the Partition usage)
There was a problem hiding this comment.
I just meant you could inline this slice, rather than using an alias, I don't think it needs to be a struct does it?
|
|
||
| // PartitionSpec defines the size and optional type for a partition | ||
| type PartitionSpec struct { | ||
| // Percentage of disk that partition will take (1-100) |
There was a problem hiding this comment.
Godoc must start with the serialised version of the field name
| // Percentage of disk that partition will take (1-100) | |
| // percentage of disk that partition will take (1-100) |
| // +kubebuilder:validation:Maximum=100 | ||
| Percentage int32 `json:"percentage"` | ||
|
|
||
| // PartitionType is the numerical value of the partition type (optional) |
There was a problem hiding this comment.
| // PartitionType is the numerical value of the partition type (optional) | |
| // partitionType is the numerical value of the partition type (optional) |
| // layout specifies the device layout. | ||
| // If it is true, a single partition will be created for the entire device. | ||
| // When layout is false, it means don't partition or ignore existing partitioning. | ||
| Layout bool `json:"layout"` | ||
|
|
||
| // diskLayout specifies the percentage of disk space and partition types. |
There was a problem hiding this comment.
Is this list ordered?
Can you validate that the percentages sum to 100? Are they allowed to sum to less than 100?
There was a problem hiding this comment.
yeah the list is strictly ordered added a check to validate sum is less than 100
|
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
|
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
|
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
|
@k8s-triage-robot: Closed this PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/reopen |
|
@miltalex: Reopened this PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
3560524 to
55c44ce
Compare
55c44ce to
92a33aa
Compare
|
/remove-lifecycle rotten |
|
@JoelSpeed I did a rebase and addressed your initial comments. I would appreciate a review whenever time permits |
Signed-off-by: Miltiadis Alexis <alexmiltiadis@gmail.com>
92a33aa to
618f83b
Compare
What this PR does / why we need it:
This PR enhances disk partitioning capabilities by introducing support for custom partition layouts through the new
DiskLayoutfield. Previously, disk partitioning was limited to a boolean option that could only create a single partition for the entire device. This enhancement allows users to define multiple partitions with specific size percentages and partition types.The changes align with cloud_init logic's disk setup specification, which supports both boolean and list-based partition layouts. The existing
layoutboolean field is maintained for backward compatibility, while the newdiskLayoutfield provides advanced partitioning capabilities when needed.Examples
Before (Single Partition):
After (Multiple Partitions):
Generated cloud-init output:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #8524