Skip to content

Commit

Permalink
Add Kubernetes NodeName information to SolrNode status (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoustonPutman authored Mar 2, 2020
1 parent 8968879 commit d87725b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion api/v1beta1/solrcloud_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,10 @@ type SolrCloudStatus struct {
// and internal and external addresses
type SolrNodeStatus struct {
// The name of the pod running the node
NodeName string `json:"name"`
Name string `json:"name"`

// The name of the Kubernetes Node which the pod is running on
NodeName string `json:"nodeName"`

// An address the node can be connected to from within the Kube cluster
InternalAddress string `json:"internalAddress"`
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/solr.bloomberg.com_solrclouds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7078,6 +7078,10 @@ spec:
name:
description: The name of the pod running the node
type: string
nodeName:
description: The name of the Kubernetes Node which the pod is
running on
type: string
ready:
description: Is the node up and running
type: boolean
Expand All @@ -7087,6 +7091,7 @@ spec:
required:
- internalAddress
- name
- nodeName
- ready
- version
type: object
Expand Down
7 changes: 4 additions & 3 deletions controllers/solrcloud_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,11 @@ func reconcileCloudStatus(r *SolrCloudReconciler, solrCloud *solr.SolrCloud, new
for idx, p := range foundPods.Items {
nodeNames[idx] = p.Name
nodeStatus := solr.SolrNodeStatus{}
nodeStatus.NodeName = p.Name
nodeStatus.Name = p.Name
nodeStatus.NodeName = p.Spec.NodeName
nodeStatus.InternalAddress = "http://" + solrCloud.InternalNodeUrl(nodeStatus.NodeName, IngressBaseUrl == "", true)
if IngressBaseUrl != "" {
nodeStatus.ExternalAddress = "http://" + solrCloud.NodeIngressUrl(nodeStatus.NodeName, IngressBaseUrl)
nodeStatus.ExternalAddress = "http://" + solrCloud.NodeIngressUrl(nodeStatus.Name, IngressBaseUrl)
}
ready := false
if len(p.Status.ContainerStatuses) > 0 {
Expand All @@ -341,7 +342,7 @@ func reconcileCloudStatus(r *SolrCloudReconciler, solrCloud *solr.SolrCloud, new
}
nodeStatus.Ready = ready

nodeStatusMap[nodeStatus.NodeName] = nodeStatus
nodeStatusMap[nodeStatus.Name] = nodeStatus

// Get Volumes for backup/restore
if solrCloud.Spec.BackupRestoreVolume != nil {
Expand Down
5 changes: 5 additions & 0 deletions helm/solr-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8556,6 +8556,10 @@ spec:
name:
description: The name of the pod running the node
type: string
nodeName:
description: The name of the Kubernetes Node which the pod is
running on
type: string
ready:
description: Is the node up and running
type: boolean
Expand All @@ -8565,6 +8569,7 @@ spec:
required:
- internalAddress
- name
- nodeName
- ready
- version
type: object
Expand Down

0 comments on commit d87725b

Please sign in to comment.