Skip to content

Commit f271544

Browse files
committed
Rename referencedResources and dependentResources
This is just a rename. It contains no functional code changes. `referencedResources` becomes `plan`, because that's what it nearly is currently and will be if we finish it. It is a fully resolved intent based on the spec and the environment. `dependentResources` becomes `resources` because it's a collection of OpenStack resources, and `dependent` was redundant.
1 parent dc543ce commit f271544

24 files changed

+320
-312
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.Plan.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.Plan.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\":{\"plan\":{},\"ready\":false,\"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.Plan = previous.Bastion.Plan
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.ResolvedMachineIntent {
100+
return &c.Status.Plan
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
@@ -348,11 +348,11 @@ func restorev1alpha7ClusterStatus(previous *OpenStackClusterStatus, dst *OpenSta
348348
func restorev1beta1ClusterStatus(previous *infrav1.OpenStackClusterStatus, dst *infrav1.OpenStackClusterStatus) {
349349
// ReferencedResources have no equivalent in v1alpha7
350350
if previous.Bastion != nil {
351-
dst.Bastion.ReferencedResources = previous.Bastion.ReferencedResources
351+
dst.Bastion.Plan = previous.Bastion.Plan
352352
}
353353

354-
if previous.Bastion != nil && previous.Bastion.DependentResources.Ports != nil {
355-
dst.Bastion.DependentResources.Ports = previous.Bastion.DependentResources.Ports
354+
if previous.Bastion != nil && previous.Bastion.Resources.Ports != nil {
355+
dst.Bastion.Resources.Ports = previous.Bastion.Resources.Ports
356356
}
357357
}
358358

api/v1alpha7/openstackmachine_conversion.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ var v1beta1OpenStackMachineRestorer = conversion.RestorerFor[*infrav1.OpenStackM
7676
},
7777
restorev1beta1MachineSpec,
7878
),
79-
"depresources": conversion.UnconditionalFieldRestorer(
80-
func(c *infrav1.OpenStackMachine) *infrav1.DependentMachineResources {
81-
return &c.Status.DependentResources
79+
"resources": conversion.UnconditionalFieldRestorer(
80+
func(c *infrav1.OpenStackMachine) *infrav1.MachineResources {
81+
return &c.Status.Resources
8282
},
8383
),
8484
// No equivalent in v1alpha7
85-
"refresources": conversion.UnconditionalFieldRestorer(
86-
func(c *infrav1.OpenStackMachine) *infrav1.ReferencedMachineResources {
87-
return &c.Status.ReferencedResources
85+
"plan": conversion.UnconditionalFieldRestorer(
86+
func(c *infrav1.OpenStackMachine) *infrav1.ResolvedMachineIntent {
87+
return &c.Status.Plan
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
@@ -124,11 +124,12 @@ type OpenStackMachineStatus struct {
124124
// +optional
125125
InstanceState *InstanceState `json:"instanceState,omitempty"`
126126

127-
// ReferencedResources contains resolved references to resources that the machine depends on.
128-
ReferencedResources ReferencedMachineResources `json:"referencedResources,omitempty"`
127+
// Plan contains fully resolved intents which will be used during resource creation.
128+
// Plan is always written to the status before any resources are created.
129+
Plan ResolvedMachineIntent `json:"plan,omitempty"`
129130

130-
// DependentResources contains resolved dependent resources that were created by the machine.
131-
DependentResources DependentMachineResources `json:"dependentResources,omitempty"`
131+
// Resources contains references to the OpenStack resources associated with this machine.
132+
Resources MachineResources `json:"resources,omitempty"`
132133

133134
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
134135

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+
Plan ResolvedMachineIntent `json:"plan,omitempty"`
368+
Resources MachineResources `json:"resources,omitempty"`
369369
}
370370

371371
type RootVolume struct {
@@ -652,8 +652,8 @@ func (s *APIServerLoadBalancer) IsEnabled() bool {
652652
return s != nil && (s.Enabled == nil || *s.Enabled)
653653
}
654654

655-
// ReferencedMachineResources contains resolved references to resources required by the machine.
656-
type ReferencedMachineResources struct {
655+
// ResolvedMachineIntent contains resolved references to resources required by the machine.
656+
type ResolvedMachineIntent struct {
657657
// ServerGroupID is the ID of the server group the machine should be added to and is calculated based on ServerGroupFilter.
658658
// +optional
659659
ServerGroupID string `json:"serverGroupID,omitempty"`
@@ -667,7 +667,7 @@ type ReferencedMachineResources struct {
667667
Ports []ResolvedPortSpec `json:"ports,omitempty"`
668668
}
669669

670-
type DependentMachineResources struct {
670+
type MachineResources struct {
671671
// Ports is the status of the ports created for the machine.
672672
// +optional
673673
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)