solr-operator
solr-operator copied to clipboard
Adding Kubernetes Node labels to Solr nodes. (WIP)
Issue number of the reported bug or feature request: Resolves #53
Describe your changes This PR adds Kubernetes Node labels as sysProps for Solr Nodes, thus allowing for them to be used within Solr autoscaling policies.
Kubernetes Node labels are added in the following steps:
- In an
initContainer
, the Kubernetes API is queried to get the information for the node the pod resides on. -
jq
is used to parse this information and generate a sh script to update$SOLR_OPTS
to contain-d<kube-node-label>=<value>
. - This bash file is shared via a volume between the initContainer and the solr container.
- Solr is provided this sh script via the
$SOLR_INCLUDES
envVar. This is an option that Solr reads when it starts up. - When Solr starts, the SOLR_OPTS will contain the
-D
options that specify all of the Kubernetes node labels.
Testing performed Tested locally.
This is a WIP and the feature has not been finalized yet.
Any update?
No update other than it worked in my tests. We probably want to add this as an optional feature, at least at first. I can probably do some work on it next week or the next one.
I wanted to get some feedback before moving forward with it
I'm going to try and get #95 merged in, then cut the v0.2.4
release. After that I'll try to get this merged, as it's quite a large change to how Solr is "run".