@@ -33,6 +33,7 @@ import (
3333 "github.com/ionos-cloud/cluster-api-provider-proxmox/pkg/cloudinit"
3434 "github.com/ionos-cloud/cluster-api-provider-proxmox/pkg/ignition"
3535 "github.com/ionos-cloud/cluster-api-provider-proxmox/pkg/scope"
36+ "github.com/ionos-cloud/cluster-api-provider-proxmox/pkg/types"
3637)
3738
3839func reconcileBootstrapData (ctx context.Context , machineScope * scope.MachineScope ) (requeue bool , err error ) {
@@ -86,7 +87,7 @@ func reconcileBootstrapData(ctx context.Context, machineScope *scope.MachineScop
8687 return false , nil
8788}
8889
89- func injectCloudInit (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []cloudinit .NetworkConfigData ) error {
90+ func injectCloudInit (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []types .NetworkConfigData ) error {
9091 // create network renderer
9192 network := cloudinit .NewNetworkConfig (nicData )
9293
@@ -101,7 +102,7 @@ func injectCloudInit(ctx context.Context, machineScope *scope.MachineScope, boot
101102 return nil
102103}
103104
104- func injectIgnition (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []cloudinit .NetworkConfigData ) error {
105+ func injectIgnition (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []types .NetworkConfigData ) error {
105106 // create metadata renderer
106107 metadata := cloudinit .NewMetadata (biosUUID , machineScope .Name (), ptr .Deref (machineScope .ProxmoxMachine .Spec .MetadataSettings , infrav1alpha1.MetadataSettings {ProviderIDInjection : false }).ProviderIDInjection )
107108
@@ -172,10 +173,10 @@ func getBootstrapData(ctx context.Context, scope *scope.MachineScope) ([]byte, *
172173 return value , & format , nil
173174}
174175
175- func getNetworkConfigData (ctx context.Context , machineScope * scope.MachineScope ) ([]cloudinit .NetworkConfigData , error ) {
176+ func getNetworkConfigData (ctx context.Context , machineScope * scope.MachineScope ) ([]types .NetworkConfigData , error ) {
176177 // provide a default in case network is not defined
177178 network := ptr .Deref (machineScope .ProxmoxMachine .Spec .Network , infrav1alpha1.NetworkSpec {})
178- networkConfigData := make ([]cloudinit .NetworkConfigData , 0 , 1 + len (network .AdditionalDevices )+ len (network .VRFs ))
179+ networkConfigData := make ([]types .NetworkConfigData , 0 , 1 + len (network .AdditionalDevices )+ len (network .VRFs ))
179180
180181 defaultConfig , err := getDefaultNetworkDevice (ctx , machineScope )
181182 if err != nil {
@@ -198,10 +199,10 @@ func getNetworkConfigData(ctx context.Context, machineScope *scope.MachineScope)
198199 return networkConfigData , nil
199200}
200201
201- func getRoutingData (routes []infrav1alpha1.RouteSpec ) * []cloudinit .RoutingData {
202- routingData := make ([]cloudinit .RoutingData , 0 , len (routes ))
202+ func getRoutingData (routes []infrav1alpha1.RouteSpec ) * []types .RoutingData {
203+ routingData := make ([]types .RoutingData , 0 , len (routes ))
203204 for _ , route := range routes {
204- routeSpec := cloudinit .RoutingData {}
205+ routeSpec := types .RoutingData {}
205206 routeSpec .To = route .To
206207 routeSpec .Via = route .Via
207208 routeSpec .Metric = route .Metric
@@ -212,10 +213,10 @@ func getRoutingData(routes []infrav1alpha1.RouteSpec) *[]cloudinit.RoutingData {
212213 return & routingData
213214}
214215
215- func getRoutingPolicyData (rules []infrav1alpha1.RoutingPolicySpec ) * []cloudinit .FIBRuleData {
216- routingPolicyData := make ([]cloudinit .FIBRuleData , 0 , len (rules ))
216+ func getRoutingPolicyData (rules []infrav1alpha1.RoutingPolicySpec ) * []types .FIBRuleData {
217+ routingPolicyData := make ([]types .FIBRuleData , 0 , len (rules ))
217218 for _ , rule := range rules {
218- ruleSpec := cloudinit .FIBRuleData {}
219+ ruleSpec := types .FIBRuleData {}
219220 ruleSpec .To = rule .To
220221 ruleSpec .From = rule .From
221222 ruleSpec .Priority = rule .Priority
@@ -228,7 +229,7 @@ func getRoutingPolicyData(rules []infrav1alpha1.RoutingPolicySpec) *[]cloudinit.
228229 return & routingPolicyData
229230}
230231
231- func getNetworkConfigDataForDevice (ctx context.Context , machineScope * scope.MachineScope , device string ) (* cloudinit .NetworkConfigData , error ) {
232+ func getNetworkConfigDataForDevice (ctx context.Context , machineScope * scope.MachineScope , device string ) (* types .NetworkConfigData , error ) {
232233 nets := machineScope .VirtualMachine .VirtualMachineConfig .MergeNets ()
233234 // For nics supporting multiple IP addresses, we need to cut the '-inet' or '-inet6' part,
234235 // to retrieve the correct MAC address.
@@ -252,7 +253,7 @@ func getNetworkConfigDataForDevice(ctx context.Context, machineScope *scope.Mach
252253 return nil , errors .Wrapf (err , "error converting metric annotation, kind=%s, name=%s" , ipAddr .Spec .PoolRef .Kind , ipAddr .Spec .PoolRef .Name )
253254 }
254255
255- cloudinitNetworkConfigData := & cloudinit .NetworkConfigData {
256+ cloudinitNetworkConfigData := & types .NetworkConfigData {
256257 MacAddress : macAddress ,
257258 DNSServers : dns ,
258259 }
@@ -271,8 +272,8 @@ func getNetworkConfigDataForDevice(ctx context.Context, machineScope *scope.Mach
271272 return cloudinitNetworkConfigData , nil
272273}
273274
274- func getDefaultNetworkDevice (ctx context.Context , machineScope * scope.MachineScope ) ([]cloudinit .NetworkConfigData , error ) {
275- var config cloudinit .NetworkConfigData
275+ func getDefaultNetworkDevice (ctx context.Context , machineScope * scope.MachineScope ) ([]types .NetworkConfigData , error ) {
276+ var config types .NetworkConfigData
276277
277278 // default network device ipv4.
278279 if machineScope .InfraCluster .ProxmoxCluster .Spec .IPv4Config != nil {
@@ -318,10 +319,10 @@ func getDefaultNetworkDevice(ctx context.Context, machineScope *scope.MachineSco
318319 config .Type = "ethernet"
319320 config .ProxName = "net0"
320321
321- return []cloudinit .NetworkConfigData {config }, nil
322+ return []types .NetworkConfigData {config }, nil
322323}
323324
324- func getCommonInterfaceConfig (ctx context.Context , machineScope * scope.MachineScope , ciconfig * cloudinit .NetworkConfigData , ifconfig infrav1alpha1.InterfaceConfig ) error {
325+ func getCommonInterfaceConfig (ctx context.Context , machineScope * scope.MachineScope , ciconfig * types .NetworkConfigData , ifconfig infrav1alpha1.InterfaceConfig ) error {
325326 if len (ifconfig .DNSServers ) != 0 {
326327 ciconfig .DNSServers = ifconfig .DNSServers
327328 }
@@ -364,11 +365,11 @@ func getCommonInterfaceConfig(ctx context.Context, machineScope *scope.MachineSc
364365 return nil
365366}
366367
367- func getVirtualNetworkDevices (_ context.Context , _ * scope.MachineScope , network infrav1alpha1.NetworkSpec , data []cloudinit .NetworkConfigData ) ([]cloudinit .NetworkConfigData , error ) {
368- networkConfigData := make ([]cloudinit .NetworkConfigData , 0 , len (network .VRFs ))
368+ func getVirtualNetworkDevices (_ context.Context , _ * scope.MachineScope , network infrav1alpha1.NetworkSpec , data []types .NetworkConfigData ) ([]types .NetworkConfigData , error ) {
369+ networkConfigData := make ([]types .NetworkConfigData , 0 , len (network .VRFs ))
369370
370371 for _ , device := range network .VRFs {
371- var config = ptr .To (cloudinit .NetworkConfigData {})
372+ var config = ptr .To (types .NetworkConfigData {})
372373 config .Type = "vrf"
373374 config .Name = device .Name
374375 config .Table = device .Table
@@ -391,14 +392,14 @@ func getVirtualNetworkDevices(_ context.Context, _ *scope.MachineScope, network
391392 return networkConfigData , nil
392393}
393394
394- func getAdditionalNetworkDevices (ctx context.Context , machineScope * scope.MachineScope , network infrav1alpha1.NetworkSpec ) ([]cloudinit .NetworkConfigData , error ) {
395- networkConfigData := make ([]cloudinit .NetworkConfigData , 0 , len (network .AdditionalDevices ))
395+ func getAdditionalNetworkDevices (ctx context.Context , machineScope * scope.MachineScope , network infrav1alpha1.NetworkSpec ) ([]types .NetworkConfigData , error ) {
396+ networkConfigData := make ([]types .NetworkConfigData , 0 , len (network .AdditionalDevices ))
396397
397398 // additional network devices append after the provisioning interface
398399 var index = 1
399400 // additional network devices.
400401 for _ , nic := range network .AdditionalDevices {
401- var config = ptr .To (cloudinit .NetworkConfigData {})
402+ var config = ptr .To (types .NetworkConfigData {})
402403
403404 if nic .IPv4PoolRef != nil {
404405 device := fmt .Sprintf ("%s-%s" , nic .Name , infrav1alpha1 .DefaultSuffix )
0 commit comments