summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lucas <jflucas@research.att.com>2018-04-02 20:55:04 +0000
committerJack Lucas <jflucas@research.att.com>2018-04-02 20:56:23 +0000
commit53f311061281ebb6de118a92620e3de6e0a1c56c (patch)
tree12645797dc88a2571a46c7c48b605057c5ea8b8f
parent42014650de4ec32155b663594dee8cc0b066f6a9 (diff)
Make bootstrap k8s Job-friendly
Change-Id: I131783f56ef24bcc015ff115c67a766d03bf0ea0 Issue-ID: DCAEGEN2-421 Signed-off-by: Jack Lucas <jflucas@research.att.com>
-rwxr-xr-xk8s-bootstrap-container/bootstrap.sh33
-rw-r--r--k8s-bootstrap-container/pom.xml2
2 files changed, 27 insertions, 8 deletions
diff --git a/k8s-bootstrap-container/bootstrap.sh b/k8s-bootstrap-container/bootstrap.sh
index 38da261..5fc831c 100755
--- a/k8s-bootstrap-container/bootstrap.sh
+++ b/k8s-bootstrap-container/bootstrap.sh
@@ -3,10 +3,15 @@
# Expects:
# CM address (IP or DNS) in CMADDR environment variable
# CM password in CMPASS environment variable (assumes user is "admin")
+# Consul address with port in CONSUL variable
# Plugin wagon files in /wagons
+# Blueprints for components to be installed in /blueprints
+# Input files for components to be installed in /inputs
+# Configuration JSON files that need to be loaded into Consul in /dcae-configs
-set -x
+set -ex
+CBS_REG='{"ID": "dcae-cbs0", "Name": "config_binding_service", "Address": "config-binding-service", "Port": 10000}'
# Deploy components
# $1 -- name (for bp and deployment)
# $2 -- blueprint name
@@ -20,11 +25,29 @@ cfy profiles use -u admin -t default_tenant -p "${CMPASS}" "${CMADDR}"
# Output status, for debugging purposes
cfy status
+# Load configurations into Consul
+for config in /dcae-configs/*.json
+do
+ # The basename of the file is the Consul key
+ key=$(basename ${config} .json)
+ # Strip out comments, empty lines
+ egrep -v "^#|^$" ${config} > /tmp/dcae-upload
+ curl -v -X PUT -H "Content-Type: application/json" --data-binary @/tmp/dcae-upload ${CONSUL}/v1/kv/${key}
+done
+
+# For backward compatibility, load config_binding_service into Consul as service
+curl -v -X PUT -H "Content-Type: application/json" --data "${CBS_REG}" ${CONSUL}/v1/agent/service/register
+
# Load plugins onto CM
+# Allow "already loaded" error
+# (If there are other problems, will
+# be caught in deployments.)
+set +e
for wagon in /wagons/*.wgn
do
cfy plugins upload ${wagon}
done
+set -e
# Deploy platform components
deploy config_binding_service k8s-config_binding_service.yaml k8s-config_binding_service-inputs.yaml
@@ -32,9 +55,5 @@ deploy inventory k8s-inventory.yaml k8s-inventory-inputs.yaml
deploy deployment_handler k8s-deployment_handler.yaml k8s-deployment_handler-inputs.yaml
deploy policy_handler k8s-policy_handler.yaml k8s-policy_handler-inputs.yaml
-# Keep the container running
-# Useful to exec into it for debugging and uninstallation
-while true
-do
- sleep 120
-done \ No newline at end of file
+# Display deployments, for debugging purposes
+cfy deployments list
diff --git a/k8s-bootstrap-container/pom.xml b/k8s-bootstrap-container/pom.xml
index 6046a9c..d4be83f 100644
--- a/k8s-bootstrap-container/pom.xml
+++ b/k8s-bootstrap-container/pom.xml
@@ -27,7 +27,7 @@ limitations under the License.
<groupId>org.onap.dcaegen2.deployments</groupId>
<artifactId>k8s-bootstrap-container</artifactId>
<name>dcaegen2-deployments-k8s-bootstrap-container</name>
- <version>1.0.0</version>
+ <version>1.1.0</version>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>