@@ -28,13 +28,14 @@ import (
2828type OpenStackMachineTemplateResource struct {
2929 // spec is the specification of the desired behavior of the machine.
3030 // +required
31- Spec OpenStackMachineSpec `json:"spec"`
31+ Spec OpenStackMachineSpec `json:"spec,omitzero "`
3232}
3333
3434type ResourceReference struct {
3535 // name is the name of the referenced resource
3636 // +required
37- Name string `json:"name"`
37+ // +kubebuilder:validation:MinLength=1
38+ Name string `json:"name,omitempty"`
3839}
3940
4041// ImageParam describes a glance image. It can be specified by ID, filter, or a
@@ -116,7 +117,7 @@ type ExternalRouterIPParam struct {
116117 FixedIP string `json:"fixedIP,omitempty"`
117118 // subnet is the subnet in which the FixedIP is used for the Gateway of this router.
118119 // +required
119- Subnet SubnetParam `json:"subnet"`
120+ Subnet SubnetParam `json:"subnet,omitzero "`
120121}
121122
122123// NeutronTag represents a tag on a Neutron resource.
@@ -340,7 +341,8 @@ type SubnetSpec struct {
340341 // cidr is representing the IP address range used to create the subnet, e.g. 10.0.0.0/24.
341342 // This field is required when defining a subnet.
342343 // +required
343- CIDR string `json:"cidr"`
344+ // +kubebuilder:validation:MinLength=1
345+ CIDR string `json:"cidr,omitempty"`
344346
345347 // dnsNameservers holds a list of DNS server addresses that will be provided when creating
346348 // the subnet. These addresses need to have the same IP version as CIDR.
@@ -357,11 +359,13 @@ type SubnetSpec struct {
357359type AllocationPool struct {
358360 // start represents the start of the AllocationPool, that is the lowest IP of the pool.
359361 // +required
360- Start string `json:"start"`
362+ // +kubebuilder:validation:MinLength=1
363+ Start string `json:"start,omitempty"`
361364
362365 // end represents the end of the AlloctionPool, that is the highest IP of the pool.
363366 // +required
364- End string `json:"end"`
367+ // +kubebuilder:validation:MinLength=1
368+ End string `json:"end,omitempty"`
365369}
366370
367371type PortOpts struct {
@@ -470,15 +474,17 @@ type ResolvedPortSpecFields struct {
470474type ResolvedPortSpec struct {
471475 // name is the name of the port.
472476 // +required
473- Name string `json:"name"`
477+ // +kubebuilder:validation:MinLength=1
478+ Name string `json:"name,omitempty"`
474479
475480 // description is a human-readable description for the port.
476481 // +optional
477482 Description string `json:"description"`
478483
479484 // networkID is the ID of the network the port will be created in.
480485 // +required
481- NetworkID string `json:"networkID"`
486+ // +kubebuilder:validation:MinLength=1
487+ NetworkID string `json:"networkID,omitempty"`
482488
483489 // tags applied to the port (and corresponding trunk, if a trunk is configured.)
484490 // +listType=set
@@ -505,7 +511,8 @@ type ResolvedPortSpec struct {
505511type PortStatus struct {
506512 // id is the unique identifier of the port.
507513 // +required
508- ID string `json:"id"`
514+ // +kubebuilder:validation:MinLength=1
515+ ID string `json:"id,omitempty"`
509516}
510517
511518type BindingProfile struct {
@@ -553,7 +560,8 @@ type AddressPair struct {
553560 // the configuration of Neutron, it may be supported to specify a CIDR
554561 // instead of a specific IP address.
555562 // +required
556- IPAddress string `json:"ipAddress"`
563+ // +kubebuilder:validation:MinLength=1
564+ IPAddress string `json:"ipAddress,omitempty"`
557565
558566 // macAddress is the MAC address of the allowed address pair. If not
559567 // specified, the MAC address will be the MAC address of the port.
@@ -595,7 +603,7 @@ type RootVolume struct {
595603 // sizeGiB is the size of the block device in gibibytes (GiB).
596604 // +required
597605 // +kubebuilder:validation:Minimum:=1
598- SizeGiB int32 `json:"sizeGiB"`
606+ SizeGiB int32 `json:"sizeGiB,omitempty "`
599607
600608 BlockDeviceVolume `json:",inline"`
601609}
@@ -610,7 +618,8 @@ type BlockDeviceStorage struct {
610618 // This can be either "Volume" or "Local".
611619 // +unionDiscriminator
612620 // +required
613- Type BlockDeviceType `json:"type"`
621+ // +kubebuilder:validation:Enum=Local;Volume
622+ Type BlockDeviceType `json:"type,omitempty"`
614623
615624 // volume contains additional storage options for a volume block device.
616625 // +optional
@@ -676,17 +685,18 @@ type AdditionalBlockDevice struct {
676685 // metadata API or the config drive.
677686 // Name cannot be 'root', which is reserved for the root volume.
678687 // +required
679- Name string `json:"name"`
688+ // +kubebuilder:validation:MinLength=1
689+ Name string `json:"name,omitempty"`
680690
681691 // sizeGiB is the size of the block device in gibibytes (GiB).
682692 // +required
683693 // +kubebuilder:validation:Minimum:=1
684- SizeGiB int32 `json:"sizeGiB"`
694+ SizeGiB int32 `json:"sizeGiB,omitempty "`
685695
686696 // storage specifies the storage type of the block device and
687697 // additional storage options.
688698 // +required
689- Storage BlockDeviceStorage `json:"storage"`
699+ Storage BlockDeviceStorage `json:"storage,omitzero "`
690700}
691701
692702// ServerGroupParam specifies an OpenStack server group. It may be specified by ID or filter, but not both.
@@ -733,10 +743,12 @@ const (
733743type NetworkStatus struct {
734744 // name is the name of the network.
735745 // +required
736- Name string `json:"name"`
746+ // +kubebuilder:validation:MinLength=1
747+ Name string `json:"name,omitempty"`
737748 // id is the unique identifier of the network.
738749 // +required
739- ID string `json:"id"`
750+ // +kubebuilder:validation:MinLength=1
751+ ID string `json:"id,omitempty"`
740752
741753 // tags is a list of tags on the network.
742754 // +optional
@@ -756,14 +768,17 @@ type NetworkStatusWithSubnets struct {
756768type Subnet struct {
757769 // name is the name of the subnet.
758770 // +required
759- Name string `json:"name"`
771+ // +kubebuilder:validation:MinLength=1
772+ Name string `json:"name,omitempty"`
760773 // id is the unique identifier of the subnet.
761774 // +required
762- ID string `json:"id"`
775+ // +kubebuilder:validation:MinLength=1
776+ ID string `json:"id,omitempty"`
763777
764778 // cidr is the CIDR of the subnet.
765779 // +required
766- CIDR string `json:"cidr"`
780+ // +kubebuilder:validation:MinLength=1
781+ CIDR string `json:"cidr,omitempty"`
767782
768783 // tags is a list of tags on the subnet.
769784 // +optional
@@ -774,10 +789,12 @@ type Subnet struct {
774789type Router struct {
775790 // name is the name of the router.
776791 // +required
777- Name string `json:"name"`
792+ // +kubebuilder:validation:MinLength=1
793+ Name string `json:"name,omitempty"`
778794 // id is the unique identifier of the router.
779795 // +required
780- ID string `json:"id"`
796+ // +kubebuilder:validation:MinLength=1
797+ ID string `json:"id,omitempty"`
781798 // tags is a list of tags on the router.
782799 // +optional
783800 Tags []string `json:"tags,omitempty"`
@@ -790,16 +807,20 @@ type Router struct {
790807type LoadBalancer struct {
791808 // name is the name of the load balancer.
792809 // +required
793- Name string `json:"name"`
810+ // +kubebuilder:validation:MinLength=1
811+ Name string `json:"name,omitempty"`
794812 // id is the unique identifier of the load balancer.
795813 // +required
796- ID string `json:"id"`
814+ // +kubebuilder:validation:MinLength=1
815+ ID string `json:"id,omitempty"`
797816 // ip is the IP address of the load balancer.
798817 // +required
799- IP string `json:"ip"`
818+ // +kubebuilder:validation:MinLength=1
819+ IP string `json:"ip,omitempty"`
800820 // internalIP is the internal IP address of the load balancer.
801821 // +required
802- InternalIP string `json:"internalIP"`
822+ // +kubebuilder:validation:MinLength=1
823+ InternalIP string `json:"internalIP,omitempty"`
803824 // allowedCIDRs is a list of CIDRs that are allowed to access the load balancer.
804825 // +optional
805826 AllowedCIDRs []string `json:"allowedCIDRs,omitempty"`
@@ -819,11 +840,13 @@ type LoadBalancer struct {
819840type SecurityGroupStatus struct {
820841 // name of the security group
821842 // +required
822- Name string `json:"name"`
843+ // +kubebuilder:validation:MinLength=1
844+ Name string `json:"name,omitempty"`
823845
824846 // id of the security group
825847 // +required
826- ID string `json:"id"`
848+ // +kubebuilder:validation:MinLength=1
849+ ID string `json:"id,omitempty"`
827850}
828851
829852// SecurityGroupRuleSpec represent the basic information of the associated OpenStack
@@ -835,7 +858,8 @@ type SecurityGroupRuleSpec struct {
835858 // name of the security group rule.
836859 // It's used to identify the rule so it can be patched and will not be sent to the OpenStack API.
837860 // +required
838- Name string `json:"name"`
861+ // +kubebuilder:validation:MinLength=1
862+ Name string `json:"name,omitempty"`
839863
840864 // description of the security group rule.
841865 // +optional
@@ -847,7 +871,7 @@ type SecurityGroupRuleSpec struct {
847871 // instance. An egress rule is applied to traffic leaving the instance.
848872 // +required
849873 // +kubebuilder:validation:Enum=ingress;egress
850- Direction string `json:"direction"`
874+ Direction string `json:"direction,omitempty "`
851875
852876 // etherType must be IPv4 or IPv6, and addresses represented in CIDR must match the
853877 // ingress or egress rules.
@@ -971,7 +995,7 @@ type APIServerLoadBalancer struct {
971995 //
972996 // +required
973997 // +kubebuilder:default:=true
974- Enabled * bool `json:"enabled"`
998+ Enabled * bool `json:"enabled,omitempty "`
975999
9761000 // additionalPorts adds additional tcp ports to the load balancer.
9771001 // +optional
@@ -1082,13 +1106,16 @@ type ValueSpec struct {
10821106 // name is the name of the key-value pair.
10831107 // This is just for identifying the pair and will not be sent to the OpenStack API.
10841108 // +required
1085- Name string `json:"name"`
1109+ // +kubebuilder:validation:MinLength=1
1110+ Name string `json:"name,omitempty"`
10861111 // key is the key in the key-value pair.
10871112 // +required
1088- Key string `json:"key"`
1113+ // +kubebuilder:validation:MinLength=1
1114+ Key string `json:"key,omitempty"`
10891115 // value is the value in the key-value pair.
10901116 // +required
1091- Value string `json:"value"`
1117+ // +kubebuilder:validation:MinLength=1
1118+ Value string `json:"value,omitempty"`
10921119}
10931120
10941121// JoinTags joins a slice of tags into a comma separated list of tags.
0 commit comments