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/19 20:00:23 UTC

[GitHub] [lucene-solr-operator] thelabdude opened a new pull request #189: Override Prometheus exporter config XML via a user-supplied ConfigMap

thelabdude opened a new pull request #189:
URL: https://github.com/apache/lucene-solr-operator/pull/189


   Allow users to override the Prometheus exporter config (XML) via a user-provided ConfigMap supplied via the existing `prometheusExporter.Spec.CustomKubeOptions.ConfigMapOptions.ProvidedConfigMap` setting.
   
   Keep the md5 hash of the custom config XML in an annotation on the pod spec of the deployment so that a rolling restart is triggered when the configuration changes.


----------------------------------------------------------------
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


[GitHub] [lucene-solr-operator] HoustonPutman commented on a change in pull request #189: Override Prometheus exporter config XML via a user-supplied ConfigMap

Posted by GitBox <gi...@apache.org>.
HoustonPutman commented on a change in pull request #189:
URL: https://github.com/apache/lucene-solr-operator/pull/189#discussion_r560492756



##########
File path: controllers/solrprometheusexporter_controller.go
##########
@@ -92,10 +124,18 @@ func (r *SolrPrometheusExporterReconciler) Reconcile(req ctrl.Request) (ctrl.Res
 		if err != nil && errors.IsNotFound(err) {
 			configMapLogger.Info("Creating ConfigMap")
 			err = r.Create(context.TODO(), configMap)
+
+			// capture the MD5 for the config XML
+			configXml, _ := configMap.Data[configMapKey]
+			configXmlMd5 = fmt.Sprintf("%x", md5.Sum([]byte(configXml)))

Review comment:
       You need to move this before `if/else`, otherwise the xml annotation will be removed when the reconcile is called, but the configMap is not updated or created.
   
   See: https://github.com/apache/lucene-solr-operator/pull/188/files#diff-27cb619f80d28ac158f7885b7925d8582babfa7fe1f824599d65a745302d237cR222

##########
File path: controllers/solrprometheusexporter_controller_test.go
##########
@@ -200,6 +200,7 @@ func TestMetricsReconcileWithExporterConfig(t *testing.T) {
 	testMapsEqual(t, "deployment labels", util.MergeLabelsOrAnnotations(expectedDeploymentLabels, testDeploymentLabels), deployment.Labels)
 	testMapsEqual(t, "deployment annotations", testDeploymentAnnotations, deployment.Annotations)
 	testMapsEqual(t, "pod labels", util.MergeLabelsOrAnnotations(expectedDeploymentLabels, testPodLabels), deployment.Spec.Template.ObjectMeta.Labels)
+	testPodAnnotations["solr.apache.org/exporterConfigXmlMd5"] = "2c354e0aeb176a6b5560f46fe35c9ca7"

Review comment:
       Could you possibly do this dynamically, like: https://github.com/apache/lucene-solr-operator/pull/188/files#diff-c7a739f50a172286ab35c4729f5e1795249b1be34bd386695c9facb05d437fb4R274
   
   I moved the `expectConfigMap` to be above the statefulSet check, so that I could use the data that was already fetched to make the Md5.




----------------------------------------------------------------
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


[GitHub] [lucene-solr-operator] thelabdude commented on pull request #189: Override Prometheus exporter config XML via a user-supplied ConfigMap

Posted by GitBox <gi...@apache.org>.
thelabdude commented on pull request #189:
URL: https://github.com/apache/lucene-solr-operator/pull/189#issuecomment-763202577


   Still need an explicit unit test for the user-provided config before this one is ready to merge.


----------------------------------------------------------------
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


[GitHub] [lucene-solr-operator] thelabdude commented on a change in pull request #189: Override Prometheus exporter config XML via a user-supplied ConfigMap

Posted by GitBox <gi...@apache.org>.
thelabdude commented on a change in pull request #189:
URL: https://github.com/apache/lucene-solr-operator/pull/189#discussion_r560505507



##########
File path: controllers/solrprometheusexporter_controller.go
##########
@@ -92,10 +124,18 @@ func (r *SolrPrometheusExporterReconciler) Reconcile(req ctrl.Request) (ctrl.Res
 		if err != nil && errors.IsNotFound(err) {
 			configMapLogger.Info("Creating ConfigMap")
 			err = r.Create(context.TODO(), configMap)
+
+			// capture the MD5 for the config XML
+			configXml, _ := configMap.Data[configMapKey]
+			configXmlMd5 = fmt.Sprintf("%x", md5.Sum([]byte(configXml)))

Review comment:
       ah yes ... great catch, and thanks for fixing for solr.xml




----------------------------------------------------------------
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


[GitHub] [lucene-solr-operator] thelabdude merged pull request #189: Override Prometheus exporter config XML via a user-supplied ConfigMap

Posted by GitBox <gi...@apache.org>.
thelabdude merged pull request #189:
URL: https://github.com/apache/lucene-solr-operator/pull/189


   


----------------------------------------------------------------
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


[GitHub] [lucene-solr-operator] thelabdude merged pull request #189: Override Prometheus exporter config XML via a user-supplied ConfigMap

Posted by GitBox <gi...@apache.org>.
thelabdude merged pull request #189:
URL: https://github.com/apache/lucene-solr-operator/pull/189


   


----------------------------------------------------------------
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