diff --git a/api/v1alpha5/conversion.go b/api/v1alpha5/conversion.go index 39901bfd2e..8b31518c2e 100644 --- a/api/v1alpha5/conversion.go +++ b/api/v1alpha5/conversion.go @@ -475,20 +475,6 @@ func Convert_v1beta1_NetworkStatus_To_v1alpha5_Network(in *infrav1.NetworkStatus return nil } -func Convert_v1alpha5_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in *SecurityGroupFilter, out *infrav1.SecurityGroupFilter, s conversion.Scope) error { - err := autoConvert_v1alpha5_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in, out, s) - if err != nil { - return err - } - - // TenantID has been removed in v1beta1. Write it to ProjectID if ProjectID is not already set. - if out.ProjectID == "" { - out.ProjectID = in.TenantID - } - - return nil -} - func Convert_v1alpha5_SecurityGroupParam_To_v1beta1_SecurityGroupFilter(in *SecurityGroupParam, out *infrav1.SecurityGroupFilter, s conversion.Scope) error { // SecurityGroupParam is replaced by its contained SecurityGroupFilter in v1beta1 err := Convert_v1alpha5_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(&in.Filter, out, s) @@ -521,16 +507,20 @@ func Convert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupParam(in *infr return nil } -func Convert_v1alpha5_SubnetParam_To_v1beta1_SubnetFilter(in *SubnetParam, out *infrav1.SubnetFilter, _ conversion.Scope) error { - *out = infrav1.SubnetFilter(in.Filter) +func Convert_v1alpha5_SubnetParam_To_v1beta1_SubnetFilter(in *SubnetParam, out *infrav1.SubnetFilter, s conversion.Scope) error { + if err := Convert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(&in.Filter, out, s); err != nil { + return err + } if in.UUID != "" { out.ID = in.UUID } return nil } -func Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetParam(in *infrav1.SubnetFilter, out *SubnetParam, _ conversion.Scope) error { - out.Filter = SubnetFilter(*in) +func Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetParam(in *infrav1.SubnetFilter, out *SubnetParam, s conversion.Scope) error { + if err := Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(in, &out.Filter, s); err != nil { + return err + } out.UUID = in.ID return nil @@ -718,3 +708,56 @@ func Convert_v1beta1_OpenStackIdentityReference_To_v1alpha5_OpenStackIdentityRef out.Name = in.Name return nil } + +func Convert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out *infrav1.SubnetFilter, s conversion.Scope) error { + if err := autoConvert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(in *infrav1.SubnetFilter, out *SubnetFilter, s conversion.Scope) error { + if err := autoConvert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} + +func Convert_v1alpha5_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in *SecurityGroupFilter, out *infrav1.SecurityGroupFilter, s conversion.Scope) error { + if err := autoConvert_v1alpha5_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + + // TenantID has been removed in v1beta1. Write it to ProjectID if ProjectID is not already set. + if out.ProjectID == "" { + out.ProjectID = in.TenantID + } + return nil +} + +func Convert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter(in *infrav1.SecurityGroupFilter, out *SecurityGroupFilter, s conversion.Scope) error { + if err := autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} + +func Convert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilter, out *infrav1.NetworkFilter, s conversion.Scope) error { + if err := autoConvert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(in *infrav1.NetworkFilter, out *NetworkFilter, s conversion.Scope) error { + if err := autoConvert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} diff --git a/api/v1alpha5/zz_generated.conversion.go b/api/v1alpha5/zz_generated.conversion.go index c6d7dc4e49..646ce0a938 100644 --- a/api/v1alpha5/zz_generated.conversion.go +++ b/api/v1alpha5/zz_generated.conversion.go @@ -81,16 +81,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*NetworkFilter)(nil), (*v1beta1.NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(a.(*NetworkFilter), b.(*v1beta1.NetworkFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.NetworkFilter)(nil), (*NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(a.(*v1beta1.NetworkFilter), b.(*NetworkFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*OpenStackCluster)(nil), (*v1beta1.OpenStackCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha5_OpenStackCluster_To_v1beta1_OpenStackCluster(a.(*OpenStackCluster), b.(*v1beta1.OpenStackCluster), scope) }); err != nil { @@ -236,11 +226,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*Subnet)(nil), (*v1beta1.Subnet)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha5_Subnet_To_v1beta1_Subnet(a.(*Subnet), b.(*v1beta1.Subnet), scope) }); err != nil { @@ -251,16 +236,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*SubnetFilter)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(a.(*SubnetFilter), b.(*v1beta1.SubnetFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(a.(*v1beta1.SubnetFilter), b.(*SubnetFilter), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*Bastion)(nil), (*v1beta1.Bastion)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha5_Bastion_To_v1beta1_Bastion(a.(*Bastion), b.(*v1beta1.Bastion), scope) }); err != nil { @@ -271,6 +246,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*NetworkFilter)(nil), (*v1beta1.NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(a.(*NetworkFilter), b.(*v1beta1.NetworkFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*Network)(nil), (*v1beta1.NetworkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha5_Network_To_v1beta1_NetworkStatus(a.(*Network), b.(*v1beta1.NetworkStatus), scope) }); err != nil { @@ -321,6 +301,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*SubnetFilter)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(a.(*SubnetFilter), b.(*v1beta1.SubnetFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*SubnetParam)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha5_SubnetParam_To_v1beta1_SubnetFilter(a.(*SubnetParam), b.(*v1beta1.SubnetFilter), scope) }); err != nil { @@ -346,6 +331,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.NetworkFilter)(nil), (*NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(a.(*v1beta1.NetworkFilter), b.(*NetworkFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.NetworkStatusWithSubnets)(nil), (*Network)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_NetworkStatusWithSubnets_To_v1alpha5_Network(a.(*v1beta1.NetworkStatusWithSubnets), b.(*Network), scope) }); err != nil { @@ -386,6 +376,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupParam)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupParam(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupParam), scope) }); err != nil { @@ -396,6 +391,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(a.(*v1beta1.SubnetFilter), b.(*SubnetFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetParam)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetParam(a.(*v1beta1.SubnetFilter), b.(*SubnetParam), scope) }); err != nil { @@ -496,7 +496,15 @@ func Convert_v1beta1_ExternalRouterIPParam_To_v1alpha5_ExternalRouterIPParam(in } func autoConvert_v1alpha5_FixedIP_To_v1beta1_FixedIP(in *FixedIP, out *v1beta1.FixedIP, s conversion.Scope) error { - out.Subnet = (*v1beta1.SubnetFilter)(unsafe.Pointer(in.Subnet)) + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(v1beta1.SubnetFilter) + if err := Convert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Subnet = nil + } if err := optional.Convert_string_To_optional_String(&in.IPAddress, &out.IPAddress, s); err != nil { return err } @@ -509,7 +517,15 @@ func Convert_v1alpha5_FixedIP_To_v1beta1_FixedIP(in *FixedIP, out *v1beta1.Fixed } func autoConvert_v1beta1_FixedIP_To_v1alpha5_FixedIP(in *v1beta1.FixedIP, out *FixedIP, s conversion.Scope) error { - out.Subnet = (*SubnetFilter)(unsafe.Pointer(in.Subnet)) + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(SubnetFilter) + if err := Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Subnet = nil + } if err := optional.Convert_optional_String_To_string(&in.IPAddress, &out.IPAddress, s); err != nil { return err } @@ -550,35 +566,22 @@ func autoConvert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilt out.Description = in.Description out.ProjectID = in.ProjectID out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter is an autogenerated conversion function. -func Convert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilter, out *v1beta1.NetworkFilter, s conversion.Scope) error { - return autoConvert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(in, out, s) -} - func autoConvert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(in *v1beta1.NetworkFilter, out *NetworkFilter, s conversion.Scope) error { out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter is an autogenerated conversion function. -func Convert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(in *v1beta1.NetworkFilter, out *NetworkFilter, s conversion.Scope) error { - return autoConvert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(in, out, s) -} - func autoConvert_v1alpha5_OpenStackCluster_To_v1beta1_OpenStackCluster(in *OpenStackCluster, out *v1beta1.OpenStackCluster, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha5_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(&in.Spec, &out.Spec, s); err != nil { @@ -1316,7 +1319,15 @@ func Convert_v1beta1_OpenStackMachineTemplateSpec_To_v1alpha5_OpenStackMachineTe } func autoConvert_v1alpha5_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *v1beta1.PortOpts, s conversion.Scope) error { - out.Network = (*v1beta1.NetworkFilter)(unsafe.Pointer(in.Network)) + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(v1beta1.NetworkFilter) + if err := Convert_v1alpha5_NetworkFilter_To_v1beta1_NetworkFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Network = nil + } if err := optional.Convert_string_To_optional_String(&in.NameSuffix, &out.NameSuffix, s); err != nil { return err } @@ -1367,7 +1378,15 @@ func autoConvert_v1alpha5_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *v1beta } func autoConvert_v1beta1_PortOpts_To_v1alpha5_PortOpts(in *v1beta1.PortOpts, out *PortOpts, s conversion.Scope) error { - out.Network = (*NetworkFilter)(unsafe.Pointer(in.Network)) + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(NetworkFilter) + if err := Convert_v1beta1_NetworkFilter_To_v1alpha5_NetworkFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Network = nil + } if err := optional.Convert_optional_String_To_string(&in.NameSuffix, &out.NameSuffix, s); err != nil { return err } @@ -1486,10 +1505,10 @@ func autoConvert_v1alpha5_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in // WARNING: in.Marker requires manual conversion: does not exist in peer-type // WARNING: in.SortKey requires manual conversion: does not exist in peer-type // WARNING: in.SortDir requires manual conversion: does not exist in peer-type - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } @@ -1498,18 +1517,10 @@ func autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter(in out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter is an autogenerated conversion function. -func Convert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter(in *v1beta1.SecurityGroupFilter, out *SecurityGroupFilter, s conversion.Scope) error { - return autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha5_SecurityGroupFilter(in, out, s) -} - func autoConvert_v1alpha5_Subnet_To_v1beta1_Subnet(in *Subnet, out *v1beta1.Subnet, s conversion.Scope) error { out.Name = in.Name out.ID = in.ID @@ -1546,18 +1557,13 @@ func autoConvert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out.IPv6AddressMode = in.IPv6AddressMode out.IPv6RAMode = in.IPv6RAMode out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter is an autogenerated conversion function. -func Convert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out *v1beta1.SubnetFilter, s conversion.Scope) error { - return autoConvert_v1alpha5_SubnetFilter_To_v1beta1_SubnetFilter(in, out, s) -} - func autoConvert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(in *v1beta1.SubnetFilter, out *SubnetFilter, s conversion.Scope) error { out.Name = in.Name out.Description = in.Description @@ -1568,14 +1574,6 @@ func autoConvert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(in *v1beta1.Subne out.IPv6AddressMode = in.IPv6AddressMode out.IPv6RAMode = in.IPv6RAMode out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } - -// Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter is an autogenerated conversion function. -func Convert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(in *v1beta1.SubnetFilter, out *SubnetFilter, s conversion.Scope) error { - return autoConvert_v1beta1_SubnetFilter_To_v1alpha5_SubnetFilter(in, out, s) -} diff --git a/api/v1alpha6/conversion.go b/api/v1alpha6/conversion.go index 5526561dbe..dbdcde2687 100644 --- a/api/v1alpha6/conversion.go +++ b/api/v1alpha6/conversion.go @@ -30,6 +30,33 @@ import ( const trueString = "true" +func restorev1alpha6SubnetFilter(previous *SubnetFilter, dst *SubnetFilter) { + // The edge cases with multiple commas are too tricky in this direction, + // so we just restore the whole thing. + dst.Tags = previous.Tags + dst.TagsAny = previous.TagsAny + dst.NotTags = previous.NotTags + dst.NotTagsAny = previous.NotTagsAny +} + +func restorev1alpha6SecurityGroupFilter(previous *SecurityGroupFilter, dst *SecurityGroupFilter) { + // The edge cases with multiple commas are too tricky in this direction, + // so we just restore the whole thing. + dst.Tags = previous.Tags + dst.TagsAny = previous.TagsAny + dst.NotTags = previous.NotTags + dst.NotTagsAny = previous.NotTagsAny +} + +func restorev1alpha6NetworkFilter(previous *NetworkFilter, dst *NetworkFilter) { + // The edge cases with multiple commas are too tricky in this direction, + // so we just restore the whole thing. + dst.Tags = previous.Tags + dst.TagsAny = previous.TagsAny + dst.NotTags = previous.NotTags + dst.NotTagsAny = previous.NotTagsAny +} + func restorev1alpha6SecurityGroup(previous *SecurityGroup, dst *SecurityGroup) { if previous == nil || dst == nil { return @@ -40,6 +67,29 @@ func restorev1alpha6SecurityGroup(previous *SecurityGroup, dst *SecurityGroup) { } } +func restorev1alpha6Port(previous *PortOpts, dst *PortOpts) { + if len(dst.SecurityGroupFilters) == len(previous.SecurityGroupFilters) { + for i := range dst.SecurityGroupFilters { + restorev1alpha6SecurityGroupFilter(&previous.SecurityGroupFilters[i].Filter, &dst.SecurityGroupFilters[i].Filter) + } + } + + if dst.Network != nil && previous.Network != nil { + restorev1alpha6NetworkFilter(previous.Network, dst.Network) + } + + if len(dst.FixedIPs) == len(previous.FixedIPs) { + for i := range dst.FixedIPs { + prevFixedIP := &previous.FixedIPs[i] + dstFixedIP := &dst.FixedIPs[i] + + if dstFixedIP.Subnet != nil && prevFixedIP.Subnet != nil { + restorev1alpha6SubnetFilter(prevFixedIP.Subnet, dstFixedIP.Subnet) + } + } + } +} + func restorev1alpha6MachineSpec(previous *OpenStackMachineSpec, dst *OpenStackMachineSpec) { // Subnet is removed from v1beta1 with no replacement, so can't be // losslessly converted. Restore the previously stored value on down-conversion. @@ -76,6 +126,18 @@ func restorev1alpha6MachineSpec(previous *OpenStackMachineSpec, dst *OpenStackMa // Conversion to v1beta1 removes the Kind fild dst.IdentityRef = previous.IdentityRef + + if len(dst.Ports) == len(previous.Ports) { + for i := range dst.Ports { + restorev1alpha6Port(&previous.Ports[i], &dst.Ports[i]) + } + } + + if len(dst.SecurityGroups) == len(previous.SecurityGroups) { + for i := range dst.SecurityGroups { + restorev1alpha6SecurityGroupFilter(&previous.SecurityGroups[i].Filter, &dst.SecurityGroups[i].Filter) + } + } } func restorev1alpha6ClusterStatus(previous *OpenStackClusterStatus, dst *OpenStackClusterStatus) { @@ -171,6 +233,16 @@ func restorev1alpha6ClusterSpec(previous *OpenStackClusterSpec, dst *OpenStackCl // Conversion to v1beta1 removes the Kind field dst.IdentityRef = previous.IdentityRef + + if len(dst.ExternalRouterIPs) == len(previous.ExternalRouterIPs) { + for i := range dst.ExternalRouterIPs { + restorev1alpha6SubnetFilter(&previous.ExternalRouterIPs[i].Subnet.Filter, &dst.ExternalRouterIPs[i].Subnet.Filter) + } + } + + restorev1alpha6SubnetFilter(&previous.Subnet, &dst.Subnet) + + restorev1alpha6NetworkFilter(&previous.Network, &dst.Network) } var _ ctrlconversion.Convertible = &OpenStackCluster{} @@ -492,7 +564,10 @@ func Convert_v1alpha6_OpenStackMachineSpec_To_v1beta1_OpenStackMachineSpec(in *O } if len(in.Networks) > 0 { - ports := convertNetworksToPorts(in.Networks) + ports, err := convertNetworksToPorts(in.Networks, s) + if err != nil { + return err + } // Networks were previously created first, so need to come before ports out.Ports = append(ports, out.Ports...) } @@ -542,7 +617,7 @@ func Convert_v1alpha6_OpenStackMachineSpec_To_v1beta1_OpenStackMachineSpec(in *O return nil } -func convertNetworksToPorts(networks []NetworkParam) []infrav1.PortOpts { +func convertNetworksToPorts(networks []NetworkParam, s apiconversion.Scope) ([]infrav1.PortOpts, error) { var ports []infrav1.PortOpts for i := range networks { @@ -563,7 +638,10 @@ func convertNetworksToPorts(networks []NetworkParam) []infrav1.PortOpts { ID: network.UUID, } case network.Filter != (NetworkFilter{}): - networkFilter = (*infrav1.NetworkFilter)(&network.Filter) + networkFilter = &infrav1.NetworkFilter{} + if err := Convert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(&network.Filter, networkFilter, s); err != nil { + return nil, err + } } // Note that network.FixedIP was unused in v1alpha6 so we also ignore it here. @@ -594,10 +672,14 @@ func convertNetworksToPorts(networks []NetworkParam) []infrav1.PortOpts { }, }) } else { + subnetFilter := &infrav1.SubnetFilter{} + if err := Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(&subnet.Filter, subnetFilter, s); err != nil { + return nil, err + } ports = append(ports, infrav1.PortOpts{ Network: networkFilter, FixedIPs: []infrav1.FixedIP{ - {Subnet: (*infrav1.SubnetFilter)(&subnet.Filter)}, + {Subnet: subnetFilter}, }, }) } @@ -605,7 +687,7 @@ func convertNetworksToPorts(networks []NetworkParam) []infrav1.PortOpts { } } - return ports + return ports, nil } func Convert_v1beta1_OpenStackClusterSpec_To_v1alpha6_OpenStackClusterSpec(in *infrav1.OpenStackClusterSpec, out *OpenStackClusterSpec, s apiconversion.Scope) error { @@ -844,20 +926,6 @@ func Convert_v1beta1_NetworkStatus_To_v1alpha6_Network(in *infrav1.NetworkStatus return nil } -func Convert_v1alpha6_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in *SecurityGroupFilter, out *infrav1.SecurityGroupFilter, s apiconversion.Scope) error { - err := autoConvert_v1alpha6_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in, out, s) - if err != nil { - return err - } - - // TenantID has been removed in v1beta1. Write it to ProjectID if ProjectID is not already set. - if out.ProjectID == "" { - out.ProjectID = in.TenantID - } - - return nil -} - func Convert_v1alpha6_SecurityGroupParam_To_v1beta1_SecurityGroupFilter(in *SecurityGroupParam, out *infrav1.SecurityGroupFilter, s apiconversion.Scope) error { // SecurityGroupParam is replaced by its contained SecurityGroupFilter in v1beta1 err := Convert_v1alpha6_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(&in.Filter, out, s) @@ -890,16 +958,20 @@ func Convert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupParam(in *infr return nil } -func Convert_v1alpha6_SubnetParam_To_v1beta1_SubnetFilter(in *SubnetParam, out *infrav1.SubnetFilter, _ apiconversion.Scope) error { - *out = infrav1.SubnetFilter(in.Filter) +func Convert_v1alpha6_SubnetParam_To_v1beta1_SubnetFilter(in *SubnetParam, out *infrav1.SubnetFilter, s apiconversion.Scope) error { + if err := Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(&in.Filter, out, s); err != nil { + return err + } if in.UUID != "" { out.ID = in.UUID } return nil } -func Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetParam(in *infrav1.SubnetFilter, out *SubnetParam, _ apiconversion.Scope) error { - out.Filter = SubnetFilter(*in) +func Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetParam(in *infrav1.SubnetFilter, out *SubnetParam, s apiconversion.Scope) error { + if err := Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(in, &out.Filter, s); err != nil { + return err + } out.UUID = in.ID return nil @@ -1097,3 +1169,56 @@ func Convert_v1beta1_OpenStackIdentityReference_To_v1alpha6_OpenStackIdentityRef out.Name = in.Name return nil } + +func Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out *infrav1.SubnetFilter, s apiconversion.Scope) error { + if err := autoConvert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(in *infrav1.SubnetFilter, out *SubnetFilter, s apiconversion.Scope) error { + if err := autoConvert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} + +func Convert_v1alpha6_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in *SecurityGroupFilter, out *infrav1.SecurityGroupFilter, s apiconversion.Scope) error { + if err := autoConvert_v1alpha6_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + + // TenantID has been removed in v1beta1. Write it to ProjectID if ProjectID is not already set. + if out.ProjectID == "" { + out.ProjectID = in.TenantID + } + return nil +} + +func Convert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter(in *infrav1.SecurityGroupFilter, out *SecurityGroupFilter, s apiconversion.Scope) error { + if err := autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} + +func Convert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilter, out *infrav1.NetworkFilter, s apiconversion.Scope) error { + if err := autoConvert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(in *infrav1.NetworkFilter, out *NetworkFilter, s apiconversion.Scope) error { + if err := autoConvert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} diff --git a/api/v1alpha6/conversion_test.go b/api/v1alpha6/conversion_test.go index e443f5418d..984d7ffb46 100644 --- a/api/v1alpha6/conversion_test.go +++ b/api/v1alpha6/conversion_test.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha6 import ( + "strings" "testing" "github.com/google/go-cmp/cmp" @@ -56,6 +57,17 @@ func TestFuzzyConversion(t *testing.T) { delete(obj.GetAnnotations(), utilconversion.DataAnnotation) } + filterInvalidTags := func(tags []infrav1.NeutronTag) []infrav1.NeutronTag { + var ret []infrav1.NeutronTag + for i := range tags { + s := string(tags[i]) + if len(s) > 0 && !strings.Contains(s, ",") { + ret = append(ret, tags[i]) + } + } + return ret + } + fuzzerFuncs := func(_ runtimeserializer.CodecFactory) []interface{} { return []interface{}{ func(instance *Instance, c fuzz.Continue) { @@ -156,6 +168,44 @@ func TestFuzzyConversion(t *testing.T) { pool.End = c.RandString() } }, + + // v1beta1 filter tags cannot contain commas and can't be empty. + + func(filter *infrav1.SubnetFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, + + func(filter *infrav1.NetworkFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, + + func(filter *infrav1.RouterFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, + + func(filter *infrav1.SecurityGroupFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, } } @@ -284,10 +334,12 @@ func TestNetworksToPorts(t *testing.T) { Name: "network-name", Description: "network-description", ProjectID: "project-id", - Tags: "tags", - TagsAny: "tags-any", - NotTags: "not-tags", - NotTagsAny: "not-tags-any", + FilterByNeutronTags: infrav1.FilterByNeutronTags{ + Tags: []infrav1.NeutronTag{"tags"}, + TagsAny: []infrav1.NeutronTag{"tags-any"}, + NotTags: []infrav1.NeutronTag{"not-tags"}, + NotTagsAny: []infrav1.NeutronTag{"not-tags-any"}, + }, }, }, }, @@ -368,10 +420,12 @@ func TestNetworksToPorts(t *testing.T) { CIDR: "y.y.y.y", IPv6AddressMode: "address-mode", IPv6RAMode: "ra-mode", - Tags: "tags", - TagsAny: "tags-any", - NotTags: "not-tags", - NotTagsAny: "not-tags-any", + FilterByNeutronTags: infrav1.FilterByNeutronTags{ + Tags: []infrav1.NeutronTag{"tags"}, + TagsAny: []infrav1.NeutronTag{"tags-any"}, + NotTags: []infrav1.NeutronTag{"not-tags"}, + NotTagsAny: []infrav1.NeutronTag{"not-tags-any"}, + }, }, }, }, @@ -438,10 +492,12 @@ func TestNetworksToPorts(t *testing.T) { CIDR: "y.y.y.y", IPv6AddressMode: "address-mode", IPv6RAMode: "ra-mode", - Tags: "tags", - TagsAny: "tags-any", - NotTags: "not-tags", - NotTagsAny: "not-tags-any", + FilterByNeutronTags: infrav1.FilterByNeutronTags{ + Tags: []infrav1.NeutronTag{"tags"}, + TagsAny: []infrav1.NeutronTag{"tags-any"}, + NotTags: []infrav1.NeutronTag{"not-tags"}, + NotTagsAny: []infrav1.NeutronTag{"not-tags-any"}, + }, }, }, }, @@ -459,7 +515,7 @@ func TestNetworksToPorts(t *testing.T) { after := infrav1.OpenStackMachine{} g.Expect(before.ConvertTo(&after)).To(gomega.Succeed()) - g.Expect(after.Spec).To(gomega.Equal(tt.afterMachineSpec)) + g.Expect(after.Spec).To(gomega.Equal(tt.afterMachineSpec), cmp.Diff(after.Spec, tt.afterMachineSpec)) }) } } diff --git a/api/v1alpha6/zz_generated.conversion.go b/api/v1alpha6/zz_generated.conversion.go index f27f605f86..dafa54171b 100644 --- a/api/v1alpha6/zz_generated.conversion.go +++ b/api/v1alpha6/zz_generated.conversion.go @@ -90,16 +90,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*NetworkFilter)(nil), (*v1beta1.NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(a.(*NetworkFilter), b.(*v1beta1.NetworkFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.NetworkFilter)(nil), (*NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(a.(*v1beta1.NetworkFilter), b.(*NetworkFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*OpenStackCluster)(nil), (*v1beta1.OpenStackCluster)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha6_OpenStackCluster_To_v1beta1_OpenStackCluster(a.(*OpenStackCluster), b.(*v1beta1.OpenStackCluster), scope) }); err != nil { @@ -245,11 +235,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*Subnet)(nil), (*v1beta1.Subnet)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha6_Subnet_To_v1beta1_Subnet(a.(*Subnet), b.(*v1beta1.Subnet), scope) }); err != nil { @@ -260,16 +245,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*SubnetFilter)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(a.(*SubnetFilter), b.(*v1beta1.SubnetFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(a.(*v1beta1.SubnetFilter), b.(*SubnetFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ValueSpec)(nil), (*v1beta1.ValueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha6_ValueSpec_To_v1beta1_ValueSpec(a.(*ValueSpec), b.(*v1beta1.ValueSpec), scope) }); err != nil { @@ -290,6 +265,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*NetworkFilter)(nil), (*v1beta1.NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(a.(*NetworkFilter), b.(*v1beta1.NetworkFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*Network)(nil), (*v1beta1.NetworkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha6_Network_To_v1beta1_NetworkStatus(a.(*Network), b.(*v1beta1.NetworkStatus), scope) }); err != nil { @@ -340,6 +320,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*SubnetFilter)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(a.(*SubnetFilter), b.(*v1beta1.SubnetFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*SubnetParam)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha6_SubnetParam_To_v1beta1_SubnetFilter(a.(*SubnetParam), b.(*v1beta1.SubnetFilter), scope) }); err != nil { @@ -355,6 +340,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.NetworkFilter)(nil), (*NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(a.(*v1beta1.NetworkFilter), b.(*NetworkFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.NetworkStatusWithSubnets)(nil), (*Network)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_NetworkStatusWithSubnets_To_v1alpha6_Network(a.(*v1beta1.NetworkStatusWithSubnets), b.(*Network), scope) }); err != nil { @@ -400,6 +390,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupParam)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupParam(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupParam), scope) }); err != nil { @@ -410,6 +405,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(a.(*v1beta1.SubnetFilter), b.(*SubnetFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetParam)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetParam(a.(*v1beta1.SubnetFilter), b.(*SubnetParam), scope) }); err != nil { @@ -516,7 +516,15 @@ func Convert_v1beta1_ExternalRouterIPParam_To_v1alpha6_ExternalRouterIPParam(in } func autoConvert_v1alpha6_FixedIP_To_v1beta1_FixedIP(in *FixedIP, out *v1beta1.FixedIP, s conversion.Scope) error { - out.Subnet = (*v1beta1.SubnetFilter)(unsafe.Pointer(in.Subnet)) + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(v1beta1.SubnetFilter) + if err := Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Subnet = nil + } if err := optional.Convert_string_To_optional_String(&in.IPAddress, &out.IPAddress, s); err != nil { return err } @@ -529,7 +537,15 @@ func Convert_v1alpha6_FixedIP_To_v1beta1_FixedIP(in *FixedIP, out *v1beta1.Fixed } func autoConvert_v1beta1_FixedIP_To_v1alpha6_FixedIP(in *v1beta1.FixedIP, out *FixedIP, s conversion.Scope) error { - out.Subnet = (*SubnetFilter)(unsafe.Pointer(in.Subnet)) + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(SubnetFilter) + if err := Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Subnet = nil + } if err := optional.Convert_optional_String_To_string(&in.IPAddress, &out.IPAddress, s); err != nil { return err } @@ -576,35 +592,22 @@ func autoConvert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilt out.Description = in.Description out.ProjectID = in.ProjectID out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter is an autogenerated conversion function. -func Convert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilter, out *v1beta1.NetworkFilter, s conversion.Scope) error { - return autoConvert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(in, out, s) -} - func autoConvert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(in *v1beta1.NetworkFilter, out *NetworkFilter, s conversion.Scope) error { out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter is an autogenerated conversion function. -func Convert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(in *v1beta1.NetworkFilter, out *NetworkFilter, s conversion.Scope) error { - return autoConvert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(in, out, s) -} - func autoConvert_v1alpha6_OpenStackCluster_To_v1beta1_OpenStackCluster(in *OpenStackCluster, out *v1beta1.OpenStackCluster, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha6_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(&in.Spec, &out.Spec, s); err != nil { @@ -1343,7 +1346,15 @@ func Convert_v1beta1_OpenStackMachineTemplateSpec_To_v1alpha6_OpenStackMachineTe } func autoConvert_v1alpha6_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *v1beta1.PortOpts, s conversion.Scope) error { - out.Network = (*v1beta1.NetworkFilter)(unsafe.Pointer(in.Network)) + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(v1beta1.NetworkFilter) + if err := Convert_v1alpha6_NetworkFilter_To_v1beta1_NetworkFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Network = nil + } if err := optional.Convert_string_To_optional_String(&in.NameSuffix, &out.NameSuffix, s); err != nil { return err } @@ -1395,7 +1406,15 @@ func autoConvert_v1alpha6_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *v1beta } func autoConvert_v1beta1_PortOpts_To_v1alpha6_PortOpts(in *v1beta1.PortOpts, out *PortOpts, s conversion.Scope) error { - out.Network = (*NetworkFilter)(unsafe.Pointer(in.Network)) + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(NetworkFilter) + if err := Convert_v1beta1_NetworkFilter_To_v1alpha6_NetworkFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Network = nil + } if err := optional.Convert_optional_String_To_string(&in.NameSuffix, &out.NameSuffix, s); err != nil { return err } @@ -1514,10 +1533,10 @@ func autoConvert_v1alpha6_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in // WARNING: in.Marker requires manual conversion: does not exist in peer-type // WARNING: in.SortKey requires manual conversion: does not exist in peer-type // WARNING: in.SortDir requires manual conversion: does not exist in peer-type - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } @@ -1526,18 +1545,10 @@ func autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter(in out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter is an autogenerated conversion function. -func Convert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter(in *v1beta1.SecurityGroupFilter, out *SecurityGroupFilter, s conversion.Scope) error { - return autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha6_SecurityGroupFilter(in, out, s) -} - func autoConvert_v1alpha6_Subnet_To_v1beta1_Subnet(in *Subnet, out *v1beta1.Subnet, s conversion.Scope) error { out.Name = in.Name out.ID = in.ID @@ -1574,18 +1585,13 @@ func autoConvert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out.IPv6AddressMode = in.IPv6AddressMode out.IPv6RAMode = in.IPv6RAMode out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter is an autogenerated conversion function. -func Convert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out *v1beta1.SubnetFilter, s conversion.Scope) error { - return autoConvert_v1alpha6_SubnetFilter_To_v1beta1_SubnetFilter(in, out, s) -} - func autoConvert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(in *v1beta1.SubnetFilter, out *SubnetFilter, s conversion.Scope) error { out.Name = in.Name out.Description = in.Description @@ -1596,18 +1602,10 @@ func autoConvert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(in *v1beta1.Subne out.IPv6AddressMode = in.IPv6AddressMode out.IPv6RAMode = in.IPv6RAMode out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter is an autogenerated conversion function. -func Convert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(in *v1beta1.SubnetFilter, out *SubnetFilter, s conversion.Scope) error { - return autoConvert_v1beta1_SubnetFilter_To_v1alpha6_SubnetFilter(in, out, s) -} - func autoConvert_v1alpha6_ValueSpec_To_v1beta1_ValueSpec(in *ValueSpec, out *v1beta1.ValueSpec, s conversion.Scope) error { out.Name = in.Name out.Key = in.Key diff --git a/api/v1alpha7/conversion.go b/api/v1alpha7/conversion.go index ff38380bf4..ed6c3f487f 100644 --- a/api/v1alpha7/conversion.go +++ b/api/v1alpha7/conversion.go @@ -164,6 +164,65 @@ var v1beta1OpenStackClusterRestorer = conversion.RestorerFor[*infrav1.OpenStackC ), } +func restorev1alpha7SubnetFilter(previous *SubnetFilter, dst *SubnetFilter) { + // The edge cases with multiple commas are too tricky in this direction, + // so we just restore the whole thing. + dst.Tags = previous.Tags + dst.TagsAny = previous.TagsAny + dst.NotTags = previous.NotTags + dst.NotTagsAny = previous.NotTagsAny +} + +func restorev1alpha7SecurityGroupFilter(previous *SecurityGroupFilter, dst *SecurityGroupFilter) { + // The edge cases with multiple commas are too tricky in this direction, + // so we just restore the whole thing. + dst.Tags = previous.Tags + dst.TagsAny = previous.TagsAny + dst.NotTags = previous.NotTags + dst.NotTagsAny = previous.NotTagsAny +} + +func restorev1alpha7NetworkFilter(previous *NetworkFilter, dst *NetworkFilter) { + // The edge cases with multiple commas are too tricky in this direction, + // so we just restore the whole thing. + dst.Tags = previous.Tags + dst.TagsAny = previous.TagsAny + dst.NotTags = previous.NotTags + dst.NotTagsAny = previous.NotTagsAny +} + +func restorev1alpha7RouterFilter(previous *RouterFilter, dst *RouterFilter) { + // The edge cases with multiple commas are too tricky in this direction, + // so we just restore the whole thing. + dst.Tags = previous.Tags + dst.TagsAny = previous.TagsAny + dst.NotTags = previous.NotTags + dst.NotTagsAny = previous.NotTagsAny +} + +func restorev1alpha7Port(previous *PortOpts, dst *PortOpts) { + if len(dst.SecurityGroupFilters) == len(previous.SecurityGroupFilters) { + for i := range dst.SecurityGroupFilters { + restorev1alpha7SecurityGroupFilter(&previous.SecurityGroupFilters[i], &dst.SecurityGroupFilters[i]) + } + } + + if dst.Network != nil && previous.Network != nil { + restorev1alpha7NetworkFilter(previous.Network, dst.Network) + } + + if len(dst.FixedIPs) == len(previous.FixedIPs) { + for i := range dst.FixedIPs { + prevFixedIP := &previous.FixedIPs[i] + dstFixedIP := &dst.FixedIPs[i] + + if dstFixedIP.Subnet != nil && prevFixedIP.Subnet != nil { + restorev1alpha7SubnetFilter(prevFixedIP.Subnet, dstFixedIP.Subnet) + } + } + } +} + func restorev1alpha7MachineSpec(previous *OpenStackMachineSpec, dst *OpenStackMachineSpec) { dst.FloatingIP = previous.FloatingIP @@ -187,6 +246,18 @@ func restorev1alpha7MachineSpec(previous *OpenStackMachineSpec, dst *OpenStackMa // Conversion to v1beta1 removes the Kind field dst.IdentityRef = previous.IdentityRef + + if len(dst.Ports) == len(previous.Ports) { + for i := range dst.Ports { + restorev1alpha7Port(&previous.Ports[i], &dst.Ports[i]) + } + } + + if len(dst.SecurityGroups) == len(previous.SecurityGroups) { + for i := range dst.SecurityGroups { + restorev1alpha7SecurityGroupFilter(&previous.SecurityGroups[i], &dst.SecurityGroups[i]) + } + } } func restorev1beta1MachineSpec(previous *infrav1.OpenStackMachineSpec, dst *infrav1.OpenStackMachineSpec) { @@ -287,6 +358,20 @@ func restorev1alpha7ClusterSpec(previous *OpenStackClusterSpec, dst *OpenStackCl // Conversion to v1beta1 removes the Kind field dst.IdentityRef = previous.IdentityRef + + if len(dst.ExternalRouterIPs) == len(previous.ExternalRouterIPs) { + for i := range dst.ExternalRouterIPs { + restorev1alpha7SubnetFilter(&previous.ExternalRouterIPs[i].Subnet, &dst.ExternalRouterIPs[i].Subnet) + } + } + + restorev1alpha7SubnetFilter(&previous.Subnet, &dst.Subnet) + + if dst.Router != nil && previous.Router != nil { + restorev1alpha7RouterFilter(previous.Router, dst.Router) + } + + restorev1alpha7NetworkFilter(&previous.Network, &dst.Network) } func restorev1beta1ClusterSpec(previous *infrav1.OpenStackClusterSpec, dst *infrav1.OpenStackClusterSpec) { @@ -796,7 +881,7 @@ func Convert_v1alpha7_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *infrav1.Po if len(in.SecurityGroupFilters) > 0 { out.SecurityGroups = make([]infrav1.SecurityGroupFilter, len(in.SecurityGroupFilters)) for i := range in.SecurityGroupFilters { - if err := autoConvert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(&in.SecurityGroupFilters[i], &out.SecurityGroups[i], s); err != nil { + if err := Convert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(&in.SecurityGroupFilters[i], &out.SecurityGroups[i], s); err != nil { return err } } @@ -804,7 +889,7 @@ func Convert_v1alpha7_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *infrav1.Po if in.Profile != (BindingProfile{}) { out.Profile = &infrav1.BindingProfile{} - if err := autoConvert_v1alpha7_BindingProfile_To_v1beta1_BindingProfile(&in.Profile, out.Profile, s); err != nil { + if err := Convert_v1alpha7_BindingProfile_To_v1beta1_BindingProfile(&in.Profile, out.Profile, s); err != nil { return err } } @@ -820,14 +905,14 @@ func Convert_v1beta1_PortOpts_To_v1alpha7_PortOpts(in *infrav1.PortOpts, out *Po if len(in.SecurityGroups) > 0 { out.SecurityGroupFilters = make([]SecurityGroupFilter, len(in.SecurityGroups)) for i := range in.SecurityGroups { - if err := autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(&in.SecurityGroups[i], &out.SecurityGroupFilters[i], s); err != nil { + if err := Convert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(&in.SecurityGroups[i], &out.SecurityGroupFilters[i], s); err != nil { return err } } } if in.Profile != nil { - if err := autoConvert_v1beta1_BindingProfile_To_v1alpha7_BindingProfile(in.Profile, &out.Profile, s); err != nil { + if err := Convert_v1beta1_BindingProfile_To_v1alpha7_BindingProfile(in.Profile, &out.Profile, s); err != nil { return err } } @@ -839,3 +924,67 @@ func Convert_v1beta1_OpenStackIdentityReference_To_v1alpha7_OpenStackIdentityRef out.Name = in.Name return nil } + +func Convert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out *infrav1.SubnetFilter, s apiconversion.Scope) error { + if err := autoConvert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(in *infrav1.SubnetFilter, out *SubnetFilter, s apiconversion.Scope) error { + if err := autoConvert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} + +func Convert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in *SecurityGroupFilter, out *infrav1.SecurityGroupFilter, s apiconversion.Scope) error { + if err := autoConvert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(in *infrav1.SecurityGroupFilter, out *SecurityGroupFilter, s apiconversion.Scope) error { + if err := autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} + +func Convert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(in *RouterFilter, out *infrav1.RouterFilter, s apiconversion.Scope) error { + if err := autoConvert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(in *infrav1.RouterFilter, out *RouterFilter, s apiconversion.Scope) error { + if err := autoConvert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} + +func Convert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilter, out *infrav1.NetworkFilter, s apiconversion.Scope) error { + if err := autoConvert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsTo(in.Tags, in.TagsAny, in.NotTags, in.NotTagsAny, &out.FilterByNeutronTags) + return nil +} + +func Convert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(in *infrav1.NetworkFilter, out *NetworkFilter, s apiconversion.Scope) error { + if err := autoConvert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(in, out, s); err != nil { + return err + } + infrav1.ConvertAllTagsFrom(&in.FilterByNeutronTags, &out.Tags, &out.TagsAny, &out.NotTags, &out.NotTagsAny) + return nil +} diff --git a/api/v1alpha7/conversion_test.go b/api/v1alpha7/conversion_test.go index 964b89771b..a2c770984f 100644 --- a/api/v1alpha7/conversion_test.go +++ b/api/v1alpha7/conversion_test.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha7 import ( + "strings" "testing" "github.com/google/go-cmp/cmp" @@ -56,6 +57,17 @@ func TestFuzzyConversion(t *testing.T) { delete(obj.GetAnnotations(), utilconversion.DataAnnotation) } + filterInvalidTags := func(tags []infrav1.NeutronTag) []infrav1.NeutronTag { + var ret []infrav1.NeutronTag + for i := range tags { + s := string(tags[i]) + if len(s) > 0 && !strings.Contains(s, ",") { + ret = append(ret, tags[i]) + } + } + return ret + } + fuzzerFuncs := func(_ runtimeserializer.CodecFactory) []interface{} { return []interface{}{ func(spec *infrav1.OpenStackClusterSpec, c fuzz.Continue) { @@ -124,6 +136,64 @@ func TestFuzzyConversion(t *testing.T) { pool.End = c.RandString() } }, + + // v1beta1 filter tags cannot contain commas and can't be empty. + + func(filter *infrav1.SubnetFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + // Sometimes add an additional tag to ensure we get test coverage of multiple tags + if c.RandBool() { + filter.Tags = append(filter.Tags, infrav1.NeutronTag(c.RandString())) + } + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, + + func(filter *infrav1.NetworkFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + // Sometimes add an additional tag to ensure we get test coverage of multiple tags + if c.RandBool() { + filter.Tags = append(filter.Tags, infrav1.NeutronTag(c.RandString())) + } + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, + + func(filter *infrav1.RouterFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + // Sometimes add an additional tag to ensure we get test coverage of multiple tags + if c.RandBool() { + filter.Tags = append(filter.Tags, infrav1.NeutronTag(c.RandString())) + } + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, + + func(filter *infrav1.SecurityGroupFilter, c fuzz.Continue) { + c.FuzzNoCustom(filter) + + // Sometimes add an additional tag to ensure we get test coverage of multiple tags + if c.RandBool() { + filter.Tags = append(filter.Tags, infrav1.NeutronTag(c.RandString())) + } + + filter.Tags = filterInvalidTags(filter.Tags) + filter.TagsAny = filterInvalidTags(filter.TagsAny) + filter.NotTags = filterInvalidTags(filter.NotTags) + filter.NotTagsAny = filterInvalidTags(filter.NotTagsAny) + }, } } diff --git a/api/v1alpha7/zz_generated.conversion.go b/api/v1alpha7/zz_generated.conversion.go index 69cbeb55f3..2cbd5b0184 100644 --- a/api/v1alpha7/zz_generated.conversion.go +++ b/api/v1alpha7/zz_generated.conversion.go @@ -136,16 +136,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*NetworkFilter)(nil), (*v1beta1.NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(a.(*NetworkFilter), b.(*v1beta1.NetworkFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.NetworkFilter)(nil), (*NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(a.(*v1beta1.NetworkFilter), b.(*NetworkFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*NetworkStatus)(nil), (*v1beta1.NetworkStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha7_NetworkStatus_To_v1beta1_NetworkStatus(a.(*NetworkStatus), b.(*v1beta1.NetworkStatus), scope) }); err != nil { @@ -316,26 +306,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*RouterFilter)(nil), (*v1beta1.RouterFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(a.(*RouterFilter), b.(*v1beta1.RouterFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.RouterFilter)(nil), (*RouterFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(a.(*v1beta1.RouterFilter), b.(*RouterFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*SecurityGroupFilter)(nil), (*v1beta1.SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(a.(*SecurityGroupFilter), b.(*v1beta1.SecurityGroupFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*Subnet)(nil), (*v1beta1.Subnet)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha7_Subnet_To_v1beta1_Subnet(a.(*Subnet), b.(*v1beta1.Subnet), scope) }); err != nil { @@ -346,16 +316,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*SubnetFilter)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(a.(*SubnetFilter), b.(*v1beta1.SubnetFilter), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(a.(*v1beta1.SubnetFilter), b.(*SubnetFilter), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ValueSpec)(nil), (*v1beta1.ValueSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha7_ValueSpec_To_v1beta1_ValueSpec(a.(*ValueSpec), b.(*v1beta1.ValueSpec), scope) }); err != nil { @@ -371,6 +331,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*NetworkFilter)(nil), (*v1beta1.NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(a.(*NetworkFilter), b.(*v1beta1.NetworkFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*OpenStackClusterSpec)(nil), (*v1beta1.OpenStackClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha7_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(a.(*OpenStackClusterSpec), b.(*v1beta1.OpenStackClusterSpec), scope) }); err != nil { @@ -391,11 +356,26 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*RouterFilter)(nil), (*v1beta1.RouterFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(a.(*RouterFilter), b.(*v1beta1.RouterFilter), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*SecurityGroupFilter)(nil), (*v1beta1.SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(a.(*SecurityGroupFilter), b.(*v1beta1.SecurityGroupFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*SecurityGroup)(nil), (*v1beta1.SecurityGroupStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha7_SecurityGroup_To_v1beta1_SecurityGroupStatus(a.(*SecurityGroup), b.(*v1beta1.SecurityGroupStatus), scope) }); err != nil { return err } + if err := s.AddConversionFunc((*SubnetFilter)(nil), (*v1beta1.SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(a.(*SubnetFilter), b.(*v1beta1.SubnetFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.BastionStatus)(nil), (*BastionStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_BastionStatus_To_v1alpha7_BastionStatus(a.(*v1beta1.BastionStatus), b.(*BastionStatus), scope) }); err != nil { @@ -406,6 +386,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.NetworkFilter)(nil), (*NetworkFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(a.(*v1beta1.NetworkFilter), b.(*NetworkFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.OpenStackClusterSpec)(nil), (*OpenStackClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_OpenStackClusterSpec_To_v1alpha7_OpenStackClusterSpec(a.(*v1beta1.OpenStackClusterSpec), b.(*OpenStackClusterSpec), scope) }); err != nil { @@ -436,11 +421,26 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.RouterFilter)(nil), (*RouterFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(a.(*v1beta1.RouterFilter), b.(*RouterFilter), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta1.SecurityGroupFilter)(nil), (*SecurityGroupFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(a.(*v1beta1.SecurityGroupFilter), b.(*SecurityGroupFilter), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.SecurityGroupStatus)(nil), (*SecurityGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_SecurityGroupStatus_To_v1alpha7_SecurityGroup(a.(*v1beta1.SecurityGroupStatus), b.(*SecurityGroup), scope) }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.SubnetFilter)(nil), (*SubnetFilter)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(a.(*v1beta1.SubnetFilter), b.(*SubnetFilter), scope) + }); err != nil { + return err + } return nil } @@ -671,7 +671,15 @@ func Convert_v1beta1_ExternalRouterIPParam_To_v1alpha7_ExternalRouterIPParam(in } func autoConvert_v1alpha7_FixedIP_To_v1beta1_FixedIP(in *FixedIP, out *v1beta1.FixedIP, s conversion.Scope) error { - out.Subnet = (*v1beta1.SubnetFilter)(unsafe.Pointer(in.Subnet)) + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(v1beta1.SubnetFilter) + if err := Convert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Subnet = nil + } if err := optional.Convert_string_To_optional_String(&in.IPAddress, &out.IPAddress, s); err != nil { return err } @@ -684,7 +692,15 @@ func Convert_v1alpha7_FixedIP_To_v1beta1_FixedIP(in *FixedIP, out *v1beta1.Fixed } func autoConvert_v1beta1_FixedIP_To_v1alpha7_FixedIP(in *v1beta1.FixedIP, out *FixedIP, s conversion.Scope) error { - out.Subnet = (*SubnetFilter)(unsafe.Pointer(in.Subnet)) + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(SubnetFilter) + if err := Convert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Subnet = nil + } if err := optional.Convert_optional_String_To_string(&in.IPAddress, &out.IPAddress, s); err != nil { return err } @@ -731,35 +747,22 @@ func autoConvert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilt out.Description = in.Description out.ProjectID = in.ProjectID out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter is an autogenerated conversion function. -func Convert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(in *NetworkFilter, out *v1beta1.NetworkFilter, s conversion.Scope) error { - return autoConvert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(in, out, s) -} - func autoConvert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(in *v1beta1.NetworkFilter, out *NetworkFilter, s conversion.Scope) error { out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter is an autogenerated conversion function. -func Convert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(in *v1beta1.NetworkFilter, out *NetworkFilter, s conversion.Scope) error { - return autoConvert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(in, out, s) -} - func autoConvert_v1alpha7_NetworkStatus_To_v1beta1_NetworkStatus(in *NetworkStatus, out *v1beta1.NetworkStatus, s conversion.Scope) error { out.Name = in.Name out.ID = in.ID @@ -887,14 +890,32 @@ func Convert_v1beta1_OpenStackClusterList_To_v1alpha7_OpenStackClusterList(in *v func autoConvert_v1alpha7_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(in *OpenStackClusterSpec, out *v1beta1.OpenStackClusterSpec, s conversion.Scope) error { // WARNING: in.CloudName requires manual conversion: does not exist in peer-type // WARNING: in.NodeCIDR requires manual conversion: does not exist in peer-type - out.Router = (*v1beta1.RouterFilter)(unsafe.Pointer(in.Router)) + if in.Router != nil { + in, out := &in.Router, &out.Router + *out = new(v1beta1.RouterFilter) + if err := Convert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Router = nil + } if err := Convert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(&in.Network, &out.Network, s); err != nil { return err } // WARNING: in.Subnet requires manual conversion: does not exist in peer-type out.NetworkMTU = in.NetworkMTU // WARNING: in.DNSNameservers requires manual conversion: does not exist in peer-type - out.ExternalRouterIPs = *(*[]v1beta1.ExternalRouterIPParam)(unsafe.Pointer(&in.ExternalRouterIPs)) + if in.ExternalRouterIPs != nil { + in, out := &in.ExternalRouterIPs, &out.ExternalRouterIPs + *out = make([]v1beta1.ExternalRouterIPParam, len(*in)) + for i := range *in { + if err := Convert_v1alpha7_ExternalRouterIPParam_To_v1beta1_ExternalRouterIPParam(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.ExternalRouterIPs = nil + } // WARNING: in.ExternalNetworkID requires manual conversion: does not exist in peer-type if err := Convert_v1alpha7_APIServerLoadBalancer_To_v1beta1_APIServerLoadBalancer(&in.APIServerLoadBalancer, &out.APIServerLoadBalancer, s); err != nil { return err @@ -925,13 +946,31 @@ func autoConvert_v1alpha7_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(i func autoConvert_v1beta1_OpenStackClusterSpec_To_v1alpha7_OpenStackClusterSpec(in *v1beta1.OpenStackClusterSpec, out *OpenStackClusterSpec, s conversion.Scope) error { // WARNING: in.ManagedSubnets requires manual conversion: does not exist in peer-type - out.Router = (*RouterFilter)(unsafe.Pointer(in.Router)) + if in.Router != nil { + in, out := &in.Router, &out.Router + *out = new(RouterFilter) + if err := Convert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Router = nil + } if err := Convert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(&in.Network, &out.Network, s); err != nil { return err } // WARNING: in.Subnets requires manual conversion: does not exist in peer-type out.NetworkMTU = in.NetworkMTU - out.ExternalRouterIPs = *(*[]ExternalRouterIPParam)(unsafe.Pointer(&in.ExternalRouterIPs)) + if in.ExternalRouterIPs != nil { + in, out := &in.ExternalRouterIPs, &out.ExternalRouterIPs + *out = make([]ExternalRouterIPParam, len(*in)) + for i := range *in { + if err := Convert_v1beta1_ExternalRouterIPParam_To_v1alpha7_ExternalRouterIPParam(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.ExternalRouterIPs = nil + } // WARNING: in.ExternalNetwork requires manual conversion: does not exist in peer-type // WARNING: in.DisableExternalNetwork requires manual conversion: does not exist in peer-type if err := Convert_v1beta1_APIServerLoadBalancer_To_v1alpha7_APIServerLoadBalancer(&in.APIServerLoadBalancer, &out.APIServerLoadBalancer, s); err != nil { @@ -1283,7 +1322,17 @@ func autoConvert_v1alpha7_OpenStackMachineSpec_To_v1beta1_OpenStackMachineSpec(i out.Ports = nil } // WARNING: in.FloatingIP requires manual conversion: does not exist in peer-type - out.SecurityGroups = *(*[]v1beta1.SecurityGroupFilter)(unsafe.Pointer(&in.SecurityGroups)) + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]v1beta1.SecurityGroupFilter, len(*in)) + for i := range *in { + if err := Convert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.SecurityGroups = nil + } out.Trunk = in.Trunk out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags)) // WARNING: in.ServerMetadata requires manual conversion: inconvertible types (map[string]string vs []sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1.ServerMetadata) @@ -1320,7 +1369,17 @@ func autoConvert_v1beta1_OpenStackMachineSpec_To_v1alpha7_OpenStackMachineSpec(i } else { out.Ports = nil } - out.SecurityGroups = *(*[]SecurityGroupFilter)(unsafe.Pointer(&in.SecurityGroups)) + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]SecurityGroupFilter, len(*in)) + for i := range *in { + if err := Convert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.SecurityGroups = nil + } out.Trunk = in.Trunk out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags)) // WARNING: in.ServerMetadata requires manual conversion: inconvertible types ([]sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1.ServerMetadata vs map[string]string) @@ -1484,7 +1543,15 @@ func Convert_v1beta1_OpenStackMachineTemplateSpec_To_v1alpha7_OpenStackMachineTe } func autoConvert_v1alpha7_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *v1beta1.PortOpts, s conversion.Scope) error { - out.Network = (*v1beta1.NetworkFilter)(unsafe.Pointer(in.Network)) + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(v1beta1.NetworkFilter) + if err := Convert_v1alpha7_NetworkFilter_To_v1beta1_NetworkFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Network = nil + } if err := optional.Convert_string_To_optional_String(&in.NameSuffix, &out.NameSuffix, s); err != nil { return err } @@ -1534,7 +1601,15 @@ func autoConvert_v1alpha7_PortOpts_To_v1beta1_PortOpts(in *PortOpts, out *v1beta } func autoConvert_v1beta1_PortOpts_To_v1alpha7_PortOpts(in *v1beta1.PortOpts, out *PortOpts, s conversion.Scope) error { - out.Network = (*NetworkFilter)(unsafe.Pointer(in.Network)) + if in.Network != nil { + in, out := &in.Network, &out.Network + *out = new(NetworkFilter) + if err := Convert_v1beta1_NetworkFilter_To_v1alpha7_NetworkFilter(*in, *out, s); err != nil { + return err + } + } else { + out.Network = nil + } if err := optional.Convert_optional_String_To_string(&in.NameSuffix, &out.NameSuffix, s); err != nil { return err } @@ -1638,69 +1713,43 @@ func autoConvert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(in *RouterFilter, out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter is an autogenerated conversion function. -func Convert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(in *RouterFilter, out *v1beta1.RouterFilter, s conversion.Scope) error { - return autoConvert_v1alpha7_RouterFilter_To_v1beta1_RouterFilter(in, out, s) -} - func autoConvert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(in *v1beta1.RouterFilter, out *RouterFilter, s conversion.Scope) error { out.ID = in.ID out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter is an autogenerated conversion function. -func Convert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(in *v1beta1.RouterFilter, out *RouterFilter, s conversion.Scope) error { - return autoConvert_v1beta1_RouterFilter_To_v1alpha7_RouterFilter(in, out, s) -} - func autoConvert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in *SecurityGroupFilter, out *v1beta1.SecurityGroupFilter, s conversion.Scope) error { out.ID = in.ID out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter is an autogenerated conversion function. -func Convert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in *SecurityGroupFilter, out *v1beta1.SecurityGroupFilter, s conversion.Scope) error { - return autoConvert_v1alpha7_SecurityGroupFilter_To_v1beta1_SecurityGroupFilter(in, out, s) -} - func autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(in *v1beta1.SecurityGroupFilter, out *SecurityGroupFilter, s conversion.Scope) error { out.ID = in.ID out.Name = in.Name out.Description = in.Description out.ProjectID = in.ProjectID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter is an autogenerated conversion function. -func Convert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(in *v1beta1.SecurityGroupFilter, out *SecurityGroupFilter, s conversion.Scope) error { - return autoConvert_v1beta1_SecurityGroupFilter_To_v1alpha7_SecurityGroupFilter(in, out, s) -} - func autoConvert_v1alpha7_Subnet_To_v1beta1_Subnet(in *Subnet, out *v1beta1.Subnet, s conversion.Scope) error { out.Name = in.Name out.ID = in.ID @@ -1737,18 +1786,13 @@ func autoConvert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out.IPv6AddressMode = in.IPv6AddressMode out.IPv6RAMode = in.IPv6RAMode out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.Tags requires manual conversion: does not exist in peer-type + // WARNING: in.TagsAny requires manual conversion: does not exist in peer-type + // WARNING: in.NotTags requires manual conversion: does not exist in peer-type + // WARNING: in.NotTagsAny requires manual conversion: does not exist in peer-type return nil } -// Convert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter is an autogenerated conversion function. -func Convert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(in *SubnetFilter, out *v1beta1.SubnetFilter, s conversion.Scope) error { - return autoConvert_v1alpha7_SubnetFilter_To_v1beta1_SubnetFilter(in, out, s) -} - func autoConvert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(in *v1beta1.SubnetFilter, out *SubnetFilter, s conversion.Scope) error { out.Name = in.Name out.Description = in.Description @@ -1759,18 +1803,10 @@ func autoConvert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(in *v1beta1.Subne out.IPv6AddressMode = in.IPv6AddressMode out.IPv6RAMode = in.IPv6RAMode out.ID = in.ID - out.Tags = in.Tags - out.TagsAny = in.TagsAny - out.NotTags = in.NotTags - out.NotTagsAny = in.NotTagsAny + // WARNING: in.FilterByNeutronTags requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter is an autogenerated conversion function. -func Convert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(in *v1beta1.SubnetFilter, out *SubnetFilter, s conversion.Scope) error { - return autoConvert_v1beta1_SubnetFilter_To_v1alpha7_SubnetFilter(in, out, s) -} - func autoConvert_v1alpha7_ValueSpec_To_v1beta1_ValueSpec(in *ValueSpec, out *v1beta1.ValueSpec, s conversion.Scope) error { out.Name = in.Name out.Key = in.Key diff --git a/api/v1beta1/filter_convert.go b/api/v1beta1/filter_convert.go index e168c63e0a..23f7f3c348 100644 --- a/api/v1beta1/filter_convert.go +++ b/api/v1beta1/filter_convert.go @@ -17,6 +17,8 @@ limitations under the License. package v1beta1 import ( + "strings" + "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/layer3/routers" securitygroups "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/groups" @@ -24,20 +26,20 @@ import ( "github.com/gophercloud/gophercloud/openstack/networking/v2/subnets" ) -func (securityGroupFilter SecurityGroupFilter) ToListOpt() securitygroups.ListOpts { +func (securityGroupFilter *SecurityGroupFilter) ToListOpt() securitygroups.ListOpts { return securitygroups.ListOpts{ ID: securityGroupFilter.ID, Name: securityGroupFilter.Name, Description: securityGroupFilter.Description, ProjectID: securityGroupFilter.ProjectID, - Tags: securityGroupFilter.Tags, - TagsAny: securityGroupFilter.TagsAny, - NotTags: securityGroupFilter.NotTags, - NotTagsAny: securityGroupFilter.NotTagsAny, + Tags: joinTags(securityGroupFilter.Tags), + TagsAny: joinTags(securityGroupFilter.TagsAny), + NotTags: joinTags(securityGroupFilter.NotTags), + NotTagsAny: joinTags(securityGroupFilter.NotTagsAny), } } -func (subnetFilter SubnetFilter) ToListOpt() subnets.ListOpts { +func (subnetFilter *SubnetFilter) ToListOpt() subnets.ListOpts { return subnets.ListOpts{ Name: subnetFilter.Name, Description: subnetFilter.Description, @@ -48,43 +50,98 @@ func (subnetFilter SubnetFilter) ToListOpt() subnets.ListOpts { IPv6AddressMode: subnetFilter.IPv6AddressMode, IPv6RAMode: subnetFilter.IPv6RAMode, ID: subnetFilter.ID, - Tags: subnetFilter.Tags, - TagsAny: subnetFilter.TagsAny, - NotTags: subnetFilter.NotTags, - NotTagsAny: subnetFilter.NotTagsAny, + Tags: joinTags(subnetFilter.Tags), + TagsAny: joinTags(subnetFilter.TagsAny), + NotTags: joinTags(subnetFilter.NotTags), + NotTagsAny: joinTags(subnetFilter.NotTagsAny), } } -func (networkFilter NetworkFilter) ToListOpt() networks.ListOpts { +func (networkFilter *NetworkFilter) ToListOpt() networks.ListOpts { return networks.ListOpts{ Name: networkFilter.Name, Description: networkFilter.Description, ProjectID: networkFilter.ProjectID, ID: networkFilter.ID, - Tags: networkFilter.Tags, - TagsAny: networkFilter.TagsAny, - NotTags: networkFilter.NotTags, - NotTagsAny: networkFilter.NotTagsAny, + Tags: joinTags(networkFilter.Tags), + TagsAny: joinTags(networkFilter.TagsAny), + NotTags: joinTags(networkFilter.NotTags), + NotTagsAny: joinTags(networkFilter.NotTagsAny), } } -func (routerFilter RouterFilter) ToListOpt() routers.ListOpts { +func (networkFilter *NetworkFilter) IsEmpty() bool { + return networkFilter.Name == "" && + networkFilter.Description == "" && + networkFilter.ProjectID == "" && + networkFilter.ID == "" && + len(networkFilter.Tags) == 0 && + len(networkFilter.TagsAny) == 0 && + len(networkFilter.NotTags) == 0 && + len(networkFilter.NotTagsAny) == 0 +} + +func (routerFilter *RouterFilter) ToListOpt() routers.ListOpts { return routers.ListOpts{ ID: routerFilter.ID, Name: routerFilter.Name, Description: routerFilter.Description, ProjectID: routerFilter.ProjectID, - Tags: routerFilter.Tags, - TagsAny: routerFilter.TagsAny, - NotTags: routerFilter.NotTags, - NotTagsAny: routerFilter.NotTagsAny, + Tags: joinTags(routerFilter.Tags), + TagsAny: joinTags(routerFilter.TagsAny), + NotTags: joinTags(routerFilter.NotTags), + NotTagsAny: joinTags(routerFilter.NotTagsAny), } } -func (imageFilter ImageFilter) ToListOpt() images.ListOpts { +func (imageFilter *ImageFilter) ToListOpt() images.ListOpts { return images.ListOpts{ ID: imageFilter.ID, Name: imageFilter.Name, Tags: imageFilter.Tags, } } + +// splitTags splits a comma separated list of tags into a slice of tags. +// If the input is an empty string, it returns nil representing no list rather +// than an empty list. +func splitTags(tags string) []NeutronTag { + if tags == "" { + return nil + } + + var ret []NeutronTag + for _, tag := range strings.Split(tags, ",") { + if tag != "" { + ret = append(ret, NeutronTag(tag)) + } + } + + return ret +} + +// joinTags joins a slice of tags into a comma separated list of tags. +func joinTags(tags []NeutronTag) string { + var b strings.Builder + for i := range tags { + if i > 0 { + b.WriteString(",") + } + b.WriteString(string(tags[i])) + } + return b.String() +} + +func ConvertAllTagsTo(tags, tagsAny, notTags, notTagsAny string, neutronTags *FilterByNeutronTags) { + neutronTags.Tags = splitTags(tags) + neutronTags.TagsAny = splitTags(tagsAny) + neutronTags.NotTags = splitTags(notTags) + neutronTags.NotTagsAny = splitTags(notTagsAny) +} + +func ConvertAllTagsFrom(neutronTags *FilterByNeutronTags, tags, tagsAny, notTags, notTagsAny *string) { + *tags = joinTags(neutronTags.Tags) + *tagsAny = joinTags(neutronTags.TagsAny) + *notTags = joinTags(neutronTags.NotTags) + *notTagsAny = joinTags(neutronTags.NotTagsAny) +} diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index ea290a1656..8be6ecc5e4 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -42,15 +42,46 @@ type ExternalRouterIPParam struct { Subnet SubnetFilter `json:"subnet"` } +// NeutronTag represents a tag on a Neutron resource. +// It may not be empty and may not contain commas. +// +kubebuilder:validation:Pattern:="^[^,]+$" +// +kubebuilder:validation:MinLength:=1 +type NeutronTag string + +type FilterByNeutronTags struct { + // Tags is a list of tags to filter by. If specified, the resource must + // have all of the tags specified to be included in the result. + // +listType=set + // +optional + Tags []NeutronTag `json:"tags,omitempty"` + + // TagsAny is a list of tags to filter by. If specified, the resource + // must have at least one of the tags specified to be included in the + // result. + // +listType=set + // +optional + TagsAny []NeutronTag `json:"tagsAny,omitempty"` + + // NotTags is a list of tags to filter by. If specified, resources which + // contain all of the given tags will be excluded from the result. + // +listType=set + // +optional + NotTags []NeutronTag `json:"notTags,omitempty"` + + // NotTagsAny is a list of tags to filter by. If specified, resources + // which contain any of the given tags will be excluded from the result. + // +listType=set + // +optional + NotTagsAny []NeutronTag `json:"notTagsAny,omitempty"` +} + type SecurityGroupFilter struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` ProjectID string `json:"projectId,omitempty"` - Tags string `json:"tags,omitempty"` - TagsAny string `json:"tagsAny,omitempty"` - NotTags string `json:"notTags,omitempty"` - NotTagsAny string `json:"notTagsAny,omitempty"` + + FilterByNeutronTags `json:",inline"` } type NetworkFilter struct { @@ -58,10 +89,8 @@ type NetworkFilter struct { Description string `json:"description,omitempty"` ProjectID string `json:"projectId,omitempty"` ID string `json:"id,omitempty"` - Tags string `json:"tags,omitempty"` - TagsAny string `json:"tagsAny,omitempty"` - NotTags string `json:"notTags,omitempty"` - NotTagsAny string `json:"notTagsAny,omitempty"` + + FilterByNeutronTags `json:",inline"` } type SubnetFilter struct { @@ -74,10 +103,8 @@ type SubnetFilter struct { IPv6AddressMode string `json:"ipv6AddressMode,omitempty"` IPv6RAMode string `json:"ipv6RaMode,omitempty"` ID string `json:"id,omitempty"` - Tags string `json:"tags,omitempty"` - TagsAny string `json:"tagsAny,omitempty"` - NotTags string `json:"notTags,omitempty"` - NotTagsAny string `json:"notTagsAny,omitempty"` + + FilterByNeutronTags `json:",inline"` } type RouterFilter struct { @@ -85,10 +112,8 @@ type RouterFilter struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` ProjectID string `json:"projectId,omitempty"` - Tags string `json:"tags,omitempty"` - TagsAny string `json:"tagsAny,omitempty"` - NotTags string `json:"notTags,omitempty"` - NotTagsAny string `json:"notTagsAny,omitempty"` + + FilterByNeutronTags `json:",inline"` } type SubnetSpec struct { diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index b66e1869c8..cd5c538ffa 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -219,7 +219,7 @@ func (in *DependentMachineResources) DeepCopy() *DependentMachineResources { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalRouterIPParam) DeepCopyInto(out *ExternalRouterIPParam) { *out = *in - out.Subnet = in.Subnet + in.Subnet.DeepCopyInto(&out.Subnet) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalRouterIPParam. @@ -232,13 +232,48 @@ func (in *ExternalRouterIPParam) DeepCopy() *ExternalRouterIPParam { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FilterByNeutronTags) DeepCopyInto(out *FilterByNeutronTags) { + *out = *in + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]NeutronTag, len(*in)) + copy(*out, *in) + } + if in.TagsAny != nil { + in, out := &in.TagsAny, &out.TagsAny + *out = make([]NeutronTag, len(*in)) + copy(*out, *in) + } + if in.NotTags != nil { + in, out := &in.NotTags, &out.NotTags + *out = make([]NeutronTag, len(*in)) + copy(*out, *in) + } + if in.NotTagsAny != nil { + in, out := &in.NotTagsAny, &out.NotTagsAny + *out = make([]NeutronTag, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FilterByNeutronTags. +func (in *FilterByNeutronTags) DeepCopy() *FilterByNeutronTags { + if in == nil { + return nil + } + out := new(FilterByNeutronTags) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FixedIP) DeepCopyInto(out *FixedIP) { *out = *in if in.Subnet != nil { in, out := &in.Subnet, &out.Subnet *out = new(SubnetFilter) - **out = **in + (*in).DeepCopyInto(*out) } if in.IPAddress != nil { in, out := &in.IPAddress, &out.IPAddress @@ -327,6 +362,7 @@ func (in *ManagedSecurityGroups) DeepCopy() *ManagedSecurityGroups { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkFilter) DeepCopyInto(out *NetworkFilter) { *out = *in + in.FilterByNeutronTags.DeepCopyInto(&out.FilterByNeutronTags) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkFilter. @@ -454,20 +490,24 @@ func (in *OpenStackClusterSpec) DeepCopyInto(out *OpenStackClusterSpec) { if in.Router != nil { in, out := &in.Router, &out.Router *out = new(RouterFilter) - **out = **in + (*in).DeepCopyInto(*out) } - out.Network = in.Network + in.Network.DeepCopyInto(&out.Network) if in.Subnets != nil { in, out := &in.Subnets, &out.Subnets *out = make([]SubnetFilter, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.ExternalRouterIPs != nil { in, out := &in.ExternalRouterIPs, &out.ExternalRouterIPs *out = make([]ExternalRouterIPParam, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } - out.ExternalNetwork = in.ExternalNetwork + in.ExternalNetwork.DeepCopyInto(&out.ExternalNetwork) in.APIServerLoadBalancer.DeepCopyInto(&out.APIServerLoadBalancer) if in.ManagedSecurityGroups != nil { in, out := &in.ManagedSecurityGroups, &out.ManagedSecurityGroups @@ -763,7 +803,9 @@ func (in *OpenStackMachineSpec) DeepCopyInto(out *OpenStackMachineSpec) { if in.SecurityGroups != nil { in, out := &in.SecurityGroups, &out.SecurityGroups *out = make([]SecurityGroupFilter, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.Tags != nil { in, out := &in.Tags, &out.Tags @@ -954,7 +996,7 @@ func (in *PortOpts) DeepCopyInto(out *PortOpts) { if in.Network != nil { in, out := &in.Network, &out.Network *out = new(NetworkFilter) - **out = **in + (*in).DeepCopyInto(*out) } if in.NameSuffix != nil { in, out := &in.NameSuffix, &out.NameSuffix @@ -986,7 +1028,9 @@ func (in *PortOpts) DeepCopyInto(out *PortOpts) { if in.SecurityGroups != nil { in, out := &in.SecurityGroups, &out.SecurityGroups *out = make([]SecurityGroupFilter, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } if in.AllowedAddressPairs != nil { in, out := &in.AllowedAddressPairs, &out.AllowedAddressPairs @@ -1127,6 +1171,7 @@ func (in *Router) DeepCopy() *Router { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouterFilter) DeepCopyInto(out *RouterFilter) { *out = *in + in.FilterByNeutronTags.DeepCopyInto(&out.FilterByNeutronTags) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouterFilter. @@ -1142,6 +1187,7 @@ func (in *RouterFilter) DeepCopy() *RouterFilter { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecurityGroupFilter) DeepCopyInto(out *SecurityGroupFilter) { *out = *in + in.FilterByNeutronTags.DeepCopyInto(&out.FilterByNeutronTags) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroupFilter. @@ -1334,6 +1380,7 @@ func (in *Subnet) DeepCopy() *Subnet { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SubnetFilter) DeepCopyInto(out *SubnetFilter) { *out = *in + in.FilterByNeutronTags.DeepCopyInto(&out.FilterByNeutronTags) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetFilter. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml index 195071619b..85b3b178e4 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml @@ -5107,15 +5107,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: object type: array @@ -5146,15 +5191,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object profile: description: |- @@ -5192,15 +5282,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array x-kubernetes-list-type: atomic @@ -5287,15 +5422,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array serverGroup: @@ -5412,15 +5592,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object externalRouterIPs: description: |- @@ -5452,15 +5677,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object required: - subnet @@ -5635,15 +5905,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object networkMtu: description: |- @@ -5664,15 +5979,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object subnets: description: |- @@ -5700,15 +6060,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object maxItems: 2 type: array @@ -5861,15 +6266,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: object type: array @@ -5900,15 +6350,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object profile: description: |- @@ -5946,15 +6441,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array x-kubernetes-list-type: atomic diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml index ff668645be..d4c396ef94 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclustertemplates.yaml @@ -2535,15 +2535,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: object type: array @@ -2575,15 +2620,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object profile: description: |- @@ -2622,15 +2712,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array x-kubernetes-list-type: atomic @@ -2718,15 +2853,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array serverGroup: @@ -2844,15 +3024,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object externalRouterIPs: description: |- @@ -2884,15 +3109,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object required: - subnet @@ -3069,15 +3339,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object networkMtu: description: |- @@ -3098,15 +3413,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object subnets: description: |- @@ -3134,15 +3494,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object maxItems: 2 type: array diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml index 7fbeee04e3..a58649e400 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml @@ -1908,15 +1908,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: object type: array @@ -1946,15 +1991,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object profile: description: |- @@ -1992,15 +2082,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array x-kubernetes-list-type: atomic @@ -2085,15 +2220,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array serverGroup: @@ -2347,15 +2527,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: object type: array @@ -2385,15 +2610,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object profile: description: |- @@ -2431,15 +2701,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array x-kubernetes-list-type: atomic diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml index ca42ad199f..5a4838e274 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachinetemplates.yaml @@ -1582,15 +1582,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: object type: array @@ -1621,15 +1666,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object profile: description: |- @@ -1667,15 +1757,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array x-kubernetes-list-type: atomic @@ -1762,15 +1897,60 @@ spec: name: type: string notTags: - type: string + description: |- + NotTags is a list of tags to filter by. If specified, resources which + contain all of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set notTagsAny: - type: string + description: |- + NotTagsAny is a list of tags to filter by. If specified, resources + which contain any of the given tags will be excluded from the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set projectId: type: string tags: - type: string + description: |- + Tags is a list of tags to filter by. If specified, the resource must + have all of the tags specified to be included in the result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set tagsAny: - type: string + description: |- + TagsAny is a list of tags to filter by. If specified, the resource + must have at least one of the tags specified to be included in the + result. + items: + description: |- + NeutronTag represents a tag on a Neutron resource. + It may not be empty and may not contain commas. + minLength: 1 + pattern: ^[^,]+$ + type: string + type: array + x-kubernetes-list-type: set type: object type: array serverGroup: diff --git a/controllers/openstackcluster_controller.go b/controllers/openstackcluster_controller.go index 6fe81d5220..944155f100 100644 --- a/controllers/openstackcluster_controller.go +++ b/controllers/openstackcluster_controller.go @@ -632,8 +632,7 @@ func reconcilePreExistingNetworkComponents(scope *scope.WithLogger, networkingSe openStackCluster.Status.Network = &infrav1.NetworkStatusWithSubnets{} } - emptyNetwork := infrav1.NetworkFilter{} - if openStackCluster.Spec.Network != emptyNetwork { + if !openStackCluster.Spec.Network.IsEmpty() { netOpts := openStackCluster.Spec.Network.ToListOpt() networkList, err := networkingService.GetNetworksByFilter(&netOpts) if err != nil { diff --git a/docs/book/src/api/v1beta1/api.md b/docs/book/src/api/v1beta1/api.md index 48c293c608..9dc7667830 100644 --- a/docs/book/src/api/v1beta1/api.md +++ b/docs/book/src/api/v1beta1/api.md @@ -1417,6 +1417,88 @@ SubnetFilter +

