diff --git a/api/v1/cosmosfullnode_types.go b/api/v1/cosmosfullnode_types.go index 0e1bae31..679ec5ab 100644 --- a/api/v1/cosmosfullnode_types.go +++ b/api/v1/cosmosfullnode_types.go @@ -36,7 +36,7 @@ const CosmosFullNodeController = "CosmosFullNode" type Ordinal struct { // Start specifies the initial ordinal number for pod naming // +kubebuilder:validation:Minimum:=0 - Start *int32 `json:"start,omitempty"` + Start int32 `json:"start,omitempty"` } // FullNodeSpec defines the desired state of CosmosFullNode diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index c83f6129..4dba169e 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -288,7 +288,7 @@ func (in *FullNodeSnapshotStatus) DeepCopy() *FullNodeSnapshotStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FullNodeSpec) DeepCopyInto(out *FullNodeSpec) { *out = *in - in.Ordinal.DeepCopyInto(&out.Ordinal) + out.Ordinal = in.Ordinal in.ChainSpec.DeepCopyInto(&out.ChainSpec) in.PodTemplate.DeepCopyInto(&out.PodTemplate) in.RolloutStrategy.DeepCopyInto(&out.RolloutStrategy) @@ -456,11 +456,6 @@ func (in *Metadata) DeepCopy() *Metadata { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Ordinal) DeepCopyInto(out *Ordinal) { *out = *in - if in.Start != nil { - in, out := &in.Start, &out.Start - *out = new(int32) - **out = **in - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Ordinal. diff --git a/controllers/cosmosfullnode_controller.go b/controllers/cosmosfullnode_controller.go index 02935680..e5a9929d 100644 --- a/controllers/cosmosfullnode_controller.go +++ b/controllers/cosmosfullnode_controller.go @@ -115,11 +115,6 @@ func (r *CosmosFullNodeReconciler) Reconcile(ctx context.Context, req ctrl.Reque return stopResult, client.IgnoreNotFound(err) } - startingOrdinal := int32(0) - if crd.Spec.Ordinal.Start != nil { - startingOrdinal = *crd.Spec.Ordinal.Start - } - reporter := kube.NewEventReporter(logger, r.recorder, crd) fullnode.ResetStatus(crd) @@ -179,7 +174,7 @@ func (r *CosmosFullNodeReconciler) Reconcile(ctx context.Context, req ctrl.Reque } // Reconcile pods. - podRequeue, err := r.podControl.Reconcile(ctx, reporter, crd, configCksums, syncInfo, startingOrdinal) + podRequeue, err := r.podControl.Reconcile(ctx, reporter, crd, configCksums, syncInfo, crd.Spec.Ordinal.Start) if err != nil { errs.Append(err) } diff --git a/internal/fullnode/pvc_builder.go b/internal/fullnode/pvc_builder.go index b895872a..1e98b7f9 100644 --- a/internal/fullnode/pvc_builder.go +++ b/internal/fullnode/pvc_builder.go @@ -39,7 +39,7 @@ func BuildPVCs( } var pvcs []diff.Resource[*corev1.PersistentVolumeClaim] - for i := int32(0); i < crd.Spec.Replicas; i++ { + for i := crd.Spec.Ordinal.Start; i < crd.Spec.Ordinal.Start+crd.Spec.Replicas; i++ { if pvcDisabled(crd, i) { continue }