You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/01/25 21:59:23 UTC

[GitHub] [lucene-solr-operator] thelabdude commented on a change in pull request #193: Support custom log4j2 config from user-provided ConfigMap

thelabdude commented on a change in pull request #193:
URL: https://github.com/apache/lucene-solr-operator/pull/193#discussion_r564072280



##########
File path: controllers/util/solr_util.go
##########
@@ -327,13 +330,42 @@ func GenerateStatefulSet(solrCloud *solr.SolrCloud, solrCloudStatus *solr.SolrCl
 		envVars = append(envVars, customPodOptions.EnvVariables...)
 	}
 
+	// Did the user provide a custom log config?
+	if configMapInfo[LogXmlFile] != "" {
+
+		if configMapInfo[LogXmlMd5Annotation] != "" {
+			if podAnnotations == nil {
+				podAnnotations = make(map[string]string, 1)
+			}
+			podAnnotations[LogXmlMd5Annotation] = configMapInfo[LogXmlMd5Annotation]
+		}
+
+		// cannot use /var/solr as a mountPath, so mount the custom log config in a sub-dir
+		volName := "log4j2-xml"
+		mountPath := fmt.Sprintf("/var/solr/%s-log-config", solrCloud.Name)
+		log4jPropsEnvVarPath := fmt.Sprintf("%s/%s", mountPath, LogXmlFile)
+
+		solrVolumes = append(solrVolumes, corev1.Volume{

Review comment:
       This is a good catch! K8s allows it and results in a structure like the following in the STS:
   ```
         volumes:
         - configMap:
             defaultMode: 420
             items:
             - key: solr.xml
               path: solr.xml
             name: dev-custom-solr-xml
           name: solr-xml
         - configMap:
             defaultMode: 420
             items:
             - key: log4j2.xml
               path: log4j2.xml
             name: dev-custom-solr-xml
           name: log4j2-xml
   ```
   But we certainly should use a single volume with multiple `items` as you suggest ;-) Will fix it up and add a test for both keys being provided.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org