Skip to content

Commit 43f2661

Browse files
committed
add validation for disk size
1 parent 3f34852 commit 43f2661

File tree

4 files changed

+3
-1
lines changed

4 files changed

+3
-1
lines changed

api/v1beta1/type.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ type Hardware struct {
8484
// SCSIHardWare SCSIHardWare `json:"scsiHardWare,omitempty"`
8585

8686
// hard disk size
87+
// +kubebuilder:validation:Pattern:=\+?\d+(\.\d+)?[KMGT]?
8788
// +kubebuilder:default:="50G"
8889
Disk string `json:"disk,omitempty"`
8990
}

cloud/scope/machine.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ func (m *MachineScope) GetHardware() infrav1.Hardware {
178178
if m.ProxmoxMachine.Spec.Hardware.Memory == 0 {
179179
m.ProxmoxMachine.Spec.Hardware.Memory = 4096
180180
}
181-
// to do: validation
182181
if m.ProxmoxMachine.Spec.Hardware.Disk == "" {
183182
m.ProxmoxMachine.Spec.Hardware.Disk = "50G"
184183
}

config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachines.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ spec:
119119
disk:
120120
default: 50G
121121
description: hard disk size
122+
pattern: \+?\d+(\.\d+)?[KMGT]?
122123
type: string
123124
memory:
124125
default: 4096

config/crd/bases/infrastructure.cluster.x-k8s.io_proxmoxmachinetemplates.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ spec:
144144
disk:
145145
default: 50G
146146
description: hard disk size
147+
pattern: \+?\d+(\.\d+)?[KMGT]?
147148
type: string
148149
memory:
149150
default: 4096

0 commit comments

Comments
 (0)