summaryrefslogtreecommitdiffstats
path: root/kubernetes/config
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/config')
-rw-r--r--kubernetes/config/createConfig.sh47
-rwxr-xr-xkubernetes/config/docker/init/config-init.sh45
-rw-r--r--kubernetes/config/pod-config-init.yaml4
3 files changed, 72 insertions, 24 deletions
diff --git a/kubernetes/config/createConfig.sh b/kubernetes/config/createConfig.sh
new file mode 100644
index 0000000000..f226ccae47
--- /dev/null
+++ b/kubernetes/config/createConfig.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+usage() {
+ cat <<EOF
+Usage: $0 [PARAMs]
+-u : Display usage
+-n [NAMESPACE] : Kubernetes namespace (required)
+EOF
+}
+
+create_namespace() {
+ kubectl create namespace $1
+}
+
+create_configuration() {
+ create_namespace $1
+ kubectl --namespace $1 create -f pod-config-init.yaml
+}
+
+#MAINs
+NS=
+
+while getopts ":n:u:" PARAM; do
+ case $PARAM in
+ u)
+ usage
+ exit 1
+ ;;
+ n)
+ NS=${OPTARG}
+ ;;
+ ?)
+ usage
+ exit
+ ;;
+ esac
+done
+
+if [[ -z $NS ]]; then
+ usage
+ exit 1
+fi
+
+printf "\n**** Creating configuration for ONAP instance: $NS\n"
+create_configuration $NS
+
+printf "**** Done ****\n"
diff --git a/kubernetes/config/docker/init/config-init.sh b/kubernetes/config/docker/init/config-init.sh
index bf0e644b6f..f751f4d1ca 100755
--- a/kubernetes/config/docker/init/config-init.sh
+++ b/kubernetes/config/docker/init/config-init.sh
@@ -1,26 +1,29 @@
#!/bin/bash
-#make owner directory
-mkdir -p /config-init/$OWNER/
+#make NAMESPACE directory
+mkdir -p /config-init/$NAMESPACE/
-#unzip the configs in the owners directory ensuring no overwriting of files
-cp -vnpr /opt/config/src/* /config-init/$OWNER/
+#unzip the configs in the NAMESPACEs directory ensuring no overwriting of files
+cp -vnpr /opt/config/src/* /config-init/$NAMESPACE/
#ensure db directories exist.
-mkdir -p /config-init/$OWNER/appc/data/
-mkdir -p /config-init/$OWNER/dcae/pgaas/pgdata/
-mkdir -p /config-init/$OWNER/portal/mariadb/data/
-mkdir -p /config-init/$OWNER/sdnc/data/
-mkdir -p /config-init/$OWNER/vid/mariadb/data/
-mkdir -p /config-init/$OWNER/sdc/sdc-cs/CS/
-mkdir -p /config-init/$OWNER/sdc/sdc-es/ES/
-mkdir -p /config-init/$OWNER/sdc/logs/ASDC/ASDC-ES/
-mkdir -p /config-init/$OWNER/sdc/logs/ASDC/ASDC-CS/
-mkdir -p /config-init/$OWNER/sdc/logs/ASDC/ASDC-KB/
-mkdir -p /config-init/$OWNER/sdc/logs/ASDC/ASDC-BE/
-mkdir -p /config-init/$OWNER/sdc/logs/ASDC/ASDC-FE/
-mkdir -p /config-init/$OWNER/aai/opt/aai/logroot/
+mkdir -p /config-init/$NAMESPACE/appc/data/
+mkdir -p /config-init/$NAMESPACE/dcae/pgaas/pgdata/
+mkdir -p /config-init/$NAMESPACE/portal/mariadb/data/
+mkdir -p /config-init/$NAMESPACE/sdnc/data/
+mkdir -p /config-init/$NAMESPACE/vid/mariadb/data/
+mkdir -p /config-init/$NAMESPACE/sdc/sdc-cs/CS/
+mkdir -p /config-init/$NAMESPACE/sdc/sdc-es/ES/
+mkdir -p /config-init/$NAMESPACE/sdc/logs/ASDC/ASDC-ES/
+mkdir -p /config-init/$NAMESPACE/sdc/logs/ASDC/ASDC-CS/
+mkdir -p /config-init/$NAMESPACE/sdc/logs/ASDC/ASDC-KB/
+mkdir -p /config-init/$NAMESPACE/sdc/logs/ASDC/ASDC-BE/
+mkdir -p /config-init/$NAMESPACE/sdc/logs/ASDC/ASDC-FE/
+mkdir -p /config-init/$NAMESPACE/aai/opt/aai/logroot/
-chmod -R 777 /config-init/$OWNER/sdc/logs/
-chmod -R 777 /config-init/$OWNER/aai/aai-config/
-chmod -R 777 /config-init/$OWNER/aai/aai-data/
-chmod -R 777 /config-init/$OWNER/aai/opt/aai/logroot/
+chmod -R 777 /config-init/$NAMESPACE/sdc/logs/
+chmod -R 777 /config-init/$NAMESPACE/aai/aai-config/
+chmod -R 777 /config-init/$NAMESPACE/aai/aai-data/
+chmod -R 777 /config-init/$NAMESPACE/aai/opt/aai/logroot/
+
+# replace the default 'onap' namespace qualification of K8s hostnames within the config files
+find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/onap-/$NAMESPACE-/g" {} \;
diff --git a/kubernetes/config/pod-config-init.yaml b/kubernetes/config/pod-config-init.yaml
index 858e88714b..372694ebe6 100644
--- a/kubernetes/config/pod-config-init.yaml
+++ b/kubernetes/config/pod-config-init.yaml
@@ -10,9 +10,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- - name: OWNER
- value: onapdemo
- image: oomk8s/config-init:1.0.0
+ image: oomk8s/config-init:1.0.1
imagePullPolicy: Always
volumeMounts:
- name: config-init-root