aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/microservices/visualization-operator/build
diff options
context:
space:
mode:
authorSrivahni <srivahni.chivukula@intel.com>2019-08-05 15:39:34 -0700
committerMarco Platania <platania@research.att.com>2019-08-11 21:50:15 +0000
commitcda9d563ef843be5f80ce5755cb291c68dc6e3e8 (patch)
tree463fa10ee2c6399b0d33b2b4f7b04daa8240f223 /vnfs/DAaaS/microservices/visualization-operator/build
parentd9eab4e0325f26d8e05263413e3af5a1bf9ed046 (diff)
Skeletal code for visualization-operator
This visualization-operator(based on operator-sdk) when deployed, should be able to manage(add/update/delete) the datasources dynamically without restarting the grafana pods. Issue-ID: ONAPARC-393 Signed-off-by: Srivahni <srivahni.chivukula@intel.com> Change-Id: I2df3659aca5dd9ad59cf58adaf3c30999829fa2f
Diffstat (limited to 'vnfs/DAaaS/microservices/visualization-operator/build')
-rw-r--r--vnfs/DAaaS/microservices/visualization-operator/build/Dockerfile15
-rwxr-xr-xvnfs/DAaaS/microservices/visualization-operator/build/bin/entrypoint12
-rwxr-xr-xvnfs/DAaaS/microservices/visualization-operator/build/bin/user_setup13
3 files changed, 40 insertions, 0 deletions
diff --git a/vnfs/DAaaS/microservices/visualization-operator/build/Dockerfile b/vnfs/DAaaS/microservices/visualization-operator/build/Dockerfile
new file mode 100644
index 00000000..2ac838fc
--- /dev/null
+++ b/vnfs/DAaaS/microservices/visualization-operator/build/Dockerfile
@@ -0,0 +1,15 @@
+FROM registry.access.redhat.com/ubi7/ubi-minimal:latest
+
+ENV OPERATOR=/usr/local/bin/visualization-operator \
+ USER_UID=1001 \
+ USER_NAME=visualization-operator
+
+# install operator binary
+COPY build/_output/bin/visualization-operator ${OPERATOR}
+
+COPY build/bin /usr/local/bin
+RUN /usr/local/bin/user_setup
+
+ENTRYPOINT ["/usr/local/bin/entrypoint"]
+
+USER ${USER_UID}
diff --git a/vnfs/DAaaS/microservices/visualization-operator/build/bin/entrypoint b/vnfs/DAaaS/microservices/visualization-operator/build/bin/entrypoint
new file mode 100755
index 00000000..f862b484
--- /dev/null
+++ b/vnfs/DAaaS/microservices/visualization-operator/build/bin/entrypoint
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+
+# This is documented here:
+# https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines
+
+if ! whoami &>/dev/null; then
+ if [ -w /etc/passwd ]; then
+ echo "${USER_NAME:-visualization-operator}:x:$(id -u):$(id -g):${USER_NAME:-visualization-operator} user:${HOME}:/sbin/nologin" >> /etc/passwd
+ fi
+fi
+
+exec ${OPERATOR} $@
diff --git a/vnfs/DAaaS/microservices/visualization-operator/build/bin/user_setup b/vnfs/DAaaS/microservices/visualization-operator/build/bin/user_setup
new file mode 100755
index 00000000..1e36064c
--- /dev/null
+++ b/vnfs/DAaaS/microservices/visualization-operator/build/bin/user_setup
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -x
+
+# ensure $HOME exists and is accessible by group 0 (we don't know what the runtime UID will be)
+mkdir -p ${HOME}
+chown ${USER_UID}:0 ${HOME}
+chmod ug+rwx ${HOME}
+
+# runtime user will need to be able to self-insert in /etc/passwd
+chmod g+rw /etc/passwd
+
+# no need for this script to remain in the image after running
+rm $0