Skip to content

Commit d87725b

Browse files
Add Kubernetes NodeName information to SolrNode status (#89)
1 parent 8968879 commit d87725b

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

api/v1beta1/solrcloud_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,10 @@ type SolrCloudStatus struct {
552552
// and internal and external addresses
553553
type SolrNodeStatus struct {
554554
// The name of the pod running the node
555-
NodeName string `json:"name"`
555+
Name string `json:"name"`
556+
557+
// The name of the Kubernetes Node which the pod is running on
558+
NodeName string `json:"nodeName"`
556559

557560
// An address the node can be connected to from within the Kube cluster
558561
InternalAddress string `json:"internalAddress"`

config/crd/bases/solr.bloomberg.com_solrclouds.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7078,6 +7078,10 @@ spec:
70787078
name:
70797079
description: The name of the pod running the node
70807080
type: string
7081+
nodeName:
7082+
description: The name of the Kubernetes Node which the pod is
7083+
running on
7084+
type: string
70817085
ready:
70827086
description: Is the node up and running
70837087
type: boolean
@@ -7087,6 +7091,7 @@ spec:
70877091
required:
70887092
- internalAddress
70897093
- name
7094+
- nodeName
70907095
- ready
70917096
- version
70927097
type: object

controllers/solrcloud_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,11 @@ func reconcileCloudStatus(r *SolrCloudReconciler, solrCloud *solr.SolrCloud, new
321321
for idx, p := range foundPods.Items {
322322
nodeNames[idx] = p.Name
323323
nodeStatus := solr.SolrNodeStatus{}
324-
nodeStatus.NodeName = p.Name
324+
nodeStatus.Name = p.Name
325+
nodeStatus.NodeName = p.Spec.NodeName
325326
nodeStatus.InternalAddress = "http://" + solrCloud.InternalNodeUrl(nodeStatus.NodeName, IngressBaseUrl == "", true)
326327
if IngressBaseUrl != "" {
327-
nodeStatus.ExternalAddress = "http://" + solrCloud.NodeIngressUrl(nodeStatus.NodeName, IngressBaseUrl)
328+
nodeStatus.ExternalAddress = "http://" + solrCloud.NodeIngressUrl(nodeStatus.Name, IngressBaseUrl)
328329
}
329330
ready := false
330331
if len(p.Status.ContainerStatuses) > 0 {
@@ -341,7 +342,7 @@ func reconcileCloudStatus(r *SolrCloudReconciler, solrCloud *solr.SolrCloud, new
341342
}
342343
nodeStatus.Ready = ready
343344

344-
nodeStatusMap[nodeStatus.NodeName] = nodeStatus
345+
nodeStatusMap[nodeStatus.Name] = nodeStatus
345346

346347
// Get Volumes for backup/restore
347348
if solrCloud.Spec.BackupRestoreVolume != nil {

helm/solr-operator/crds/crds.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8556,6 +8556,10 @@ spec:
85568556
name:
85578557
description: The name of the pod running the node
85588558
type: string
8559+
nodeName:
8560+
description: The name of the Kubernetes Node which the pod is
8561+
running on
8562+
type: string
85598563
ready:
85608564
description: Is the node up and running
85618565
type: boolean
@@ -8565,6 +8569,7 @@ spec:
85658569
required:
85668570
- internalAddress
85678571
- name
8572+
- nodeName
85688573
- ready
85698574
- version
85708575
type: object

0 commit comments

Comments
 (0)