diff options
author | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2019-08-10 15:15:49 -0700 |
---|---|---|
committer | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2019-08-12 10:51:22 -0700 |
commit | ebc40b61c64d5f06b5fe2b4d886ed4e5748db6d3 (patch) | |
tree | 57aa45894e58677d17096c7416f44b4c24c25775 /vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdglobal | |
parent | d59e778f2b97c96fe7f6c3945f4bb9c91ff01e74 (diff) |
Collectd Operator - Added TypesDB feature support
Added support for typesDB. CollectGlobal CR can now add, update, delete
TypesDB and custom TypesDB to the conf. This is achieved via creating a
configmap for the types.db files and then passing the configmap name in
the CR Spec.
Issue-ID: ONAPARC-461
Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
Change-Id: Idb27d7981c72f67863f193bd5013f6907362ede9
Diffstat (limited to 'vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdglobal')
-rw-r--r-- | vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdglobal/collectdglobal_controller.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdglobal/collectdglobal_controller.go b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdglobal/collectdglobal_controller.go index c48c2f5e..539b680d 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdglobal/collectdglobal_controller.go +++ b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdglobal/collectdglobal_controller.go @@ -12,6 +12,7 @@ import ( onapv1alpha1 "collectd-operator/pkg/apis/onap/v1alpha1" collectdutils "collectd-operator/pkg/controller/utils" + dsutils "collectd-operator/pkg/controller/utils" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" @@ -213,7 +214,7 @@ func (r *ReconcileCollectdGlobal) handleCollectdGlobal(reqLogger logr.Logger, cr ds.Spec.Template.SetAnnotations(map[string]string{ "daaas-random": collectdutils.ComputeSHA256([]byte(collectdConf)), }) - r.handleAdditonalConfigMap(reqLogger, cr, ds) + r.handleTypesDB(reqLogger, cr, ds, isDelete) updateErr := r.client.Update(context.TODO(), ds) return updateErr }) @@ -311,7 +312,12 @@ func (r *ReconcileCollectdGlobal) addFinalizer(reqLogger logr.Logger, cr *onapv1 return nil } -func (r *ReconcileCollectdGlobal) handleAdditonalConfigMap(reqLogger logr.Logger, cr *onapv1alpha1.CollectdGlobal, ds *extensionsv1beta1.DaemonSet) error { +func (r *ReconcileCollectdGlobal) handleTypesDB(reqLogger logr.Logger, cr *onapv1alpha1.CollectdGlobal, ds *extensionsv1beta1.DaemonSet, isDelete bool) error { + if isDelete || cr.Spec.ConfigMap == "" { + dsutils.RemoveTypesDB(ds) + return nil + } + cm := &corev1.ConfigMap{} key := types.NamespacedName{Namespace: cr.Namespace, Name: cr.Spec.ConfigMap} err := r.client.Get(context.TODO(), key, cm) @@ -319,6 +325,6 @@ func (r *ReconcileCollectdGlobal) handleAdditonalConfigMap(reqLogger logr.Logger reqLogger.Info("Error getting TypesDB") return nil } - // TODO: Implement Types.DB mounting + dsutils.UpsertTypesDB(ds, cm, cr) return nil } |