FilterByNeutronTags +

+

+(Appears on: +NetworkFilter, +RouterFilter, +SecurityGroupFilter, +SubnetFilter) +

+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+tags
+ + +[]NeutronTag + + +
+(Optional) +

Tags is a list of tags to filter by. If specified, the resource must +have all of the tags specified to be included in the result.

+
+tagsAny
+ + +[]NeutronTag + + +
+(Optional) +

TagsAny is a list of tags to filter by. If specified, the resource +must have at least one of the tags specified to be included in the +result.

+
+notTags
+ + +[]NeutronTag + + +
+(Optional) +

NotTags is a list of tags to filter by. If specified, resources which +contain all of the given tags will be excluded from the result.

+
+notTagsAny
+ + +[]NeutronTag + + +
+(Optional) +

NotTagsAny is a list of tags to filter by. If specified, resources +which contain any of the given tags will be excluded from the result.

+

FixedIP

@@ -1718,42 +1800,17 @@ string -tags
- -string - - - - - - - -tagsAny
+FilterByNeutronTags
-string - - - - - - - -notTags
- -string - - - - - - - -notTagsAny
- -string + +FilterByNeutronTags + +

+(Members of FilterByNeutronTags are embedded into this type.) +

@@ -1856,6 +1913,16 @@ NetworkStatus +

