Skip to content

Commit 82d4514

Browse files
committed
Pass network annotation to PrometheusNAD
1 parent f020839 commit 82d4514

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

controllers/metricstorage_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ func (r *MetricStorageReconciler) reconcileNormal(
571571
Log.Info("Can't watch Prometheus resource. The Cluster Observability Operator probably isn't installed")
572572
return ctrl.Result{RequeueAfter: telemetryv1.PauseBetweenWatchAttempts}, nil
573573
}
574-
prometheusNADPatch := metricstorage.PrometheusNAD(instance)
574+
prometheusNADPatch := metricstorage.PrometheusNAD(instance, networkAnnotations)
575575
err = r.Client.Patch(context.Background(), &prometheusNADPatch, client.Apply, client.FieldOwner("telemetry-operator"))
576576
if err != nil {
577577
Log.Error(err, "Can't patch Prometheus resource")
@@ -595,7 +595,7 @@ func (r *MetricStorageReconciler) reconcileNormal(
595595
Log.Error(err, "Can't delete old Prometheus CR to remove NAD configuration")
596596
return ctrl.Result{}, err
597597
}
598-
instance.Status.NetworkAttachments = nil
598+
instance.Status.NetworkAttachments = map[string]string{}
599599
}
600600

601601
// when job passed, mark NetworkAttachmentsReadyCondition ready

pkg/metricstorage/prometheus_nad_patch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
// PrometheusNAD defines patch for prometheus CR to add NAD annotations
2626
func PrometheusNAD(
2727
instance *telemetryv1.MetricStorage,
28+
networkAnnotations map[string]string,
2829
) monv1.Prometheus {
2930
prom := monv1.Prometheus{
3031
TypeMeta: metav1.TypeMeta{
@@ -38,7 +39,7 @@ func PrometheusNAD(
3839
Spec: monv1.PrometheusSpec{
3940
CommonPrometheusFields: monv1.CommonPrometheusFields{
4041
PodMetadata: &monv1.EmbeddedObjectMetadata{
41-
Annotations: instance.Annotations,
42+
Annotations: networkAnnotations,
4243
},
4344
},
4445
},

0 commit comments

Comments
 (0)