HoustonPutman commented on a change in pull request #254:
URL: https://github.com/apache/solr-operator/pull/254#discussion_r610764603
##########
File path: api/v1beta1/solrcloud_types.go
##########
@@ -654,6 +655,9 @@ type SolrCloudStatus struct {
// Replicas is the number of number of desired replicas in the cluster
Replicas int32 `json:"replicas"`
+ // Selector is required by the HPA
+ Selector string `json:"selector"`
Review comment:
Can we change this to podSelector? Make it a bit more clear?
##########
File path: api/v1beta1/solrcloud_types.go
##########
@@ -718,13 +722,14 @@ type SolrNodeStatus struct {
// +kubebuilder:resource:shortName=solr
// +kubebuilder:categories=all
// +kubebuilder:subresource:status
-//
+kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.readyReplicas
+//
+kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.readyReplicas,selectorpath=.status.selector
//
+kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="Solr
Version of the cloud"
//
+kubebuilder:printcolumn:name="TargetVersion",type="string",JSONPath=".status.targetVersion",description="Target
Solr Version of the cloud"
//
+kubebuilder:printcolumn:name="DesiredNodes",type="integer",JSONPath=".spec.replicas",description="Number
of solr nodes configured to run in the cloud"
//
+kubebuilder:printcolumn:name="Nodes",type="integer",JSONPath=".status.replicas",description="Number
of solr nodes running"
//
+kubebuilder:printcolumn:name="ReadyNodes",type="integer",JSONPath=".status.readyReplicas",description="Number
of solr nodes connected to the cloud"
//
+kubebuilder:printcolumn:name="UpToDateNodes",type="integer",JSONPath=".status.upToDateNodes",description="Number
of solr nodes running the latest SolrCloud pod spec"
+//
+kubebuilder:printcolumn:name="Selector",type="string",JSONPath=".status.selector",description="Solr
pods selector used by HPA"
Review comment:
We don't want this as a column, it's gonna be really long and make
`kubectl get solr` very hard to read.
##########
File path: controllers/solrcloud_controller.go
##########
@@ -575,6 +576,7 @@ func reconcileCloudStatus(r *SolrCloudReconciler, solrCloud
*solr.SolrCloud, new
updateRevision := statefulSetStatus.UpdateRevision
newStatus.Replicas = statefulSetStatus.Replicas
+ newStatus.Selector = "solr-cloud=" + selectorLabels["solr-cloud"]
Review comment:
This probably works, but we should put the entire list of selector
labels here. No reason not to, it's the safest option.
We can use the selector that the CommonService uses, (in case we move to
multiple statefulSets in the future).
```go
selector, err := metav1.LabelSelectorAsSelector(commonService.Spec.Selector)
if err != nil {
log.Error(err, "<Good error message>")
return reconcile.Result{}, err
}
newStatus.Selector = selector.String()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]