Skip to content

Commit b453385

Browse files
committed
feat: support volume configuration, provisioning, etc
This implements the first round of changes, replacing the volume backend with the new implementation, while keeping most of the external interfaces intact. See siderolabs#8367 Signed-off-by: Andrey Smirnov <[email protected]>
1 parent b6b16b3 commit b453385

File tree

123 files changed

+13525
-3775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+13525
-3775
lines changed

api/api.descriptors

13.4 KB
Binary file not shown.

api/prototool.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ lint:
88
ignores:
99
- id: FILE_OPTIONS_GO_PACKAGE_NOT_LONG_FORM
1010
files:
11-
- vendor/google/rpc/status.proto
11+
- vendor/google/
1212

1313
rules:
1414
# The specific linters to add.

api/resource/definitions/block/block.proto

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ package talos.resource.definitions.block;
55
option go_package = "github.com/siderolabs/talos/pkg/machinery/api/resource/definitions/block";
66
option java_package = "dev.talos.api.resource.definitions.block";
77

8+
import "google/api/expr/v1alpha1/checked.proto";
9+
import "resource/definitions/enums/enums.proto";
10+
811
// DeviceSpec is the spec for devices status.
912
message DeviceSpec {
1013
string type = 1;
@@ -17,7 +20,7 @@ message DeviceSpec {
1720
string parent = 8;
1821
}
1922

20-
// DiscoveredVolumeSpec is the spec for DiscoveredVolumes status.
23+
// DiscoveredVolumeSpec is the spec for DiscoveredVolumes resource.
2124
message DiscoveredVolumeSpec {
2225
uint64 size = 1;
2326
uint64 sector_size = 2;
@@ -35,6 +38,24 @@ message DiscoveredVolumeSpec {
3538
string type = 14;
3639
string device_path = 15;
3740
string parent = 16;
41+
string dev_path = 17;
42+
string parent_dev_path = 18;
43+
string pretty_size = 19;
44+
}
45+
46+
// DiscoveryRefreshRequestSpec is the spec for DiscoveryRefreshRequest.
47+
message DiscoveryRefreshRequestSpec {
48+
int64 request = 1;
49+
}
50+
51+
// DiscoveryRefreshStatusSpec is the spec for DiscoveryRefreshStatus status.
52+
message DiscoveryRefreshStatusSpec {
53+
int64 request = 1;
54+
}
55+
56+
// DiskSelector selects a disk for the volume.
57+
message DiskSelector {
58+
google.api.expr.v1alpha1.CheckedExpr match = 1;
3859
}
3960

4061
// DiskSpec is the spec for Disks status.
@@ -52,10 +73,96 @@ message DiskSpec {
5273
string transport = 11;
5374
bool rotational = 12;
5475
bool cdrom = 13;
76+
string dev_path = 14;
77+
string pretty_size = 15;
5578
}
5679

57-
// SystemDiskSpec is the spec for SystemDisks status.
80+
// EncryptionKey is the spec for volume encryption key.
81+
message EncryptionKey {
82+
int64 slot = 1;
83+
talos.resource.definitions.enums.BlockEncryptionKeyType type = 2;
84+
bytes static_passphrase = 3;
85+
string kms_endpoint = 4;
86+
bool tpm_check_secureboot_status_on_enroll = 5;
87+
}
88+
89+
// EncryptionSpec is the spec for volume encryption.
90+
message EncryptionSpec {
91+
talos.resource.definitions.enums.BlockEncryptionProviderType provider = 1;
92+
repeated EncryptionKey keys = 2;
93+
string cipher = 3;
94+
uint64 key_size = 4;
95+
uint64 block_size = 5;
96+
repeated string perf_options = 6;
97+
}
98+
99+
// FilesystemSpec is the spec for volume filesystem.
100+
message FilesystemSpec {
101+
talos.resource.definitions.enums.BlockFilesystemType type = 1;
102+
string label = 2;
103+
}
104+
105+
// LocatorSpec is the spec for volume locator.
106+
message LocatorSpec {
107+
google.api.expr.v1alpha1.CheckedExpr match = 1;
108+
}
109+
110+
// MountSpec is the spec for volume mount.
111+
message MountSpec {
112+
string target_path = 1;
113+
}
114+
115+
// PartitionSpec is the spec for volume partitioning.
116+
message PartitionSpec {
117+
uint64 min_size = 1;
118+
uint64 max_size = 2;
119+
bool grow = 3;
120+
string label = 4;
121+
string type_uuid = 5;
122+
}
123+
124+
// ProvisioningSpec is the spec for volume provisioning.
125+
message ProvisioningSpec {
126+
DiskSelector disk_selector = 1;
127+
PartitionSpec partition_spec = 2;
128+
int64 wave = 3;
129+
FilesystemSpec filesystem_spec = 4;
130+
}
131+
132+
// SystemDiskSpec is the spec for SystemDisks resource.
58133
message SystemDiskSpec {
59134
string disk_id = 1;
135+
string dev_path = 2;
136+
}
137+
138+
// UserDiskConfigStatusSpec is the spec for UserDiskConfigStatus resource.
139+
message UserDiskConfigStatusSpec {
140+
bool ready = 1;
141+
}
142+
143+
// VolumeConfigSpec is the spec for VolumeConfig resource.
144+
message VolumeConfigSpec {
145+
string parent_id = 1;
146+
talos.resource.definitions.enums.BlockVolumeType type = 2;
147+
ProvisioningSpec provisioning = 3;
148+
LocatorSpec locator = 4;
149+
MountSpec mount = 5;
150+
EncryptionSpec encryption = 6;
151+
}
152+
153+
// VolumeStatusSpec is the spec for VolumeStatus resource.
154+
message VolumeStatusSpec {
155+
talos.resource.definitions.enums.BlockVolumePhase phase = 1;
156+
string location = 2;
157+
string error_message = 3;
158+
string uuid = 4;
159+
string partition_uuid = 5;
160+
talos.resource.definitions.enums.BlockVolumePhase pre_fail_phase = 6;
161+
string parent_location = 7;
162+
int64 partition_index = 8;
163+
uint64 size = 9;
164+
talos.resource.definitions.enums.BlockFilesystemType filesystem = 10;
165+
string mount_location = 11;
166+
talos.resource.definitions.enums.BlockEncryptionProviderType encryption_provider = 12;
60167
}
61168

api/resource/definitions/enums/enums.proto

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,45 @@ enum NethelpersVLANProtocol {
354354
VLAN_PROTOCOL8021_AD = 34984;
355355
}
356356

357+
// BlockEncryptionKeyType describes encryption key type.
358+
enum BlockEncryptionKeyType {
359+
ENCRYPTION_KEY_STATIC = 0;
360+
ENCRYPTION_KEY_NODE_ID = 1;
361+
ENCRYPTION_KEY_KMS = 2;
362+
ENCRYPTION_KEY_TPM = 3;
363+
}
364+
365+
// BlockEncryptionProviderType describes encryption provider type.
366+
enum BlockEncryptionProviderType {
367+
ENCRYPTION_PROVIDER_NONE = 0;
368+
ENCRYPTION_PROVIDER_LUKS2 = 1;
369+
}
370+
371+
// BlockFilesystemType describes filesystem type.
372+
enum BlockFilesystemType {
373+
FILESYSTEM_TYPE_NONE = 0;
374+
FILESYSTEM_TYPE_XFS = 1;
375+
}
376+
377+
// BlockVolumePhase describes volume phase.
378+
enum BlockVolumePhase {
379+
VOLUME_PHASE_WAITING = 0;
380+
VOLUME_PHASE_FAILED = 1;
381+
VOLUME_PHASE_MISSING = 2;
382+
VOLUME_PHASE_LOCATED = 3;
383+
VOLUME_PHASE_PROVISIONED = 4;
384+
VOLUME_PHASE_PREPARED = 5;
385+
VOLUME_PHASE_READY = 6;
386+
VOLUME_PHASE_CLOSED = 7;
387+
}
388+
389+
// BlockVolumeType describes volume type.
390+
enum BlockVolumeType {
391+
VOLUME_TYPE_PARTITION = 0;
392+
VOLUME_TYPE_DISK = 1;
393+
VOLUME_TYPE_TMPFS = 2;
394+
}
395+
357396
// KubespanPeerState is KubeSpan peer current state.
358397
enum KubespanPeerState {
359398
PEER_STATE_UNKNOWN = 0;

0 commit comments

Comments
 (0)