import (
"path/filepath"
- "strings"
"strconv"
+ "strings"
onapv1alpha1 "collectd-operator/pkg/apis/onap/v1alpha1"
// 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--
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--
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:]...)
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}