Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rancher2/schema_machine_config_v2_harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ func machineConfigV2HarvesterFields() map[string]*schema.Schema {
Default: "4",
Description: "Memory size (in GiB)",
},
"reserved_memory_size": {
Type: schema.TypeString,
Optional: true,
Description: "Reserved memory size (in MiB)",
},
"disk_size": {
Type: schema.TypeString,
Optional: true,
Expand Down
36 changes: 21 additions & 15 deletions rancher2/schema_node_template_harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,22 @@ const (
//Types

type harvesterConfig struct {
VMNamespace string `json:"vmNamespace,omitempty" yaml:"vmNamespace,omitempty"`
VMAffinity string `json:"vmAffinity,omitempty" yaml:"vmAffinity,omitempty"`
CPUCount string `json:"cpuCount,omitempty" yaml:"cpuCount,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memorySize,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"diskSize,omitempty"`
DiskBus string `json:"diskBus,omitempty" yaml:"diskBus,omitempty"`
ImageName string `json:"imageName,omitempty" yaml:"imageName,omitempty"`
DiskInfo string `json:"diskInfo,omitempty" yaml:"diskInfo,omitempty"`
SSHUser string `json:"sshUser,omitempty" yaml:"sshUser,omitempty"`
SSHPassword string `json:"sshPassword,omitempty" yaml:"sshPassword,omitempty"`
NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"`
NetworkModel string `json:"networkModel,omitempty" yaml:"networkModel,omitempty"`
NetworkInfo string `json:"networkInfo,omitempty" yaml:"networkInfo,omitempty"`
UserData string `json:"userData,omitempty" yaml:"userData,omitempty"`
NetworkData string `json:"networkData,omitempty" yaml:"networkData,omitempty"`
VMNamespace string `json:"vmNamespace,omitempty" yaml:"vmNamespace,omitempty"`
VMAffinity string `json:"vmAffinity,omitempty" yaml:"vmAffinity,omitempty"`
CPUCount string `json:"cpuCount,omitempty" yaml:"cpuCount,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memorySize,omitempty"`
ReservedMemorySize string `json:"reservedMemorySize,omitempty" yaml:"reservedMemorySize,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"diskSize,omitempty"`
DiskBus string `json:"diskBus,omitempty" yaml:"diskBus,omitempty"`
ImageName string `json:"imageName,omitempty" yaml:"imageName,omitempty"`
DiskInfo string `json:"diskInfo,omitempty" yaml:"diskInfo,omitempty"`
SSHUser string `json:"sshUser,omitempty" yaml:"sshUser,omitempty"`
SSHPassword string `json:"sshPassword,omitempty" yaml:"sshPassword,omitempty"`
NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"`
NetworkModel string `json:"networkModel,omitempty" yaml:"networkModel,omitempty"`
NetworkInfo string `json:"networkInfo,omitempty" yaml:"networkInfo,omitempty"`
UserData string `json:"userData,omitempty" yaml:"userData,omitempty"`
NetworkData string `json:"networkData,omitempty" yaml:"networkData,omitempty"`
}

//Schemas
Expand Down Expand Up @@ -65,6 +66,11 @@ func harvesterConfigFields() map[string]*schema.Schema {
Default: "4",
Description: "Memory size (in GiB)",
},
"reserved_memory_size": {
Type: schema.TypeString,
Optional: true,
Description: "Reserved memory size (in MiB)",
},
"disk_size": {
Type: schema.TypeString,
Optional: true,
Expand Down
43 changes: 26 additions & 17 deletions rancher2/structure_machine_config_v2_harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@ const (
//Types

type machineConfigV2Harvester struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
VMNamespace string `json:"vmNamespace,omitempty" yaml:"vmNamespace,omitempty"`
VMAffinity string `json:"vmAffinity,omitempty" yaml:"vmAffinity,omitempty"`
CPUCount string `json:"cpuCount,omitempty" yaml:"cpuCount,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memorySize,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"diskSize,omitempty"`
DiskBus string `json:"diskBus,omitempty" yaml:"diskBus,omitempty"`
ImageName string `json:"imageName,omitempty" yaml:"imageName,omitempty"`
DiskInfo string `json:"diskInfo,omitempty" yaml:"diskInfo,omitempty"`
SSHUser string `json:"sshUser,omitempty" yaml:"sshUser,omitempty"`
SSHPassword string `json:"sshPassword,omitempty" yaml:"sshPassword,omitempty"`
NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"`
NetworkModel string `json:"networkModel,omitempty" yaml:"networkModel,omitempty"`
NetworkInfo string `json:"networkInfo,omitempty" yaml:"networkInfo,omitempty"`
UserData string `json:"userData,omitempty" yaml:"userData,omitempty"`
NetworkData string `json:"networkData,omitempty" yaml:"networkData,omitempty"`
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
VMNamespace string `json:"vmNamespace,omitempty" yaml:"vmNamespace,omitempty"`
VMAffinity string `json:"vmAffinity,omitempty" yaml:"vmAffinity,omitempty"`
CPUCount string `json:"cpuCount,omitempty" yaml:"cpuCount,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memorySize,omitempty"`
ReservedMemorySize string `json:"reservedMemorySize,omitempty" yaml:"reservedMemorySize,omitempty"`
DiskSize string `json:"diskSize,omitempty" yaml:"diskSize,omitempty"`
DiskBus string `json:"diskBus,omitempty" yaml:"diskBus,omitempty"`
ImageName string `json:"imageName,omitempty" yaml:"imageName,omitempty"`
DiskInfo string `json:"diskInfo,omitempty" yaml:"diskInfo,omitempty"`
SSHUser string `json:"sshUser,omitempty" yaml:"sshUser,omitempty"`
SSHPassword string `json:"sshPassword,omitempty" yaml:"sshPassword,omitempty"`
NetworkName string `json:"networkName,omitempty" yaml:"networkName,omitempty"`
NetworkModel string `json:"networkModel,omitempty" yaml:"networkModel,omitempty"`
NetworkInfo string `json:"networkInfo,omitempty" yaml:"networkInfo,omitempty"`
UserData string `json:"userData,omitempty" yaml:"userData,omitempty"`
NetworkData string `json:"networkData,omitempty" yaml:"networkData,omitempty"`
}

type MachineConfigV2Harvester struct {
Expand Down Expand Up @@ -64,6 +65,10 @@ func flattenMachineConfigV2Harvester(in *MachineConfigV2Harvester) []interface{}
obj["memory_size"] = in.MemorySize
}

if len(in.ReservedMemorySize) > 0 {
obj["reserved_memory_size"] = in.ReservedMemorySize
}

if len(in.DiskSize) > 0 {
obj["disk_size"] = in.DiskSize
}
Expand Down Expand Up @@ -145,6 +150,10 @@ func expandMachineConfigV2Harvester(p []interface{}, source *MachineConfigV2) *M
obj.MemorySize = v
}

if v, ok := in["reserved_memory_size"].(string); ok && len(v) > 0 {
obj.ReservedMemorySize = v
}

if v, ok := in["disk_size"].(string); ok && len(v) > 0 {
obj.DiskSize = v
}
Expand Down
8 changes: 8 additions & 0 deletions rancher2/structure_node_template_harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ func flattenHarvesterConfig(in *harvesterConfig) []interface{} {
obj["memory_size"] = in.MemorySize
}

if len(in.ReservedMemorySize) > 0 {
obj["reserved_memory_size"] = in.ReservedMemorySize
}

if len(in.DiskSize) > 0 {
obj["disk_size"] = in.DiskSize
}
Expand Down Expand Up @@ -96,6 +100,10 @@ func expandHarvestercloudConfig(p []interface{}) *harvesterConfig {
obj.MemorySize = v
}

if v, ok := in["reserved_memory_size"].(string); ok && len(v) > 0 {
obj.ReservedMemorySize = v
}

if v, ok := in["disk_size"].(string); ok && len(v) > 0 {
obj.DiskSize = v
}
Expand Down
Loading