-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨Allow diskSetup to include partition layout #11634
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -675,19 +675,40 @@ type DiskSetup struct { | |
Filesystems []Filesystem `json:"filesystems,omitempty"` | ||
} | ||
|
||
// PartitionSpec defines the size and optional type for a partition | ||
type PartitionSpec struct { | ||
// percentage of disk that partition will take (1-100) | ||
// +kubebuilder:validation:Minimum=1 | ||
// +kubebuilder:validation:Maximum=100 | ||
// +required | ||
Percentage int32 `json:"percentage"` | ||
|
||
// partitionType is the numerical value of the partition type (optional) | ||
// +optional | ||
PartitionType *int32 `json:"partitionType,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
} | ||
|
||
// Partition defines how to create and layout a partition. | ||
type Partition struct { | ||
// device is the name of the device. | ||
Device string `json:"device"` | ||
|
||
// 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this list ordered? Can you validate that the percentages sum to 100? Are they allowed to sum to less than 100? |
||
// If specified, this will override the Layout field. | ||
// +optional | ||
DiskLayout []PartitionSpec `json:"diskLayout,omitempty"` | ||
|
||
// overwrite describes whether to skip checks and create the partition if a partition or filesystem is found on the device. | ||
// Use with caution. Default is 'false'. | ||
// +optional | ||
Overwrite *bool `json:"overwrite,omitempty"` | ||
// tableType specifies the tupe of partition table. The following are supported: | ||
|
||
// tableType specifies the type of partition table. The following are supported: | ||
// 'mbr': default and setups a MS-DOS partition table | ||
// 'gpt': setups a GPT partition table | ||
// +optional | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should include a required marker to show explicitly that this is required