Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v1beta1/solrcloud_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Q] Are there any edge-cases where there won't be an observedGeneration, say, immediately after creating a SolrCloud but before the operator has created any of the resources backing it?

Assuming that case exists, I guess the 'observedGeneration' would just be '0' in that case, and that's probably fine unless it'd be better to make the field an optional *int64?

}

// SolrNodeStatus is the status of a solrNode in the cloud, with readiness status
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/solr.apache.org_solrclouds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -16017,6 +16022,7 @@ spec:
type: object
required:
- internalCommonAddress
- observedGeneration
- podSelector
- readyReplicas
- replicas
Expand Down
3 changes: 3 additions & 0 deletions controllers/solrcloud_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions helm/solr-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -16278,6 +16283,7 @@ spec:
type: object
required:
- internalCommonAddress
- observedGeneration
- podSelector
- readyReplicas
- replicas
Expand Down