Skip to content

Commit 59689c9

Browse files
authored
Merge pull request #1965 from shiftstack/machineresources
🌱 Rename referencedResources and dependentResources
2 parents cb99e17 + 5d11950 commit 59689c9

24 files changed

+307
-304
lines changed

api/v1alpha5/conversion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ func Convert_v1alpha5_Instance_To_v1beta1_BastionStatus(in *Instance, out *infra
455455
out.State = infrav1.InstanceState(in.State)
456456
out.IP = in.IP
457457
out.FloatingIP = in.FloatingIP
458-
out.ReferencedResources.ServerGroupID = in.ServerGroupID
458+
out.Resolved.ServerGroupID = in.ServerGroupID
459459
return nil
460460
}
461461

@@ -467,7 +467,7 @@ func Convert_v1beta1_BastionStatus_To_v1alpha5_Instance(in *infrav1.BastionStatu
467467
out.State = InstanceState(in.State)
468468
out.IP = in.IP
469469
out.FloatingIP = in.FloatingIP
470-
out.ServerGroupID = in.ReferencedResources.ServerGroupID
470+
out.ServerGroupID = in.Resolved.ServerGroupID
471471
return nil
472472
}
473473

api/v1alpha5/conversion_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestConvertFrom(t *testing.T) {
8787
Spec: OpenStackMachineSpec{},
8888
ObjectMeta: metav1.ObjectMeta{
8989
Annotations: map[string]string{
90-
"cluster.x-k8s.io/conversion-data": "{\"spec\":{\"flavor\":\"\",\"image\":{}},\"status\":{\"dependentResources\":{},\"ready\":false,\"referencedResources\":{}}}",
90+
"cluster.x-k8s.io/conversion-data": "{\"spec\":{\"flavor\":\"\",\"image\":{}},\"status\":{\"ready\":false,\"resolved\":{},\"resources\":{}}}",
9191
},
9292
},
9393
},

