Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use solr.xml from provided ConfigMap #158

Merged
merged 2 commits into from
Nov 20, 2020

Conversation

thelabdude
Copy link
Contributor

@thelabdude thelabdude commented Nov 17, 2020

Signed-off-by: Timothy Potter [email protected]

This fixes #86

Introduce a new var ProvidedConfigMap in the CustomSolrKubeOptions.ConfigMapOptions to allow users to supply the name of a ConfigMap containing a custom solr.xml. If supplied, we track the MD5 checksum of the solr.xml data in an annotation on the pod spec (solr.apache.org/solrXmlMd5) for the StatefulSet to trigger a rolling restart when the solr.xml in the ConfigMap changes. If supplied on the SolrCloud CRD, the controller requires the provided ConfigMap to contain a solr.xml that must have a placeholder for the operator to set the hostPort variable, e.g.

<int name="hostPort">${hostPort:80}</int>

Includes a unit test that verifies proper reconciliation using a provided ConfigMap and that an update to the solr.xml triggers a rolling restart of the StatefulSet (via the annotation changing).

I also tested this manually in Kubernetes by creating my own ConfigMap:

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: tjp-custom-solr-xml
data:
  solr.xml: |
    <?xml version="1.0" encoding="UTF-8" ?>
    <solr>
      <solrcloud>
        <str name="host">${host:}</str>
        <int name="hostPort">${hostPort:80}</int>
        <str name="hostContext">${hostContext:solr}</str>
        <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
        <int name="zkClientTimeout">${zkClientTimeout:35000}</int>
        <int name="distribUpdateSoTimeout">${distribUpdateSoTimeout:600000}</int>
        <int name="distribUpdateConnTimeout">${distribUpdateConnTimeout:60000}</int>
        <str name="zkCredentialsProvider">${zkCredentialsProvider:org.apache.solr.common.cloud.DefaultZkCredentialsProvider}</str>
        <str name="zkACLProvider">${zkACLProvider:org.apache.solr.common.cloud.DefaultZkACLProvider}</str>
      </solrcloud>
      <shardHandlerFactory name="shardHandlerFactory" class="HttpShardHandlerFactory">
        <int name="socketTimeout">${socketTimeout:600000}</int>
        <int name="connTimeout">${connTimeout:60000}</int>
      </shardHandlerFactory>
    </solr>

And then referencing it in the SolrCloud definition:

  customSolrKubeOptions:
    configMapOptions:
      providedConfigMap: tjp-custom-solr-xml

@thelabdude
Copy link
Contributor Author

thanks for fixing up that test issue @HoustonPutman !

@thelabdude thelabdude force-pushed the custom-solr-xml-configmap branch from 1df5a36 to c710f8f Compare November 18, 2020 17:03
@thelabdude thelabdude force-pushed the custom-solr-xml-configmap branch from c710f8f to 61123e7 Compare November 18, 2020 17:15
Copy link
Contributor

@HoustonPutman HoustonPutman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bsankara This is good to go. Pretty straightforward with convincing unit tests. 👍

Copy link
Contributor

@bsankara bsankara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@bsankara bsankara merged commit 2945225 into apache:master Nov 20, 2020
bsankara pushed a commit that referenced this pull request Nov 20, 2020
@HoustonPutman HoustonPutman deleted the custom-solr-xml-configmap branch November 20, 2020 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't overwrite the configmap used for solr.xml
3 participants