@@ -10,7 +10,7 @@ import (
1010
1111 "github.com/alecthomas/units"
1212 "github.com/ipfs/kubo/config"
13- "github.com/libp2p/go-libp2p- core/peer"
13+ "github.com/libp2p/go-libp2p/ core/peer"
1414 ma "github.com/multiformats/go-multiaddr"
1515 clusterv1alpha1 "github.com/redhat-et/ipfs-operator/api/v1alpha1"
1616 "github.com/redhat-et/ipfs-operator/controllers/scripts"
@@ -101,6 +101,17 @@ func (r *IpfsClusterReconciler) ConfigMapScripts(
101101 string (reproviderStrategy ),
102102 )
103103
104+ serviceConfig := GetDefaultServiceConfig ()
105+ if m .Spec .Stats {
106+ EnableMetrics (serviceConfig .Configs ())
107+ }
108+
109+ serviceConfigFile , err := serviceConfig .Manager ().ToJSON ()
110+ if err != nil {
111+ log .Error (err , "could not marshal service config file" )
112+ return utils .ErrFunc (fmt .Errorf ("error converting serviceConfig to JSON: %w" , err )), ""
113+ }
114+
104115 expected := & corev1.ConfigMap {
105116 ObjectMeta : metav1.ObjectMeta {
106117 Name : cmName ,
@@ -109,6 +120,7 @@ func (r *IpfsClusterReconciler) ConfigMapScripts(
109120 Data : map [string ]string {
110121 "entrypoint.sh" : scripts .IPFSClusterEntrypoint ,
111122 "configure-ipfs.sh" : configScript ,
123+ "service.json" : string (serviceConfigFile ),
112124 },
113125 }
114126 expected .DeepCopyInto (cm )
0 commit comments