aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2019-09-09 15:56:54 -0700
committerDileep Ranganathan <dileep.ranganathan@intel.com>2019-09-09 20:21:34 -0700
commit3d29ee771bf6f0f2c2117cc2908561e228c8123f (patch)
treef297172e12f0617d1de558da92ba43a2d9f2d473 /vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go
parent9df8a9088ee55e32c2fb1f337b77c7bb9a3ced9f (diff)
Bug Fix - Daemonset not reloading
Fixed issue related to Daemonset reloading due to a bug introduced in the previous patch. Removed redundant watches across multiple controllers. Used defer statement instead of calling mutex unlock. Issue-ID: ONAPARC-461 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com> Change-Id: I7ef6d4e640d6190da34cc70d5a7cf80a96c004bd
Diffstat (limited to 'vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go')
-rw-r--r--vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go
index 6a85103c..17cad0e5 100644
--- a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go
+++ b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/collectdutils.go
@@ -5,6 +5,7 @@ import (
"crypto/sha256"
"fmt"
"os"
+ "sort"
"sync"
"github.com/go-logr/logr"
@@ -30,6 +31,9 @@ const (
var lock sync.Mutex
+// ReconcileLock - Used to sync between global and plugin controller
+var ReconcileLock sync.Mutex
+
// ResourceMap to hold objects to update/reload
type ResourceMap struct {
ConfigMap *corev1.ConfigMap
@@ -195,7 +199,14 @@ func RebuildCollectdConf(rc client.Client, ns string, isDelete bool, delPlugin s
collectdConf += collectdGlobalConf
}
- for cpName, cpConf := range loadPlugin {
+ pluginKeys := make([]string, 0, len(loadPlugin))
+ for k := range loadPlugin {
+ pluginKeys = append(pluginKeys, k)
+ }
+ sort.Strings(pluginKeys)
+
+ for _, cpName := range pluginKeys {
+ cpConf := loadPlugin[cpName]
collectdConf += "LoadPlugin" + " " + cpName + "\n"
collectdConf += cpConf + "\n"
}