@@ -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 ) {
@@ -91,7 +92,7 @@ func reconcileBootstrapData(ctx context.Context, machineScope *scope.MachineScop
9192 return false , nil
9293}
9394
94- func injectCloudInit (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []cloudinit .NetworkConfigData , kubernetesVersion string ) error {
95+ func injectCloudInit (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []types .NetworkConfigData , kubernetesVersion string ) error {
9596 // create network renderer
9697 network := cloudinit .NewNetworkConfig (nicData )
9798
@@ -106,7 +107,7 @@ func injectCloudInit(ctx context.Context, machineScope *scope.MachineScope, boot
106107 return nil
107108}
108109
109- func injectIgnition (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []cloudinit .NetworkConfigData , kubernetesVersion string ) error {
110+ func injectIgnition (ctx context.Context , machineScope * scope.MachineScope , bootstrapData []byte , biosUUID string , nicData []types .NetworkConfigData , kubernetesVersion string ) error {
110111 // create metadata renderer
111112 metadata := cloudinit .NewMetadata (biosUUID , machineScope .Name (), kubernetesVersion , ptr .Deref (machineScope .ProxmoxMachine .Spec .MetadataSettings , infrav1alpha1.MetadataSettings {ProviderIDInjection : false }).ProviderIDInjection )
112113
@@ -180,10 +181,10 @@ func getBootstrapData(ctx context.Context, scope *scope.MachineScope) ([]byte, *
180181 return value , & format , nil
181182}
182183
183- func getNetworkConfigData (ctx context.Context , machineScope * scope.MachineScope ) ([]cloudinit .NetworkConfigData , error ) {
184+ func getNetworkConfigData (ctx context.Context , machineScope * scope.MachineScope ) ([]types .NetworkConfigData , error ) {
184185 // provide a default in case network is not defined
185186 network := ptr .Deref (machineScope .ProxmoxMachine .Spec .Network , infrav1alpha1.NetworkSpec {})
186- networkConfigData := make ([]cloudinit .NetworkConfigData , 0 , 1 + len (network .AdditionalDevices )+ len (network .VRFs ))
187+ networkConfigData := make ([]types .NetworkConfigData , 0 , 1 + len (network .AdditionalDevices )+ len (network .VRFs ))
187188
188189 defaultConfig , err := getDefaultNetworkDevice (ctx , machineScope )
189190 if err != nil {
@@ -206,10 +207,10 @@ func getNetworkConfigData(ctx context.Context, machineScope *scope.MachineScope)
206207 return networkConfigData , nil
207208}
208209
209- func getRoutingData (routes []infrav1alpha1.RouteSpec ) * []cloudinit .RoutingData {
210- routingData := make ([]cloudinit .RoutingData , 0 , len (routes ))
210+ func getRoutingData (routes []infrav1alpha1.RouteSpec ) * []types .RoutingData {
211+ routingData := make ([]types .RoutingData , 0 , len (routes ))
211212 for _ , route := range routes {
212- routeSpec := cloudinit .RoutingData {}
213+ routeSpec := types .RoutingData {}
213214 routeSpec .To = route .To
214215 routeSpec .Via = route .Via
215216 routeSpec .Metric = route .Metric
@@ -220,10 +221,10 @@ func getRoutingData(routes []infrav1alpha1.RouteSpec) *[]cloudinit.RoutingData {
220221 return & routingData
221222}
222223
223- func getRoutingPolicyData (rules []infrav1alpha1.RoutingPolicySpec ) * []cloudinit .FIBRuleData {
224- routingPolicyData := make ([]cloudinit .FIBRuleData , 0 , len (rules ))
224+ func getRoutingPolicyData (rules []infrav1alpha1.RoutingPolicySpec ) * []types .FIBRuleData {
225+ routingPolicyData := make ([]types .FIBRuleData , 0 , len (rules ))
225226 for _ , rule := range rules {
226- ruleSpec := cloudinit .FIBRuleData {}
227+ ruleSpec := types .FIBRuleData {}
227228 ruleSpec .To = rule .To
228229 ruleSpec .From = rule .From
229230 ruleSpec .Priority = rule .Priority
@@ -236,7 +237,7 @@ func getRoutingPolicyData(rules []infrav1alpha1.RoutingPolicySpec) *[]cloudinit.
236237 return & routingPolicyData
237238}
238239
239- func getNetworkConfigDataForDevice (ctx context.Context , machineScope * scope.MachineScope , device string ) (* cloudinit .NetworkConfigData , error ) {
240+ func getNetworkConfigDataForDevice (ctx context.Context , machineScope * scope.MachineScope , device string ) (* types .NetworkConfigData , error ) {
240241 nets := machineScope .VirtualMachine .VirtualMachineConfig .MergeNets ()
241242 // For nics supporting multiple IP addresses, we need to cut the '-inet' or '-inet6' part,
242243 // to retrieve the correct MAC address.
@@ -260,7 +261,7 @@ func getNetworkConfigDataForDevice(ctx context.Context, machineScope *scope.Mach
260261 return nil , errors .Wrapf (err , "error converting metric annotation, kind=%s, name=%s" , ipAddr .Spec .PoolRef .Kind , ipAddr .Spec .PoolRef .Name )
261262 }
262263
263- cloudinitNetworkConfigData := & cloudinit .NetworkConfigData {
264+ cloudinitNetworkConfigData := & types .NetworkConfigData {
264265 MacAddress : macAddress ,
265266 DNSServers : dns ,
266267 }
@@ -279,8 +280,8 @@ func getNetworkConfigDataForDevice(ctx context.Context, machineScope *scope.Mach
279280 return cloudinitNetworkConfigData , nil
280281}
281282
282- func getDefaultNetworkDevice (ctx context.Context , machineScope * scope.MachineScope ) ([]cloudinit .NetworkConfigData , error ) {
283- var config cloudinit .NetworkConfigData
283+ func getDefaultNetworkDevice (ctx context.Context , machineScope * scope.MachineScope ) ([]types .NetworkConfigData , error ) {
284+ var config types .NetworkConfigData
284285
285286 // default network device ipv4.
286287 if machineScope .InfraCluster .ProxmoxCluster .Spec .IPv4Config != nil {
@@ -326,10 +327,10 @@ func getDefaultNetworkDevice(ctx context.Context, machineScope *scope.MachineSco
326327 config .Type = "ethernet"
327328 config .ProxName = "net0"
328329
329- return []cloudinit .NetworkConfigData {config }, nil
330+ return []types .NetworkConfigData {config }, nil
330331}
331332
332- func getCommonInterfaceConfig (ctx context.Context , machineScope * scope.MachineScope , ciconfig * cloudinit .NetworkConfigData , ifconfig infrav1alpha1.InterfaceConfig ) error {
333+ func getCommonInterfaceConfig (ctx context.Context , machineScope * scope.MachineScope , ciconfig * types .NetworkConfigData , ifconfig infrav1alpha1.InterfaceConfig ) error {
333334 if len (ifconfig .DNSServers ) != 0 {
334335 ciconfig .DNSServers = ifconfig .DNSServers
335336 }
@@ -372,11 +373,11 @@ func getCommonInterfaceConfig(ctx context.Context, machineScope *scope.MachineSc
372373 return nil
373374}
374375
375- func getVirtualNetworkDevices (_ context.Context , _ * scope.MachineScope , network infrav1alpha1.NetworkSpec , data []cloudinit .NetworkConfigData ) ([]cloudinit .NetworkConfigData , error ) {
376- networkConfigData := make ([]cloudinit .NetworkConfigData , 0 , len (network .VRFs ))
376+ func getVirtualNetworkDevices (_ context.Context , _ * scope.MachineScope , network infrav1alpha1.NetworkSpec , data []types .NetworkConfigData ) ([]types .NetworkConfigData , error ) {
377+ networkConfigData := make ([]types .NetworkConfigData , 0 , len (network .VRFs ))
377378
378379 for _ , device := range network .VRFs {
379- var config = ptr .To (cloudinit .NetworkConfigData {})
380+ var config = ptr .To (types .NetworkConfigData {})
380381 config .Type = "vrf"
381382 config .Name = device .Name
382383 config .Table = device .Table
@@ -399,14 +400,14 @@ func getVirtualNetworkDevices(_ context.Context, _ *scope.MachineScope, network
399400 return networkConfigData , nil
400401}
401402
402- func getAdditionalNetworkDevices (ctx context.Context , machineScope * scope.MachineScope , network infrav1alpha1.NetworkSpec ) ([]cloudinit .NetworkConfigData , error ) {
403- networkConfigData := make ([]cloudinit .NetworkConfigData , 0 , len (network .AdditionalDevices ))
403+ func getAdditionalNetworkDevices (ctx context.Context , machineScope * scope.MachineScope , network infrav1alpha1.NetworkSpec ) ([]types .NetworkConfigData , error ) {
404+ networkConfigData := make ([]types .NetworkConfigData , 0 , len (network .AdditionalDevices ))
404405
405406 // additional network devices append after the provisioning interface
406407 var index = 1
407408 // additional network devices.
408409 for _ , nic := range network .AdditionalDevices {
409- var config = ptr .To (cloudinit .NetworkConfigData {})
410+ var config = ptr .To (types .NetworkConfigData {})
410411
411412 if nic .IPv4PoolRef != nil {
412413 device := fmt .Sprintf ("%s-%s" , nic .Name , infrav1alpha1 .DefaultSuffix )
0 commit comments