Skip to content

Commit b96b96e

Browse files
More comments
1 parent 86b8c32 commit b96b96e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

internal/contract/types.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,14 @@ type Int32 struct {
107107
paths []Path
108108
}
109109

110-
// Path returns the path to the int64 value.
110+
// Path returns the path to the int32 value.
111111
func (i *Int32) Path() []Path {
112112
return i.paths
113113
}
114114

115-
// Get gets the int64 value.
115+
// Get gets the int32 value.
116+
// If more than one path is defined, path are checked in order and the first value reported is used
117+
// (e.g. in case when we are reading from a preferred location first, and then from one or more fallback locations).
116118
func (i *Int32) Get(obj *unstructured.Unstructured) (*int32, error) {
117119
paths := []string{}
118120
for _, path := range i.paths {
@@ -130,7 +132,10 @@ func (i *Int32) Get(obj *unstructured.Unstructured) (*int32, error) {
130132
return nil, errors.Wrapf(ErrFieldNotFound, "path %s", strings.Join(paths, ", "))
131133
}
132134

133-
// Set sets the int64 value in the path.
135+
// Set sets the int32 value in the path.
136+
// If more than one path is defined, only the first path will be set.
137+
// (the first path is considered the preferred location).
138+
// Note: Cluster API should never Set values on external objects owner by providers; however this method is useful for writing tests.
134139
func (i *Int32) Set(obj *unstructured.Unstructured, value int64) error {
135140
if err := unstructured.SetNestedField(obj.UnstructuredContent(), value, i.paths[0]...); err != nil {
136141
return errors.Wrapf(err, "failed to set path %s of object %v", "."+strings.Join(i.paths[0], "."), obj.GroupVersionKind())

internal/controllers/cluster/cluster_controller_phases.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctr
151151
// If the infrastructure ref is not set, no-op.
152152
if s.cluster.Spec.InfrastructureRef == nil {
153153
// if the cluster is not deleted, and the cluster is not using a ClusterClass, mark the infrastructure as ready to unblock other provisioning workflows.
154-
// NOTE: if the cluster is not deleted and it is using a ClusterClass, the infrastructure will be set as soon as the topology is reconciled; in this
155-
// case we should wait for the field to be se (and not unblock other provisioning workflows).
156-
if s.cluster.DeletionTimestamp.IsZero() && cluster.Spec.Topology == nil {
154+
if s.cluster.DeletionTimestamp.IsZero() {
157155
cluster.Status.InfrastructureReady = true
158156
conditions.MarkTrue(cluster, clusterv1.InfrastructureReadyCondition)
159157
}

0 commit comments

Comments
 (0)