File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,17 @@ func (src *OpenStackControlPlane) ConvertTo(dstRaw conversion.Hub) error {
4646 return fmt .Errorf ("failed to unmarshal into v1beta2 object: %w" , err )
4747 }
4848
49+ // Fix the APIVersion to ensure it's set to v1beta2
50+ if dst , ok := dstRaw .(interface { SetAPIVersion (string ) }); ok {
51+ dst .SetAPIVersion ("core.openstack.org/v1beta2" )
52+ } else {
53+ // Use reflection to set the APIVersion field directly
54+ dstValue := reflect .ValueOf (dstRaw ).Elem ()
55+ if apiVersionField := dstValue .FieldByName ("APIVersion" ); apiVersionField .IsValid () && apiVersionField .CanSet () {
56+ apiVersionField .SetString ("core.openstack.org/v1beta2" )
57+ }
58+ }
59+
4960 // Handle Keystone-specific conversions that need special attention
5061 if err := src .convertKeystoneTemplateSpecifics (dstRaw ); err != nil {
5162 return fmt .Errorf ("failed to convert Keystone template: %w" , err )
@@ -71,6 +82,9 @@ func (dst *OpenStackControlPlane) ConvertFrom(srcRaw conversion.Hub) error {
7182 return fmt .Errorf ("failed to unmarshal into v1beta1 object: %w" , err )
7283 }
7384
85+ // Fix the APIVersion to ensure it's set to v1beta1
86+ dst .APIVersion = "core.openstack.org/v1beta1"
87+
7488 // Handle Keystone-specific conversions that need special attention
7589 if err := dst .convertKeystoneTemplateSpecificsFrom (srcRaw ); err != nil {
7690 return fmt .Errorf ("failed to convert Keystone template from v1beta2: %w" , err )
You can’t perform that action at this time.
0 commit comments