@@ -31,7 +31,11 @@ type IronCoreMachineConfig struct {
3131 IgnitionData []byte
3232 NetworkInterfaceConfigs []* IronCoreNetworkInterfaceConfig
3333 VolumeConfigs []* IronCoreVolumeConfig
34- HostName string
34+ GuestConfig * IroncoreGuestConfig
35+ }
36+
37+ type IroncoreGuestConfig struct {
38+ Hostname string
3539}
3640
3741func (s * Server ) ironcoreMachinePoolRef () * corev1.LocalObjectReference {
@@ -106,6 +110,12 @@ func (s *Server) getIronCoreMachineConfig(machine *iri.Machine) (*IronCoreMachin
106110 return nil , fmt .Errorf ("error preparing ironcore machine annotations: %w" , err )
107111 }
108112
113+ var ironcoreGuestConfig * IroncoreGuestConfig
114+ if machine .Spec .GuestConfig != nil {
115+ ironcoreGuestConfig = & IroncoreGuestConfig {
116+ Hostname : machine .Spec .GuestConfig .Hostname ,
117+ }
118+ }
109119 return & IronCoreMachineConfig {
110120 Labels : labels ,
111121 Annotations : annotations ,
@@ -114,7 +124,7 @@ func (s *Server) getIronCoreMachineConfig(machine *iri.Machine) (*IronCoreMachin
114124 IgnitionData : machine .Spec .IgnitionData ,
115125 NetworkInterfaceConfigs : ironcoreNicCfgs ,
116126 VolumeConfigs : ironcoreVolumeCfgs ,
117- HostName : machine . Spec . HostName ,
127+ GuestConfig : ironcoreGuestConfig ,
118128 }, nil
119129}
120130
@@ -129,7 +139,6 @@ func (s *Server) createIronCoreMachine(
129139 var (
130140 ignitionRef * commonv1alpha1.SecretKeySelector
131141 ignitionSecret * corev1.Secret
132- guestConfig * computev1alpha1.MachineGuestConfig
133142 )
134143 if ignitionData := cfg .IgnitionData ; len (ignitionData ) > 0 {
135144 log .V (1 ).Info ("Creating ironcore ignition secret" )
@@ -181,9 +190,10 @@ func (s *Server) createIronCoreMachine(
181190 }
182191 }
183192
184- if cfg .HostName != "" {
185- guestConfig = & computev1alpha1.MachineGuestConfig {
186- Hostname : cfg .HostName ,
193+ var ironcoreGuestConfig * computev1alpha1.MachineGuestConfig
194+ if cfg .GuestConfig != nil {
195+ ironcoreGuestConfig = & computev1alpha1.MachineGuestConfig {
196+ Hostname : cfg .GuestConfig .Hostname ,
187197 }
188198 }
189199
@@ -205,7 +215,7 @@ func (s *Server) createIronCoreMachine(
205215 NetworkInterfaces : ironcoreMachineNics ,
206216 Volumes : ironcoreMachineVolumes ,
207217 IgnitionRef : ignitionRef ,
208- GuestConfig : guestConfig ,
218+ GuestConfig : ironcoreGuestConfig ,
209219 },
210220 }
211221 log .V (1 ).Info ("Creating ironcore machine" )
0 commit comments