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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]