Skip to content

Commit 1e62d51

Browse files
committed
Installer, Multiple disk setup
1 parent 3a9264e commit 1e62d51

File tree

1 file changed

+265
-0
lines changed

1 file changed

+265
-0
lines changed
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
---
2+
title: multiple-disk-setup-installer
3+
authors:
4+
- Joseph Callen
5+
reviewers:
6+
- "@vr4manta"
7+
- "@JoelSpeed"
8+
- "@patrickdillon"
9+
- "@yuqi-zhang"
10+
approvers:
11+
- "@patrickdillon"
12+
api-approvers: # If new CRDs or API fields are introduced to a shared API (e.g. machine.openshift.io)
13+
-
14+
creation-date: 2025-05-16
15+
last-updated: 2025-05-16
16+
tracking-link:
17+
- https://issues.redhat.com/browse/OCPSTRAT-2046
18+
see-also:"/enhancements/"
19+
-
20+
replaces:
21+
-
22+
superseded-by:
23+
-
24+
---
25+
26+
# Multiple Disk Setup in Installer
27+
28+
This enhancement outlines the design for supporting multiple disk setup within the installer. The initial changes will focus on the installer's capability to generate an ignition config that correctly creates partitions, file systems, and systemd mounts for these disks.
29+
30+
## Summary
31+
32+
This enhancement proposes to extend the installer to support configurations for multiple disks. This will allow users to define specific roles for additional disks, such as for `etcd` data, `swap` space, or other `user-defined` mount points. The installer will generate the necessary ignition configuration to partition, format, and mount these disks as specified by the user during the installation process.
33+
34+
## Motivation
35+
36+
Currently, the installer has limited explicit support for configuring multiple disks with distinct roles during the initial setup. Users often require dedicated disks for performance, capacity, or specific application needs (e.g., separating etcd I/O, providing swap). This enhancement aims to provide a streamlined and supported way to declare these multi-disk configurations directly through the installer, simplifying the deployment process for such scenarios.
37+
38+
### User Stories
39+
40+
* As a cluster administrator, I want to specify a dedicated disk for etcd during installation, so that I can ensure etcd has isolated I/O performance and dedicated storage.
41+
* As a cluster administrator, I want to configure a dedicated swap disk during installation, so that I can provide swap space for nodes that require it.
42+
* As a cluster administrator, I want to define custom mount points on additional disks for specific application data or utilities during installation, so that I can prepare nodes with pre-configured storage layouts.
43+
* As an installer developer, I want a clear API within the machine pool definition to specify additional disks and their purposes, so that I can reliably generate the corresponding ignition configurations.
44+
45+
### Goals
46+
47+
* Enable the installer to accept configurations for multiple disks per machine pool.
48+
* Define clear types for these additional disks (e.g., Etcd, Swap, UserDefined).
49+
* Generate ignition configurations that create the necessary partitions, file systems (e.g., XFS, ext4), and systemd mount units for the specified disks.
50+
* Ensure the initial implementation is isolated to the installer and its ignition generation capabilities.
51+
52+
### Non-Goals
53+
54+
* Dynamic disk management post-installation (this will be handled by storage operators or manual intervention).
55+
* Complex RAID configurations via the installer (simple disk partitioning and formatting is the focus).
56+
* Support for all possible file systems; a common default (e.g., XFS or ext4) will be used, with potential for future extension.
57+
* Changes to how the operating system image itself is deployed to the primary disk.
58+
59+
## Proposal
60+
61+
The core of this proposal is to introduce new structures within the machine pool API that allow users to declare additional disks and their intended use. The installer will then interpret these declarations to generate the appropriate `storage` and `systemd` sections in the ignition config.
62+
63+
### Workflow Description
64+
65+
1. The **cluster creator** defines an `install-config.yaml` (or equivalent API input).
66+
2. Within the machine pool definition (e.g., for control plane or worker nodes), the cluster creator specifies an array of `Disk` objects.
67+
3. Each `Disk` object will specify its `Type` (`Etcd`, `Swap`, or `UserDefined`) and the necessary parameters like `PlatformDiskID` (referring to a disk available on the platform, e.g., `/dev/sdb`, `nvme1n1`) and `MountPath` for `UserDefined` disks.
68+
4. The installer reads this configuration.
69+
5. For each specified `Disk`:
70+
* The installer generates ignition file entries to create a partition on the `PlatformDiskID`. A simple, single full-disk partition will be assumed initially.
71+
* It generates entries to format the partition with a default filesystem (e.g., XFS). For `Swap` type, it will be formatted as swap.
72+
* It generates systemd mount unit entries to mount the filesystem at the specified `MountPath` (for `UserDefined` and a default path for `Etcd`, e.g., `/var/lib/etcd`). For `Swap`, it generates the entry to enable the swap space.
73+
6. The generated ignition config is then used to provision the machines.
74+
7. Upon boot, ignition processes these configurations, partitioning, formatting, and mounting the additional disks.
75+
76+
### Installer Machine Pool changes
77+
78+
This enhancement introduces the following new types to the machine pool API:
79+
80+
```go
81+
type DiskType string
82+
83+
const (
84+
Etcd DiskType = "etcd"
85+
Swap DiskType = "swap"
86+
UserDefined DiskType = "user-defined"
87+
)
88+
89+
type Disk struct {
90+
Type DiskType `json:"type,omitempty"`
91+
92+
UserDefined *DiskUserDefined `json:"userDefined,omitempty"`
93+
Etcd *DiskEtcd `json:"etcd,omitempty"`
94+
Swap *DiskSwap `json:"swap,omitempty"`
95+
}
96+
97+
type DiskUserDefined struct {
98+
PlatformDiskID string `json:"platformDiskID,omitempty"` // e.g., /dev/sdb, by-id/ata-*, etc.
99+
MountPath string `json:"mountPath,omitempty"` // e.g., /var/custom-data
100+
}
101+
102+
type DiskSwap struct {
103+
PlatformDiskID string `json:"platformDiskID,omitempty"` // e.g., /dev/sdc
104+
}
105+
106+
type DiskEtcd struct {
107+
PlatformDiskID string `json:"platformDiskID,omitempty"` // e.g., /dev/sdd
108+
// MountPath for etcd will be implicitly /var/lib/etcd or a standard, configurable default.
109+
}
110+
```
111+
112+
113+
* This enhancement modifies the behavior of the installer to interpret these new API fields and generate corresponding ignition configurations.
114+
* It does not directly modify existing resources owned by other parties but generates configuration that affects node storage layout.
115+
116+
117+
### Installer ignition additions
118+
119+
120+
This currently is an incomplete example, would be replaced with switch/case for each platforms' implementation of additional disks.
121+
122+
```go
123+
124+
if installConfig.Config.ControlPlane != nil {
125+
for i, d := range installConfig.Config.ControlPlane.DiskSetup {
126+
if d.Type == types.Etcd {
127+
128+
// platform specific...
129+
if installConfig.Config.ControlPlane.Platform.Azure != nil {
130+
azurePlatform := installConfig.Config.ControlPlane.Platform.Azure
131+
if d.Etcd.PlatformDiskID == azurePlatform.DataDisks[i].NameSuffix {
132+
device := fmt.Sprintf("/dev/disk/azure/scsi1/lun%d", *azurePlatform.DataDisks[i].Lun)
133+
AddEtcdDisk(a.Config, device)
134+
}
135+
}
136+
}
137+
}
138+
}
139+
140+
141+
142+
func AddEtcdDisk(config *igntypes.Config, device string) {
143+
config.Storage.Disks = append(config.Storage.Disks, igntypes.Disk{
144+
Device: device,
145+
Partitions: []igntypes.Partition{{
146+
Label: ptr.To("etcddisk"),
147+
StartMiB: ptr.To(0),
148+
SizeMiB: ptr.To(0),
149+
}},
150+
WipeTable: ptr.To(true),
151+
})
152+
153+
config.Storage.Filesystems = append(config.Storage.Filesystems, igntypes.Filesystem{
154+
Device: "/dev/disk/by-partlabel/etcddisk",
155+
Format: ptr.To("xfs"),
156+
Label: ptr.To("etcdpart"),
157+
MountOptions: []igntypes.MountOption{"defaults", "prjquota"},
158+
Path: ptr.To("/var/lib/etcd"),
159+
WipeFilesystem: ptr.To(true),
160+
})
161+
config.Systemd.Units = append(config.Systemd.Units, igntypes.Unit{
162+
Name: "var-lib-etcd.mount",
163+
Enabled: ptr.To(true),
164+
Contents: ptr.To(`
165+
[Unit]
166+
Requires=systemd-fsck@dev-disk-by\x2dpartlabel-var.service
167+
After=systemd-fsck@dev-disk-by\x2dpartlabel-var.service
168+
169+
[Mount]
170+
Where=/var/lib/etcd
171+
What=/dev/disk/by-partlabel/etcddisk
172+
Type=xfs
173+
Options=defaults,prjquota
174+
175+
[Install]
176+
RequiredBy=local-fs.target
177+
`),
178+
})
179+
}
180+
181+
```
182+
183+
### Topology Considerations
184+
185+
#### Standalone Clusters
186+
187+
188+
### Implementation Details/Notes/Constraints
189+
190+
* **Disk Identification:** `PlatformDiskID` will rely on user-provided identifiers that are stable and predictable by the time ignition runs (e.g., `/dev/disk/by-id/...` is preferred over `/dev/sdx` names). The installer will not perform disk discovery; it will trust the user-provided ID.
191+
* **Partitioning:** Initially, the proposal is to use the entire disk for a single partition.
192+
* **Filesystem:** A default filesystem XFS will be used for `Etcd` and `UserDefined` disks.
193+
* **Error Handling:** If a specified `PlatformDiskID` is not found by ignition, the mount will fail. The node may or may not come up healthy depending on the criticality of the mount (e.g., a failed etcd disk mount would be critical for a control plane node). This needs to be clearly documented.
194+
* **Idempotency:** Ignition's handling of filesystems and mounts is generally idempotent.
195+
* **Security:** Standard file permissions will be applied. No special SELinux labeling is planned for the initial implementation beyond what the system defaults for the given mount point.
196+
197+
### Risks and Mitigations
198+
199+
* **Risk:** User provides an incorrect `PlatformDiskID`, leading to formatting the wrong disk or installation failure.
200+
* **Mitigation:** Clear documentation and examples emphasizing the use of stable disk IDs (e.g., `/dev/disk/by-id/*`). The installer could potentially perform basic validation on the format of the ID but cannot guarantee its existence on the target machine.
201+
* **Risk:** Conflicts with other processes or installer steps trying to use the same disk.
202+
* **Mitigation:** The disks specified for these additional roles should be distinct from the primary OS disk and any disks managed by other operators (like local storage operator) unless explicitly coordinated.
203+
* **Risk:** Ignition generation logic becomes overly complex.
204+
* **Mitigation:** Start with simple cases (single partition, default filesystem) and iterate.
205+
* **Security Review:** Will be required, focusing on how disk access and mount options are handled. Input from security teams will be solicited.
206+
* **UX Review:** Simplicity of the API and clarity of documentation are key. UX review will ensure the configuration is intuitive.
207+
208+
### Drawbacks
209+
210+
* Potential for user error in specifying disk IDs, which can have destructive consequences if the wrong disk is targeted (though ignition typically runs before significant data exists on new nodes).
211+
212+
## Alternatives (Not Implemented)
213+
214+
* **Relying on Day-2 Operations:** Users could manually partition and mount disks after the cluster is up, or use operators like the Local Storage Operator. This proposal aims to make these common configurations available at installation time for simplicity and to ensure critical mounts (like etcd) are present from the first boot.
215+
216+
## Open Questions [optional]
217+
218+
219+
## Test Plan
220+
221+
**Note:** *Section not required until targeted at a release.*
222+
223+
* Unit tests for the ignition generation logic based on various `Disk` configurations.
224+
* E2E tests involving deploying clusters with:
225+
* Dedicated etcd disks.
226+
* Dedicated swap disks.
227+
* User-defined disks with specified mount points.
228+
* Tests will verify that disks are correctly partitioned, formatted, and mounted, and that services like etcd utilize their dedicated storage.
229+
* Testing across different cloud platforms and bare metal to ensure `PlatformDiskID` handling is robust.
230+
231+
## Graduation Criteria
232+
233+
**Note:** *Section not required until targeted at a release.*
234+
235+
### Dev Preview -> Tech Preview
236+
237+
### Tech Preview -> GA
238+
239+
* Core functionality implemented: partitioning, formatting (default FS), and mounting for Etcd, Swap, UserDefined disk types.
240+
* Ability to specify `PlatformDiskID`.
241+
* Basic e2e tests pass for common scenarios.
242+
* Potentially allow configuration of filesystem type if strong demand exists.
243+
244+
### Removing a deprecated feature
245+
246+
Not applicable for this initial enhancement.
247+
248+
## Upgrade / Downgrade Strategy
249+
250+
* **Upgrade:** This feature primarily affects ignition generation. Upgrading an installer to a version with this feature will allow new clusters or new machine pools (if applicable post-install) to use it. Existing machine pools will not be affected unless re-provisioned with a configuration that uses these new fields. No changes are required for existing clusters to keep previous behavior.
251+
252+
## Version Skew Strategy
253+
254+
* This feature is primarily contained within the installer and the ignition config it produces. The ignition version consumed by the OS (e.g., RHCOS/FCOS) must support the storage (`files`, `filesystems`, `raid`) and `systemd` unit configurations generated. Standard ignition features will be used, minimizing skew risks with the OS.
255+
* No direct interaction with other control plane components that would cause version skew issues beyond the installer's interaction with the machine API (if these fields are added there).
256+
257+
## Operational Aspects of API Extensions
258+
259+
260+
## Support Procedures
261+
262+
263+
## Infrastructure Needed [optional]
264+
265+
* CI jobs will need to be updated or created to test configurations with multiple disks, potentially requiring CI environments that can simulate or provide multiple attachable disk devices.

0 commit comments

Comments
 (0)