summaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2019-09-05 21:46:59 -0700
committerMarco Platania <platania@research.att.com>2019-09-06 12:45:28 +0000
commitb2651f39b6dbe79e05d42f8a3bfbbc11c42c5d4c (patch)
treede00fc8fac262ffcfa8b3f8f50dba70a1cfd3264 /vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go
parentfb00a06a25dda69958891705c7c18ddddfea25f9 (diff)
Fix issue with concurrent CR creation
The collectd operator is going into deadlock when concurrent update operations happen within the same controller trying to update the resource. Fixed this by adding Mutex. Deleted the old build_image.sh which is replaced by new script which builds and pushes from inside a builder docker container. This helps in tackling the dependency issues for image build. Updated the README for build image script usage. Issue-ID: ONAPARC-461 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com> Change-Id: Ib3c2d1edd266e70bb713885de7ad046ebf5ad086
Diffstat (limited to 'vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go')
-rw-r--r--vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go
index d52a68ce..c5a44c44 100644
--- a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go
+++ b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/utils/dsutils.go
@@ -2,8 +2,8 @@ package utils
import (
"path/filepath"
- "strings"
"strconv"
+ "strings"
onapv1alpha1 "collectd-operator/pkg/apis/onap/v1alpha1"
@@ -26,7 +26,7 @@ const (
// RemoveTypesDB - removes TypesDB volumes and volume mounts from collectd pods.
func RemoveTypesDB(ds *appsv1.DaemonSet) {
vols := &ds.Spec.Template.Spec.Volumes
- for i:=0; i < len(*vols); i++ {
+ for i := 0; i < len(*vols); i++ {
if (*vols)[i].Name == typesDB {
*vols = append((*vols)[:i], (*vols)[i+1:]...)
i--
@@ -37,7 +37,7 @@ func RemoveTypesDB(ds *appsv1.DaemonSet) {
for j, container := range *containers {
if container.Name == collectdContainerName {
vms := &(*containers)[j].VolumeMounts
- for i:=0; i < len(*vms); i++ {
+ for i := 0; i < len(*vms); i++ {
if (*vms)[i].Name == typesDB {
*vms = append((*vms)[:i], (*vms)[i+1:]...)
i--
@@ -81,7 +81,7 @@ func UpsertTypesDB(ds *appsv1.DaemonSet, cm *corev1.ConfigMap, cr *onapv1alpha1.
for j, container := range *containers {
if container.Name == collectdContainerName {
vms := &(*containers)[j].VolumeMounts
- for i:=0; i < len(*vms); i++ {
+ for i := 0; i < len(*vms); i++ {
// Update case (Equivalent to remove and add)
if (*vms)[i].Name == typesDB {
*vms = append((*vms)[:i], (*vms)[i+1:]...)
@@ -104,7 +104,7 @@ func findMountInfo(cr *onapv1alpha1.CollectdGlobal) *[]corev1.VolumeMount {
s := strings.Fields(globalOpt)
log.V(1).Info(":::::s:::::", "s:", s)
if s != nil && len(s) != 0 && s[0] == "TypesDB" {
- path,_ := strconv.Unquote(s[1])
+ path, _ := strconv.Unquote(s[1])
_, file := filepath.Split(path)
log.V(1).Info(":::::file:::::", "s[1]:", path, "file:", file)
vm := corev1.VolumeMount{Name: typesDB, MountPath: path, SubPath: file}