api/v1alpha5/zz_generated.conversion.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha6/openstackcluster_conversion.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ func restorev1beta1ClusterStatus(previous *infrav1.OpenStackClusterStatus, dst *
368368
dst.BastionSecurityGroup = previous.BastionSecurityGroup
369369

370370
if previous.Bastion != nil {
371-
dst.Bastion.ReferencedResources = previous.Bastion.ReferencedResources
371+
dst.Bastion.Resolved = previous.Bastion.Resolved
372372
}
373-
if previous.Bastion != nil && previous.Bastion.DependentResources.Ports != nil {
374-
dst.Bastion.DependentResources.Ports = previous.Bastion.DependentResources.Ports
373+
if previous.Bastion != nil && previous.Bastion.Resources.Ports != nil {
374+
dst.Bastion.Resources.Ports = previous.Bastion.Resources.Ports
375375
}
376376
}
377377

api/v1alpha6/openstackmachine_conversion.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ var v1beta1OpenStackMachineRestorer = conversion.RestorerFor[*infrav1.OpenStackM
9090
restorev1beta1MachineSpec,
9191
),
9292
"depresources": conversion.UnconditionalFieldRestorer(
93-
func(c *infrav1.OpenStackMachine) *infrav1.DependentMachineResources {
94-
return &c.Status.DependentResources
93+
func(c *infrav1.OpenStackMachine) *infrav1.MachineResources {
94+
return &c.Status.Resources
9595
},
9696
),
9797
// No equivalent in v1alpha6
9898
"refresources": conversion.UnconditionalFieldRestorer(
99-
func(c *infrav1.OpenStackMachine) *infrav1.ReferencedMachineResources {
100-
return &c.Status.ReferencedResources
99+
func(c *infrav1.OpenStackMachine) *infrav1.ResolvedMachineSpec {
100+
return &c.Status.Resolved
101101
},
102102
),
103103
}

api/v1alpha6/zz_generated.conversion.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha7/openstackcluster_conversion.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ func restorev1alpha7ClusterStatus(previous *OpenStackClusterStatus, dst *OpenSta
350350
func restorev1beta1ClusterStatus(previous *infrav1.OpenStackClusterStatus, dst *infrav1.OpenStackClusterStatus) {
351351
// ReferencedResources have no equivalent in v1alpha7
352352
if previous.Bastion != nil {
353-
dst.Bastion.ReferencedResources = previous.Bastion.ReferencedResources
353+
dst.Bastion.Resolved = previous.Bastion.Resolved
354354
}
355355

356-
if previous.Bastion != nil && previous.Bastion.DependentResources.Ports != nil {
357-
dst.Bastion.DependentResources.Ports = previous.Bastion.DependentResources.Ports
356+
if previous.Bastion != nil && previous.Bastion.Resources.Ports != nil {
357+
dst.Bastion.Resources.Ports = previous.Bastion.Resources.Ports
358358
}
359359
}
360360

api/v1alpha7/openstackmachine_conversion.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ var v1beta1OpenStackMachineRestorer = conversion.RestorerFor[*infrav1.OpenStackM
7777
restorev1beta1MachineSpec,
7878
),
7979
"depresources": conversion.UnconditionalFieldRestorer(
80-
func(c *infrav1.OpenStackMachine) *infrav1.DependentMachineResources {
81-
return &c.Status.DependentResources
80+
func(c *infrav1.OpenStackMachine) *infrav1.MachineResources {
81+
return &c.Status.Resources
8282
},
8383
),
8484
// No equivalent in v1alpha7
8585
"refresources": conversion.UnconditionalFieldRestorer(
86-
func(c *infrav1.OpenStackMachine) *infrav1.ReferencedMachineResources {
87-
return &c.Status.ReferencedResources
86+
func(c *infrav1.OpenStackMachine) *infrav1.ResolvedMachineSpec {
87+
return &c.Status.Resolved
8888
},
8989
),
9090
}

api/v1alpha7/zz_generated.conversion.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/openstackmachine_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ type OpenStackMachineStatus struct {
126126
// +optional
127127
InstanceState *InstanceState `json:"instanceState,omitempty"`
128128

129-
// ReferencedResources contains resolved references to resources that the machine depends on.
130-
ReferencedResources ReferencedMachineResources `json:"referencedResources,omitempty"`
129+
// Resolved contains parts of the machine spec with all external
130+
// references fully resolved.
131+
Resolved ResolvedMachineSpec `json:"resolved,omitempty"`
131132

132-
// DependentResources contains resolved dependent resources that were created by the machine.
133-
DependentResources DependentMachineResources `json:"dependentResources,omitempty"`
133+
// Resources contains references to OpenStack resources created for the machine.
134+
Resources MachineResources `json:"resources,omitempty"`
134135

135136
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
136137

api/v1beta1/types.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,14 @@ type AddressPair struct {
358358
}
359359

360360
type BastionStatus struct {
361-
ID string `json:"id,omitempty"`
362-
Name string `json:"name,omitempty"`
363-
SSHKeyName string `json:"sshKeyName,omitempty"`
364-
State InstanceState `json:"state,omitempty"`
365-
IP string `json:"ip,omitempty"`
366-
FloatingIP string `json:"floatingIP,omitempty"`
367-
ReferencedResources ReferencedMachineResources `json:"referencedResources,omitempty"`
368-
DependentResources DependentMachineResources `json:"dependentResources,omitempty"`
361+
ID string `json:"id,omitempty"`
362+
Name string `json:"name,omitempty"`
363+
SSHKeyName string `json:"sshKeyName,omitempty"`
364+
State InstanceState `json:"state,omitempty"`
365+
IP string `json:"ip,omitempty"`
366+
FloatingIP string `json:"floatingIP,omitempty"`
367+
Resolved ResolvedMachineSpec `json:"resolved,omitempty"`
368+
Resources MachineResources `json:"resources,omitempty"`
369369
}
370370

371371
type RootVolume struct {
@@ -658,8 +658,8 @@ func (s *APIServerLoadBalancer) IsEnabled() bool {
658658
return s != nil && (s.Enabled == nil || *s.Enabled)
659659
}
660660

661-
// ReferencedMachineResources contains resolved references to resources required by the machine.
662-
type ReferencedMachineResources struct {
661+
// ResolvedMachineSpec contains resolved references to resources required by the machine.
662+
type ResolvedMachineSpec struct {
663663
// ServerGroupID is the ID of the server group the machine should be added to and is calculated based on ServerGroupFilter.
664664
// +optional
665665
ServerGroupID string `json:"serverGroupID,omitempty"`
@@ -673,7 +673,7 @@ type ReferencedMachineResources struct {
673673
Ports []ResolvedPortSpec `json:"ports,omitempty"`
674674
}
675675

676-
type DependentMachineResources struct {
676+
type MachineResources struct {
677677
// Ports is the status of the ports created for the machine.
678678
// +optional
679679
Ports []PortStatus `json:"ports,omitempty"`

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 46 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)