+/*
+Copyright 2019 Intel Corporation.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
package utils
import (
"crypto/sha256"
"fmt"
"os"
+ "sort"
"sync"
"github.com/go-logr/logr"
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
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"
}
- collectdConf += "#Last line (collectd requires ā\\nā at the last line)\n"
+ collectdConf += "#Last line (collectd requires '\\n' at the last line)\n"
return collectdConf, nil
}