One namespace leftover fixes

Change-Id: Id44e74db3a26f963957222ba6690f6d57e0378db
Issue-ID: OOM-722
Signed-off-by: BorislavG <Borislav.Glozman@amdocs.com>
diff --git a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties
index e104245..bcf321c 100644
--- a/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties
+++ b/kubernetes/appc/resources/config/appc/opt/onap/sdnc/svclogic/config/svclogic.properties
@@ -20,7 +20,7 @@
 ###
 
 org.onap.ccsdk.sli.dbtype = jdbc
-org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://appc-sdnctldb01:3306/sdnctl
+org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://appc-sdnctldb01.{{.Values.nsPrefix}}:3306/sdnctl
 org.onap.ccsdk.sli.jdbc.database = sdnctl
 org.onap.ccsdk.sli.jdbc.user = sdnctl
 org.onap.ccsdk.sli.jdbc.password = gamma
diff --git a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/config/svclogic.properties b/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/config/svclogic.properties
index f161b2a..2f67a58 100644
--- a/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/config/svclogic.properties
+++ b/kubernetes/appc/resources/config/appc/opt/openecomp/appc/svclogic/config/svclogic.properties
@@ -20,7 +20,7 @@
 ###
 
 org.onap.ccsdk.sli.dbtype = jdbc
-org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://appc-sdnctldb01:3306/sdnctl
+org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://appc-sdnctldb01.{{.Values.nsPrefix}}:3306/sdnctl
 org.onap.ccsdk.sli.jdbc.database = sdnctl
 org.onap.ccsdk.sli.jdbc.user = sdnctl
 org.onap.ccsdk.sli.jdbc.password = gamma
diff --git a/kubernetes/appc/templates/all-services.yaml b/kubernetes/appc/templates/all-services.yaml
index b6d40d7..181cab9 100644
--- a/kubernetes/appc/templates/all-services.yaml
+++ b/kubernetes/appc/templates/all-services.yaml
@@ -69,7 +69,7 @@
 apiVersion: v1
 kind: Service
 metadata:
-  name: dgbuilder
+  name: appc-dgbuilder
   namespace: "{{ .Values.nsPrefix }}"
   labels:
     app: appc-dgbuilder
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-dbbuilder.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-dbbuilder.json
index 2763505..a6c3467 100644
--- a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-dbbuilder.json
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-dbbuilder.json
@@ -5,7 +5,7 @@
       {
         "id": "appc-dgbuilder",
         "name": "APPC-Dgbuilder Server Health Check",
-        "http": "http://dgbuilder.namespace-placeholder:3000/",
+        "http": "http://appc-dgbuilder.namespace-placeholder:3000/",
         "method": "HEAD",
         "header": {
           "Authorization": ["Basic ZGd1c2VyOnRlc3QxMjM="],
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-sdnctldb02-healthcheck.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-sdnctldb02-healthcheck.json
index 60bdd22..559e5a8 100644
--- a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-sdnctldb02-healthcheck.json
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/appc-sdnctldb02-healthcheck.json
@@ -3,9 +3,9 @@
     "name": "Health Check: APPC-SDN-CTL-DB-02",
     "checks": [
       {
-        "id": "sdnctldb02.namespace-placeholder",
+        "id": "appc-sdnctldb02.namespace-placeholder",
         "name": "APPC SDNCTLDB02 Health Check",
-        "tcp": "sdnctldb02.namespace-placeholder:3306",
+        "tcp": "appc-sdnctldb02.namespace-placeholder:3306",
         "interval": "10s",
         "timeout": "1s"
       }
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-mariadb-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-mariadb-script.sh
index 42e708e..cabaa4b 100755
--- a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-mariadb-script.sh
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-mariadb-script.sh
@@ -1,4 +1,4 @@
-NAME=$(/consul/config/bin/kubectl -n namespace-placeholder get pod | grep -o "mariadb[^[:space:]]*")
+NAME=$(/consul/config/bin/kubectl -n namespace-placeholder get pod | grep -o "mso-mariadb[^[:space:]]*")
 
    if [ -n "$NAME" ]; then
        if /consul/config/bin/kubectl -n namespace-placeholder exec -it $NAME -- bash -c 'mysqladmin status -u root -p$MYSQL_ROOT_PASSWORD' > /dev/null; then
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/sparky-be-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/sparky-be-script.sh
index d7def2d..0791c58 100755
--- a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/sparky-be-script.sh
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/sparky-be-script.sh
@@ -1,5 +1,5 @@
 
-NAME=$(/consul/config/bin/kubectl -n namespace-placeholder get pod | grep -o "sparky-be[^[:space:]]*")
+NAME=$(/consul/config/bin/kubectl -n namespace-placeholder get pod | grep -o "aai-sparky-be[^[:space:]]*")
 
 if [ -n "$NAME" ]; then
    if /consul/config/bin/kubectl -n namespace-placeholder exec -it $NAME -- ps -efww | grep 'java' | grep 'sparky' > /dev/null; then
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/tabular-db-availability.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/tabular-db-availability.sh
index a3ac9b4..ebec497 100755
--- a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/tabular-db-availability.sh
+++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/tabular-db-availability.sh
@@ -1,6 +1,6 @@
 
 # Query the Hbase service for the cluster status.
-GET_CLUSTER_STATUS_RESPONSE=$(curl -si -X GET -H "Accept: text/xml" http://hbase.namespace-placeholder:8080/status/cluster)
+GET_CLUSTER_STATUS_RESPONSE=$(curl -si -X GET -H "Accept: text/xml" http://aai-hbase.namespace-placeholder:8080/status/cluster)
 
 if [ -z "$GET_CLUSTER_STATUS_RESPONSE" ]; then
   echo "Tabular store is unreachable."
diff --git a/kubernetes/mso/resources/config/mso/jboss/standalone-full-ha-mso.xml b/kubernetes/mso/resources/config/mso/jboss/standalone-full-ha-mso.xml
index 135950d..86edeb3 100644
--- a/kubernetes/mso/resources/config/mso/jboss/standalone-full-ha-mso.xml
+++ b/kubernetes/mso/resources/config/mso/jboss/standalone-full-ha-mso.xml
@@ -147,7 +147,7 @@
         <subsystem xmlns="urn:jboss:domain:datasources:4.0">
             <datasources>
                 <datasource jndi-name="java:jboss/datasources/mso-requests" pool-name="mso-requests" enabled="true" use-ccm="true">
-                    <connection-url>jdbc:mariadb://mso-mariadb:3306/mso_requests?autoReconnect=true&amp;connectTimeout=60000&amp;socketTimeout=60000</connection-url>
+                    <connection-url>jdbc:mariadb://mso-mariadb.{{.Values.nsPrefix}}:3306/mso_requests?autoReconnect=true&amp;connectTimeout=60000&amp;socketTimeout=60000</connection-url>
                     <driver>mariadb</driver>
                     <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                     <pool>
@@ -177,7 +177,7 @@
                     </timeout>
                 </datasource>
                 <datasource jndi-name="java:jboss/datasources/mso-catalog" pool-name="mso-catalog" enabled="true" use-ccm="true">
-                    <connection-url>jdbc:mariadb://mso-mariadb:3306/mso_catalog?autoReconnect=true&amp;connectTimeout=60000&amp;socketTimeout=60000</connection-url>
+                    <connection-url>jdbc:mariadb://mso-mariadb.{{.Values.nsPrefix}}:3306/mso_catalog?autoReconnect=true&amp;connectTimeout=60000&amp;socketTimeout=60000</connection-url>
                     <driver>mariadb</driver>
                     <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                     <pool>
@@ -207,7 +207,7 @@
                     </timeout>
                 </datasource>
                 <datasource jta="true" jndi-name="java:jboss/datasources/ProcessEngine" pool-name="ProcessEngine" enabled="true" use-java-context="true" use-ccm="true">
-                    <connection-url>jdbc:mariadb://mso-mariadb:3306/camundabpmn?autoReconnect=true&amp;connectTimeout=60000&amp;socketTimeout=60000</connection-url>
+                    <connection-url>jdbc:mariadb://mso-mariadb.{{.Values.nsPrefix}}:3306/camundabpmn?autoReconnect=true&amp;connectTimeout=60000&amp;socketTimeout=60000</connection-url>
                     <driver>mariadb</driver>
                     <new-connection-sql>set autocommit=1</new-connection-sql>
                     <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
diff --git a/kubernetes/oneclick/createAll.bash b/kubernetes/oneclick/createAll.bash
index b7d6a64..488f920 100755
--- a/kubernetes/oneclick/createAll.bash
+++ b/kubernetes/oneclick/createAll.bash
@@ -27,8 +27,7 @@
 }
 
 create_service_account() {
-#  cmd=`echo kubectl create clusterrolebinding $1-$2-admin-binding --clusterrole=cluster-admin --serviceaccount=$1-$2:default`
-  cmd=`echo kubectl create clusterrolebinding $1-$2-admin-binding --clusterrole=cluster-admin --serviceaccount=$1:default`
+  cmd=`echo kubectl create clusterrolebinding $1-admin-binding --clusterrole=cluster-admin --serviceaccount=$1:default`
   eval ${cmd}
   check_return_code $cmd
 }
@@ -39,7 +38,6 @@
 }
 
 create_registry_key() {
-#  cmd=`echo kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7`
 cmd=`echo kubectl --namespace $1 create secret docker-registry $2 --docker-server=$3 --docker-username=$4 --docker-password=$5 --docker-email=$6`
   eval ${cmd}
   check_return_code $cmd
@@ -179,15 +177,15 @@
 
     printf "\nCreating registry secret **********\n"
     create_registry_key $NS ${NS}-docker-registry-key $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL
+
+    printf "\nCreating service account **********\n"
+    create_service_account $NS
 fi
 
 printf "\n\n********** Creating deployments for ${HELM_APPS[*]} ********** \n"
 
 for i in ${HELM_APPS[@]}; do
 
-  printf "\nCreating service account **********\n"
-  create_service_account $NS $i
-
   printf "\nCreating deployments and services **********\n"
   create_onap_helm $NS $i $start
 
diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash
index 52748bc..9833af7 100755
--- a/kubernetes/oneclick/deleteAll.bash
+++ b/kubernetes/oneclick/deleteAll.bash
@@ -7,12 +7,11 @@
 }
 
 delete_service_account() {
-    kubectl delete clusterrolebinding $1-$2-admin-binding
-    printf "Service account $1-$2-admin-binding deleted.\n\n"
+    kubectl delete clusterrolebinding $1-admin-binding
 }
 
 delete_registry_key() {
-  kubectl --namespace $1-$2 delete secret ${1}-docker-registry-key
+  kubectl --namespace $1 delete secret ${1}-docker-registry-key
 }
 
 delete_app_helm() {
@@ -134,13 +133,14 @@
 
 for i in ${HELM_APPS[@]}; do
   delete_app_helm $NS $i
-  delete_service_account $NS $i
 done
 
 if [ "$SINGLE_COMPONENT" == "false" ]
 then
     delete_app_helm $NS "config"
     delete_namespace $NS
+    delete_registry_key $NS
+    delete_service_account $NS
 fi
 
 if $WAIT_TERMINATE; then