From 6bd73fb6869369879e7580cf75e680778eadee26 Mon Sep 17 00:00:00 2001 From: RavinaChidambaram Date: Wed, 11 Sep 2024 11:46:36 +0530 Subject: [PATCH] Added ObservedGeneration to solrcloud status Signed-off-by: RavinaChidambaram --- api/v1beta1/solrcloud_types.go | 3 +++ config/crd/bases/solr.apache.org_solrclouds.yaml | 6 ++++++ controllers/solrcloud_controller.go | 3 +++ helm/solr-operator/crds/crds.yaml | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/api/v1beta1/solrcloud_types.go b/api/v1beta1/solrcloud_types.go index 995a9acd..0f840e95 100644 --- a/api/v1beta1/solrcloud_types.go +++ b/api/v1beta1/solrcloud_types.go @@ -1160,6 +1160,9 @@ type SolrCloudStatus struct { // BackupRepositoriesAvailable lists the backupRepositories specified in the SolrCloud and whether they are available across all Pods. // +optional BackupRepositoriesAvailable map[string]bool `json:"backupRepositoriesAvailable,omitempty"` + + // ObservedGeneration represents the most recent generation observed for this SolrCloud. + ObservedGeneration int64 `json:"observedGeneration"` } // SolrNodeStatus is the status of a solrNode in the cloud, with readiness status diff --git a/config/crd/bases/solr.apache.org_solrclouds.yaml b/config/crd/bases/solr.apache.org_solrclouds.yaml index 31733228..4b02199e 100644 --- a/config/crd/bases/solr.apache.org_solrclouds.yaml +++ b/config/crd/bases/solr.apache.org_solrclouds.yaml @@ -15873,6 +15873,11 @@ spec: description: InternalCommonAddress is the internal common http address for all solr nodes type: string + observedGeneration: + description: ObservedGeneration represents the most recent generation + observed for this SolrCloud. + format: int64 + type: integer podSelector: description: PodSelector for SolrCloud pods, required by the HPA type: string @@ -16017,6 +16022,7 @@ spec: type: object required: - internalCommonAddress + - observedGeneration - podSelector - readyReplicas - replicas diff --git a/controllers/solrcloud_controller.go b/controllers/solrcloud_controller.go index 9940ff9e..c5df492b 100644 --- a/controllers/solrcloud_controller.go +++ b/controllers/solrcloud_controller.go @@ -101,6 +101,8 @@ func (r *SolrCloudReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( return reconcile.Result{}, err } + reconcileGeneration := instance.ObjectMeta.Generation + changed := instance.WithDefaults(logger) if changed { logger.Info("Setting default settings for SolrCloud") @@ -639,6 +641,7 @@ func (r *SolrCloudReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( } if !reflect.DeepEqual(instance.Status, newStatus) { + newStatus.ObservedGeneration = reconcileGeneration logger.Info("Updating SolrCloud Status", "status", newStatus) oldInstance := instance.DeepCopy() instance.Status = newStatus diff --git a/helm/solr-operator/crds/crds.yaml b/helm/solr-operator/crds/crds.yaml index 14f285ca..a7fe7404 100644 --- a/helm/solr-operator/crds/crds.yaml +++ b/helm/solr-operator/crds/crds.yaml @@ -16134,6 +16134,11 @@ spec: description: InternalCommonAddress is the internal common http address for all solr nodes type: string + observedGeneration: + description: ObservedGeneration represents the most recent generation + observed for this SolrCloud. + format: int64 + type: integer podSelector: description: PodSelector for SolrCloud pods, required by the HPA type: string @@ -16278,6 +16283,7 @@ spec: type: object required: - internalCommonAddress + - observedGeneration - podSelector - readyReplicas - replicas