Add Kubernetes NodeName information to SolrNode status (#89)
diff --git a/api/v1beta1/solrcloud_types.go b/api/v1beta1/solrcloud_types.go
index 4698e52..198bd36 100644
--- a/api/v1beta1/solrcloud_types.go
+++ b/api/v1beta1/solrcloud_types.go
@@ -552,7 +552,10 @@
// 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"`
diff --git a/config/crd/bases/solr.bloomberg.com_solrclouds.yaml b/config/crd/bases/solr.bloomberg.com_solrclouds.yaml
index 9fbed77..dc5cb6f 100644
--- a/config/crd/bases/solr.bloomberg.com_solrclouds.yaml
+++ b/config/crd/bases/solr.bloomberg.com_solrclouds.yaml
@@ -7078,6 +7078,10 @@
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
@@ -7087,6 +7091,7 @@
required:
- internalAddress
- name
+ - nodeName
- ready
- version
type: object
diff --git a/controllers/solrcloud_controller.go b/controllers/solrcloud_controller.go
index cfad9b9..7d89691 100644
--- a/controllers/solrcloud_controller.go
+++ b/controllers/solrcloud_controller.go
@@ -321,10 +321,11 @@
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 {
@@ -341,7 +342,7 @@
}
nodeStatus.Ready = ready
- nodeStatusMap[nodeStatus.NodeName] = nodeStatus
+ nodeStatusMap[nodeStatus.Name] = nodeStatus
// Get Volumes for backup/restore
if solrCloud.Spec.BackupRestoreVolume != nil {
diff --git a/helm/solr-operator/crds/crds.yaml b/helm/solr-operator/crds/crds.yaml
index caf4a3b..0db94e7 100644
--- a/helm/solr-operator/crds/crds.yaml
+++ b/helm/solr-operator/crds/crds.yaml
@@ -8556,6 +8556,10 @@
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
@@ -8565,6 +8569,7 @@
required:
- internalAddress
- name
+ - nodeName
- ready
- version
type: object