aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2019-08-26 13:17:55 -0700
committerMarco Platania <platania@research.att.com>2019-08-27 12:37:57 +0000
commit6ae0dc5fdec5b63bc1666a4dc41f931f1b270d3a (patch)
tree1ae0eedb1ab1547d93ed87efd7745babc7f85d74
parent37c3190380ac16eddd0534ac108b396a374a6ad9 (diff)
Collectd-Operator build script and Readme
Added build image script for offline build and CI. Added readme instructions on how to build, deploy and use collectd-operator. Issue-ID: ONAPARC-461 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com> Change-Id: Ifd1b9dc22bdf6005125931527c052727ee11a323
-rw-r--r--vnfs/DAaaS/README.md10
-rw-r--r--vnfs/DAaaS/microservices/collectd-operator/Makefile6
-rwxr-xr-xvnfs/DAaaS/microservices/collectd-operator/build/build_image.sh27
3 files changed, 41 insertions, 2 deletions
diff --git a/vnfs/DAaaS/README.md b/vnfs/DAaaS/README.md
index defa3660..932173c5 100644
--- a/vnfs/DAaaS/README.md
+++ b/vnfs/DAaaS/README.md
@@ -81,6 +81,16 @@ helm install -n rook . -f values.yaml --namespace=rook-ceph-system
```
## Install Operator package
+### Build docker images
+#### collectd-operator
+```bash
+cd $DA_WORKING_DIR/../microservices/collectd-operator
+
+## Note: The image tag and respository in the Collectd-operator helm charts needs to match the IMAGE_NAME
+IMAGE_NAME=dcr.cluster.local:32644/collectd-operator:latest
+./build/build_image.sh $IMAGE_NAME
+```
+### Install the Operator Package
```bash
cd $DA_WORKING_DIR/operator
helm install -n operator . -f values.yaml --namespace=operator
diff --git a/vnfs/DAaaS/microservices/collectd-operator/Makefile b/vnfs/DAaaS/microservices/collectd-operator/Makefile
index 52c779cf..af2ac667 100644
--- a/vnfs/DAaaS/microservices/collectd-operator/Makefile
+++ b/vnfs/DAaaS/microservices/collectd-operator/Makefile
@@ -15,7 +15,9 @@ PROJECTNAME := $(shell basename "$(PWD)")
ROOTPATH := $(shell realpath "$(PWD)/../")
COP := ${PWD}/build/_output/bin/collectd-operator
COP_LOCAL := ${COP}-local
-IMAGE_NAME := dcr.cluster.local:32644/collectd-operator:latest
+ifndef IMAGE_NAME
+override IMAGE_NAME := dcr.cluster.local:32644/collectd-operator:latest
+endif
export GO111MODULE=on
@@ -64,7 +66,7 @@ clean:
@rm -rf ${COP}
@rm -rf ${COP_LOCAL}
@echo "Deleting the collectd-operator docker image"
- @docker rmi ${IMAGE_NAME}
+ @docker 2>/dev/null rmi ${IMAGE_NAME} | true
.PHONY: cover
## cover: run tests and generate coverage report
diff --git a/vnfs/DAaaS/microservices/collectd-operator/build/build_image.sh b/vnfs/DAaaS/microservices/collectd-operator/build/build_image.sh
new file mode 100755
index 00000000..9cda67d1
--- /dev/null
+++ b/vnfs/DAaaS/microservices/collectd-operator/build/build_image.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+set -e
+set -x
+
+sudo rm -rf /usr/local/go
+sudo apt-get install make mercurial
+wget https://dl.google.com/go/go1.12.9.linux-amd64.tar.gz
+sudo tar -xvf go1.12.9.linux-amd64.tar.gz
+sudo mv go /usr/local
+export GOROOT=/usr/local/go
+export PATH=$PATH:/usr/local/go/bin
+export GO111MODULE=on
+
+RELEASE_VERSION=v0.9.0
+curl -OJL https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
+
+chmod +x operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu && sudo cp operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk && rm operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu
+IMAGE_NAME=$1
+if [ -z "$IMAGE_NAME" ]
+then
+ echo "Building Collectd-Operator image with default image name"
+ make
+else
+ echo "Building Collectd-Operator image $IMAGE_NAME"
+ make IMAGE_NAME=$IMAGE_NAME
+fi
+rm -rf go1.12.9.linux-amd64.tar.gz