NeutronTag +(string alias)

+

+(Appears on: +FilterByNeutronTags) +

+

+

NeutronTag represents a tag on a Neutron resource. +It may not be empty and may not contain commas.

+

OpenStackClusterSpec

@@ -3915,42 +3982,17 @@ string -tags
- -string - - - - - - - -tagsAny
- -string - - - - - - - -notTags
- -string - - - - - - - -notTagsAny
+FilterByNeutronTags
-string + +FilterByNeutronTags + +

+(Members of FilterByNeutronTags are embedded into this type.) +

@@ -4014,42 +4056,17 @@ string -tags
- -string - - - - - - - -tagsAny
+FilterByNeutronTags
-string - - - - - - - -notTags
- -string - - - - - - - -notTagsAny
- -string + +FilterByNeutronTags + +

+(Members of FilterByNeutronTags are embedded into this type.) +

@@ -4647,42 +4664,17 @@ string -tags
+FilterByNeutronTags
-string - - - - - - - -tagsAny
- -string - - - - - - - -notTags
- -string - - - - - - - -notTagsAny
- -string + +FilterByNeutronTags + +

+(Members of FilterByNeutronTags are embedded into this type.) +

diff --git a/docs/book/src/topics/crd-changes/v1alpha7-to-v1beta1.md b/docs/book/src/topics/crd-changes/v1alpha7-to-v1beta1.md index 3087e41929..126b09b391 100644 --- a/docs/book/src/topics/crd-changes/v1alpha7-to-v1beta1.md +++ b/docs/book/src/topics/crd-changes/v1alpha7-to-v1beta1.md @@ -25,6 +25,7 @@ - [Change to managedSecurityGroups](#change-to-managedsecuritygroups) - [Calico CNI](#calico-cni) - [Change to network](#change-to-network) + - [Changes to filter tags](#changes-to-filter-tags) @@ -312,3 +313,33 @@ allow backwards compatibility if `allowAllInClusterTraffic` is set to false. #### Change to network In v1beta1, when the `OpenStackCluster.Spec.Network` is not defined, the `Subnets` are now used to identify the `Network`. + +### Changes to filter tags + +We currently define filters on 4 different Neutron resources which are used throughout the API: +* Networks +* Subnets +* Security Groups +* Routers + +Each of these filters provide the following fields which filter by tag: +* tags +* tagsAny +* notTags +* notTagsAny + +We previously passed this value to Neutron without change, which treated it as a comma-separated list. In v1beta1 each of the tags fields becomes a list of tags. e.g.: + +```yaml +subnet: + tags: "foo,bar" +``` +becomes +```yaml +subnet: + tags: + - foo + - bar +``` + +Due to the limitations of the encoding of tag queries in Neutron, tags must be non-empty and may not contain commas. Tags will be automatically converted to a list of tags during conversion. \ No newline at end of file diff --git a/pkg/cloud/services/networking/network.go b/pkg/cloud/services/networking/network.go index d1dc15c07f..20df7b96bb 100644 --- a/pkg/cloud/services/networking/network.go +++ b/pkg/cloud/services/networking/network.go @@ -86,7 +86,7 @@ func (s *Service) ReconcileExternalNetwork(openStackCluster *infrav1.OpenStackCl return nil } - if openStackCluster.Spec.ExternalNetwork != emptyExternalnetwork { + if openStackCluster.Spec.ExternalNetwork.ToListOpt() != emptyExternalnetwork.ToListOpt() { listOpts = external.ListOptsExt{ ListOptsBuilder: openStackCluster.Spec.ExternalNetwork.ToListOpt(), } diff --git a/pkg/cloud/services/networking/port.go b/pkg/cloud/services/networking/port.go index a4f4488008..e9e8c6df3a 100644 --- a/pkg/cloud/services/networking/port.go +++ b/pkg/cloud/services/networking/port.go @@ -422,7 +422,7 @@ func (s *Service) normalizePorts(ports []infrav1.PortOpts, openStackCluster *inf // normalizePortTarget ensures that the port has a network ID. func (s *Service) normalizePortTarget(port *infrav1.PortOpts, openStackCluster *infrav1.OpenStackCluster, portIdx int) error { // Treat no Network and empty Network the same - noNetwork := port.Network == nil || (*port.Network == infrav1.NetworkFilter{}) + noNetwork := port.Network == nil || port.Network.IsEmpty() // No network or subnets defined: use cluster defaults if noNetwork && len(port.FixedIPs) == 0 { diff --git a/pkg/cloud/services/networking/port_test.go b/pkg/cloud/services/networking/port_test.go index 9fd0c50a6c..5219886060 100644 --- a/pkg/cloud/services/networking/port_test.go +++ b/pkg/cloud/services/networking/port_test.go @@ -200,7 +200,9 @@ func Test_CreatePort(t *testing.T) { Description: pointer.String("this is a test port"), FixedIPs: []infrav1.FixedIP{{ Subnet: &infrav1.SubnetFilter{ - Tags: "Foo", + FilterByNeutronTags: infrav1.FilterByNeutronTags{ + Tags: []infrav1.NeutronTag{"Foo"}, + }, }, IPAddress: pointer.String("192.168.0.50"), }},