Skip to content

Commit 7203441

Browse files
committed
feat: add enableEFI and enableSecureBoot
Signed-off-by: PoAn Yang <poan.yang@suse.com>
1 parent 2785ae4 commit 7203441

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

rancher2/schema_machine_config_v2_harvester.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ func machineConfigV2HarvesterFields() map[string]*schema.Schema {
122122
Optional: true,
123123
Description: "NetworkData content of cloud-init, base64 is supported",
124124
},
125+
"enable_efi": {
126+
Type: schema.TypeBool,
127+
Optional: true,
128+
Default: false,
129+
Description: "Enable EFI mode",
130+
},
131+
"enable_secure_boot": {
132+
Type: schema.TypeBool,
133+
Optional: true,
134+
Default: false,
135+
Description: "Enable secure boot, only available when enable_efi is true",
136+
},
125137
}
126138

127139
return s

rancher2/structure_machine_config_v2_harvester.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ type machineConfigV2Harvester struct {
3232
NetworkInfo string `json:"networkInfo,omitempty" yaml:"networkInfo,omitempty"`
3333
UserData string `json:"userData,omitempty" yaml:"userData,omitempty"`
3434
NetworkData string `json:"networkData,omitempty" yaml:"networkData,omitempty"`
35+
EnableEFI bool `json:"enableEfi,omitempty" yaml:"enableEfi,omitempty"`
36+
EnableSecureBoot bool `json:"enableSecureBoot,omitempty" yaml:"enableSecureBoot,omitempty"`
3537
}
3638

3739
type MachineConfigV2Harvester struct {
@@ -108,6 +110,14 @@ func flattenMachineConfigV2Harvester(in *MachineConfigV2Harvester) []interface{}
108110
obj["network_data"] = in.NetworkData
109111
}
110112

113+
if in.EnableEFI {
114+
obj["enable_efi"] = in.EnableEFI
115+
}
116+
117+
if in.EnableSecureBoot {
118+
obj["enable_secure_boot"] = in.EnableSecureBoot
119+
}
120+
111121
return []interface{}{obj}
112122
}
113123

@@ -189,5 +199,13 @@ func expandMachineConfigV2Harvester(p []interface{}, source *MachineConfigV2) *M
189199
obj.NetworkData = v
190200
}
191201

202+
if v, ok := in["enable_efi"].(bool); ok && v {
203+
obj.EnableEFI = v
204+
}
205+
206+
if v, ok := in["enable_secure_boot"].(bool); ok && v {
207+
obj.EnableSecureBoot = v
208+
}
209+
192210
return obj
193211
}

0 commit comments

Comments
 (0)