diff options
-rw-r--r-- | vnfs/DAaaS/microservices/collectd-operator/Makefile | 12 | ||||
-rw-r--r-- | vnfs/DAaaS/microservices/collectd-operator/deploy/crds/cpu_collectdplugin_cr.yaml (renamed from vnfs/DAaaS/microservices/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_cr.yaml) | 6 | ||||
-rw-r--r-- | vnfs/DAaaS/microservices/collectd-operator/deploy/crds/memory_collectdplugin_cr.yaml | 14 | ||||
-rw-r--r-- | vnfs/DAaaS/microservices/collectd-operator/deploy/operator.yaml | 2 | ||||
-rw-r--r-- | vnfs/DAaaS/microservices/collectd-operator/deploy/role_binding.yaml | 1 | ||||
-rw-r--r-- | vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdplugin/collectdplugin_controller.go | 8 |
6 files changed, 31 insertions, 12 deletions
diff --git a/vnfs/DAaaS/microservices/collectd-operator/Makefile b/vnfs/DAaaS/microservices/collectd-operator/Makefile index 0b07b4b7..e3269b46 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/Makefile +++ b/vnfs/DAaaS/microservices/collectd-operator/Makefile @@ -13,16 +13,16 @@ BUILD := $(shell git rev-parse --short HEAD) PROJECTNAME := $(shell basename "$(PWD)") GOPATH := $(shell realpath "$(PWD)/../../../../../../") -COP = ${PWD}/build/_output/bin/collectd-operator -IMAGE_NAME = dcr.cluster.local/collectd-operator:latest +COP := ${PWD}/build/_output/bin/collectd-operator +IMAGE_NAME := collectd-operator:latest export GOPATH ... export GO111MODULE=on .PHONY: clean plugins -## all: Generate the k8s and openapi artifacts using operator-sdk -all: clean vendor +## build: Generate the k8s and openapi artifacts using operator-sdk +build: clean vendor GOOS=linux GOARCH=amd64 operator-sdk generate k8s --verbose operator-sdk generate openapi --verbose @@ -33,8 +33,8 @@ all: clean vendor # no need to create a static binary with additional flags. However, for generating binary, additional build flags are necessary. This if used with # mock plugin errors out for unit tests. So the seperation avoids the error. -## build: clean the -build: clean test cover +## all: Delete the image, binary, complete build, test and run coverage +all: build test cover deploy: build publish vendor: @go mod vendor diff --git a/vnfs/DAaaS/microservices/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_cr.yaml b/vnfs/DAaaS/microservices/collectd-operator/deploy/crds/cpu_collectdplugin_cr.yaml index a4684293..fb168c7a 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/deploy/crds/onap_v1alpha1_collectdplugin_cr.yaml +++ b/vnfs/DAaaS/microservices/collectd-operator/deploy/crds/cpu_collectdplugin_cr.yaml @@ -1,10 +1,14 @@ apiVersion: onap.org/v1alpha1 kind: CollectdPlugin metadata: - name: example-collectdplugin + name: cpu spec: # Add fields here pluginName: "cpu" pluginConf: | <Plugin "cpu"> + Interval 5 + ReportByState false + ReportByCpu false </Plugin> +
\ No newline at end of file diff --git a/vnfs/DAaaS/microservices/collectd-operator/deploy/crds/memory_collectdplugin_cr.yaml b/vnfs/DAaaS/microservices/collectd-operator/deploy/crds/memory_collectdplugin_cr.yaml new file mode 100644 index 00000000..ee051ed3 --- /dev/null +++ b/vnfs/DAaaS/microservices/collectd-operator/deploy/crds/memory_collectdplugin_cr.yaml @@ -0,0 +1,14 @@ +apiVersion: onap.org/v1alpha1 +kind: CollectdPlugin +metadata: + name: memory +spec: + # Add fields here + pluginName: "memory" + pluginConf: | + <Plugin "memory"> + Interval 30 + ValuesAbsolute false + ValuesPercentage true + </Plugin> +
\ No newline at end of file diff --git a/vnfs/DAaaS/microservices/collectd-operator/deploy/operator.yaml b/vnfs/DAaaS/microservices/collectd-operator/deploy/operator.yaml index 108719ab..b39543ec 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/deploy/operator.yaml +++ b/vnfs/DAaaS/microservices/collectd-operator/deploy/operator.yaml @@ -16,7 +16,7 @@ spec: containers: - name: collectd-operator # Replace this with the built image name - image: dcr.cluster.local:31976/collectd-operator:latest + image: dcr.cluster.local:32644/collectd-operator:latest command: - collectd-operator imagePullPolicy: Always diff --git a/vnfs/DAaaS/microservices/collectd-operator/deploy/role_binding.yaml b/vnfs/DAaaS/microservices/collectd-operator/deploy/role_binding.yaml index 5f425081..09da2923 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/deploy/role_binding.yaml +++ b/vnfs/DAaaS/microservices/collectd-operator/deploy/role_binding.yaml @@ -5,6 +5,7 @@ metadata: subjects: - kind: ServiceAccount name: collectd-operator + namespace: cop roleRef: kind: ClusterRole name: collectd-operator diff --git a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdplugin/collectdplugin_controller.go b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdplugin/collectdplugin_controller.go index fd35c6f1..5298258b 100644 --- a/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdplugin/collectdplugin_controller.go +++ b/vnfs/DAaaS/microservices/collectd-operator/pkg/controller/collectdplugin/collectdplugin_controller.go @@ -136,14 +136,14 @@ func (r *ReconcileCollectdPlugin) Reconcile(request reconcile.Request) (reconcil if err := controllerutil.SetControllerReference(instance, cm, r.scheme); err != nil { return reconcile.Result{}, err } - // Set CollectdConf instance as the owner and controller + // Set CollectdPlugin instance as the owner and controller if err := controllerutil.SetControllerReference(instance, ds, r.scheme); err != nil { return reconcile.Result{}, err } // Update the ConfigMap with new Spec and reload DaemonSets reqLogger.Info("Updating the ConfigMap", "ConfigMap.Namespace", cm.Namespace, "ConfigMap.Name", cm.Name) - log.Info("Map: ", cm.Data) + log.Info("ConfigMap Data", "Map: ", cm.Data) err = r.client.Update(context.TODO(), cm) if err != nil { return reconcile.Result{}, err @@ -180,14 +180,14 @@ func findResourceMapForCR(r *ReconcileCollectdPlugin, cr *onapv1alpha1.CollectdP } // Select DaemonSets with label app=collectd - dsList := &extensionsv1beta1.DaemonSet{} + dsList := &extensionsv1beta1.DaemonSetList{} err = r.client.List(context.TODO(), opts, dsList) if err != nil { return rmap, err } rmap.configMap = &cmList.Items[0] - rmap.daemonSet = dsList + rmap.daemonSet = &dsList.Items[0] return rmap, err } |