diff --git a/controllers/cosmosfullnode_controller.go b/controllers/cosmosfullnode_controller.go index ffe022b1..4c85e526 100644 --- a/controllers/cosmosfullnode_controller.go +++ b/controllers/cosmosfullnode_controller.go @@ -226,24 +226,7 @@ func (r *CosmosFullNodeReconciler) updateStatus(ctx context.Context, crd *cosmos status.Phase = crd.Status.Phase status.StatusMessage = crd.Status.StatusMessage status.Peers = crd.Status.Peers - if len(status.SyncInfo.Pods) != len(consensus.Pods) { - status.SyncInfo = &consensus - } else { - for i := range consensus.Pods { - if consensus.Pods[i].Height != nil { - status.SyncInfo.Pods[i].Height = consensus.Pods[i].Height - } - if consensus.Pods[i].InSync != nil { - status.SyncInfo.Pods[i].InSync = consensus.Pods[i].InSync - } - if consensus.Pods[i].Error != nil { - status.SyncInfo.Pods[i].Error = consensus.Pods[i].Error - } - if !consensus.Pods[i].Timestamp.IsZero() { - status.SyncInfo.Pods[i].Timestamp = consensus.Pods[i].Timestamp - } - } - } + status.SyncInfo = &consensus }); err != nil { log.FromContext(ctx).Error(err, "Failed to patch status") } diff --git a/internal/fullnode/build_pods.go b/internal/fullnode/build_pods.go index 21f63f83..0c113893 100644 --- a/internal/fullnode/build_pods.go +++ b/internal/fullnode/build_pods.go @@ -7,7 +7,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" ) -const configChecksumAnnotation = "cosmos.strange.love/config-checksum" +const ( + configChecksumAnnotation = "cosmos.strange.love/config-checksum" + desiredImageAnnotation = "cosmos.strange.love/desired-image" +) // BuildPods creates the final state of pods given the crd. func BuildPods(crd *cosmosv1.CosmosFullNode, cksums ConfigChecksums) ([]diff.Resource[*corev1.Pod], error) { @@ -58,6 +61,7 @@ func BuildPods(crd *cosmosv1.CosmosFullNode, cksums ConfigChecksums) ([]diff.Res setMainContainerImage(pod, o.Image) } } + pod.Annotations[desiredImageAnnotation] = pod.Spec.Containers[0].Image pod.Annotations[configChecksumAnnotation] = cksums[client.ObjectKeyFromObject(pod)] pods = append(pods, diff.Adapt(pod, i)) }