Skip to content

Commit aee6e68

Browse files
committed
yaml: fixes and support details
1 parent 067ba70 commit aee6e68

7 files changed

Lines changed: 17 additions & 8 deletions

File tree

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ spec:
127127
volumes:
128128
- name: data-disk
129129
diskOffering: standard-hdd
130-
size: 50GB
130+
size: 50
131131
```
132132
133133
### Component Reusing VirtualMachineSpec
@@ -185,10 +185,9 @@ spec:
185185
volumes:
186186
- name: data-disk
187187
diskOffering: standard-hdd
188-
size: 50GB
188+
size: 50
189189
affinityGroups:
190-
- type: hostAntiAffinity
191-
name: vm-spread
190+
- vm-spread
192191
securityGroups:
193192
- default-sec
194193
parameters:
@@ -265,4 +264,4 @@ export PGSSLMODE=disable
265264

266265
# License
267266

268-
Apache License 2.0
267+
Apache License 2.0

apis/v1/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ type VirtualMachineSpec struct {
112112
UserDataRefs []string `yaml:"userDataRefs,omitempty" gorm:"serializer:json"` // Optional references to UserData resources
113113
Volumes []VolumeSpec `yaml:"volumes,omitempty" gorm:"serializer:json"` // Desired or observed attached volumes
114114
HealthChecks []HealthCheck `yaml:"healthChecks,omitempty" gorm:"serializer:json"`
115+
// Parameters allows passing provider-specific deploy-time options
116+
Parameters map[string]string `yaml:"parameters,omitempty" gorm:"serializer:json"`
115117
}
116118

117119
// VirtualMachineSpecResource is the persisted wrapper for reusable VM specs

examples/cluster/component-advanced.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
volumes:
1515
- name: data-disk
1616
diskOffering: standard-hdd
17-
size: 50GB
17+
size: 50
1818
healthChecks:
1919
- type: ping
2020
interval: 10s

examples/standalone/virtualmachine.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ spec:
1818
- vm-spread
1919
securityGroups:
2020
- default-sec
21+
parameters:
22+
bootMode: SECURE
23+
bootType: UEFI
2124
healthChecks:
2225
- type: ping
2326
interval: 10s

examples/standalone/volume.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ metadata:
55
spec:
66
name: data-disk
77
diskOffering: standard-hdd
8-
size: 50GB
8+
size: 50
99
projectId: 987e6543-e21b-12d3-a456-426655440000

examples/virtualmachinespec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ spec:
1212
volumes:
1313
- name: data-disk
1414
diskOffering: standard-hdd
15-
size: 50GB
15+
size: 50

pkg/handlers/virtualmachine.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ func ApplyVirtualMachineManaged(vm *v1.VirtualMachine, managed bool) error {
153153
if len(vm.Spec.SSHKeys) > 0 {
154154
params.SetKeypairs(vm.Spec.SSHKeys)
155155
}
156+
// If parameters are provided, pass them as the CloudStack 'details' map
157+
// first (supported by the SDK).
158+
if vm.Spec.Parameters != nil {
159+
params.SetDetails(vm.Spec.Parameters)
160+
}
156161

157162
resp, err := client.VirtualMachine.DeployVirtualMachine(params)
158163
if err != nil {

0 commit comments

Comments
 (0)