diff options
author | Mandeep Khinda <mandeep.khinda@amdocs.com> | 2017-09-08 05:20:30 +0000 |
---|---|---|
committer | Mandeep Khinda <mandeep.khinda@amdocs.com> | 2017-09-08 15:45:08 +0000 |
commit | dc2dc86377e64b001c680702773fa39804af170f (patch) | |
tree | b7d01fd437abc61aacaa2af0273da1c299957246 /kubernetes/config/docker/init/config-init.sh | |
parent | f6a39a8d6b2d2ee44d157c71a396e4de32ccba69 (diff) |
converting config to helm and setting demo values
To be able to run the vFW/vLB demos, these needed to be done
manually and it was a big mess.
With the power of helm we can now pass data into the config pod
and make some substitutions
Issue-ID: OOM-277
Change-Id: Ie167920fac7896661b81443aa460ce2e6f615187
Signed-off-by: Mandeep Khinda <mandeep.khinda@amdocs.com>
Diffstat (limited to 'kubernetes/config/docker/init/config-init.sh')
-rwxr-xr-x | kubernetes/config/docker/init/config-init.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/kubernetes/config/docker/init/config-init.sh b/kubernetes/config/docker/init/config-init.sh index 15b4181a75..cc3a0f62f4 100755 --- a/kubernetes/config/docker/init/config-init.sh +++ b/kubernetes/config/docker/init/config-init.sh @@ -1,8 +1,27 @@ #!/bin/bash + +echo "Validating onap-parameters.yaml has been populated" +[[ -z "$OPENSTACK_UBUNTU_14_IMAGE" ]] && { echo "Error: OPENSTACK_UBUNTU_14_IMAGE must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_PUBLIC_NET_ID" ]] && { echo "Error: OPENSTACK_PUBLIC_NET_ID must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_OAM_NETWORK_ID" ]] && { echo "Error: OPENSTACK_OAM_NETWORK_ID must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_OAM_SUBNET_ID" ]] && { echo "Error: OPENSTACK_OAM_SUBNET_ID must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_OAM_NETWORK_CIDR" ]] && { echo "Error: OPENSTACK_OAM_NETWORK_CIDR must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_USERNAME" ]] && { echo "Error: OPENSTACK_USERNAME must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_API_KEY" ]] && { echo "Error: OPENSTACK_API_KEY must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_REGION" ]] && { echo "Error: OPENSTACK_REGION must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_KEYSTONE_URL" ]] && { echo "Error: OPENSTACK_KEYSTONE_URL must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_FLAVOUR_MEDIUM" ]] && { echo "Error: OPENSTACK_FLAVOUR_MEDIUM must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_SERVICE_TENANT_NAME" ]] && { echo "Error: OPENSTACK_SERVICE_TENANT_NAME must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$DMAAP_TOPIC" ]] && { echo "Error: DMAAP_TOPIC must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$DEMO_ARTIFACTS_VERSION" ]] && { echo "Error: DEMO_ARTIFACTS_VERSION must be set in onap-parameters.yaml"; exit 1; } +[[ -z "$OPENSTACK_TENANT_NAME" ]] && { echo "Error: OPENSTACK_TENANT_NAME must be set in onap-parameters.yaml"; exit 1; } + #make NAMESPACE directory +echo "Creating $NAMESPACE directory if it doesn't exist" mkdir -p /config-init/$NAMESPACE/ #unzip the configs in the NAMESPACEs directory ensuring no overwriting of files +echo "Installing configuration files" cp -vnpr /opt/config/src/* /config-init/$NAMESPACE/ #ensure db directories exist. @@ -30,6 +49,7 @@ mkdir -p /config-init/$NAMESPACE/aai/search-data-service/logs/ mkdir -p /config-init/$NAMESPACE/aai/data-router/logs/ mkdir -p /config-init/$NAMESPACE/mso/mariadb/data +echo "Setting permissions to container writeable directories" chmod -R 777 /config-init/$NAMESPACE/sdc/logs/ chmod -R 777 /config-init/$NAMESPACE/portal/logs/ chmod -R 777 /config-init/$NAMESPACE/aai/aai-config/ @@ -45,6 +65,46 @@ chmod -R 777 /config-init/$NAMESPACE/aai/search-data-service/logs/ chmod -R 777 /config-init/$NAMESPACE/aai/data-router/logs/ chmod -R 777 /config-init/$NAMESPACE/policy/mariadb/ +echo "Substituting configuration parameters" # 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" {} \; +# set the ubuntu 14 image +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/UBUNTU_14_IMAGE_NAME_HERE/$OPENSTACK_UBUNTU_14_IMAGE/g" {} \; +# set the openstack public network uuid +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_PUBLIC_NET_ID_HERE/$OPENSTACK_PUBLIC_NET_ID/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_NETWORK_ID_WITH_ONAP_ROUTE_HERE/$OPENSTACK_OAM_NETWORK_ID/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_SUBNET_ID_WITH_ONAP_ROUTE_HERE/$OPENSTACK_OAM_SUBNET_ID/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s,NETWORK_CIDR_WITH_ONAP_ROUTE_HERE,$OPENSTACK_OAM_NETWORK_CIDR,g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_USERNAME_HERE/$OPENSTACK_USERNAME/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_PASSWORD_HERE/$OPENSTACK_API_KEY/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_REGION_HERE/$OPENSTACK_REGION/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s,OPENSTACK_KEYSTONE_IP_HERE,$OPENSTACK_KEYSTONE_URL,g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_FLAVOUR_MEDIUM_HERE/$OPENSTACK_FLAVOUR_MEDIUM/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/DMAAP_TOPIC_HERE/$DMAAP_TOPIC/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_SERVICE_TENANT_NAME_HERE/$OPENSTACK_SERVICE_TENANT_NAME/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/DEMO_ARTIFACTS_VERSION_HERE/$DEMO_ARTIFACTS_VERSION/g" {} \; + +# SDNC/Robot preload files manipulation +OPENSTACK_OAM_NETWORK_CIDR_PREFIX=`cut -d. -f1-3 <<<"$OPENSTACK_OAM_NETWORK_CIDR"` +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_OAM_NETWORK_CIDR_PREFIX_HERE/$OPENSTACK_OAM_NETWORK_CIDR_PREFIX/g" {} \; + +# MSO post install steps to encrypt openstack password +MSO_ENCRYPTION_KEY=$(cat /config-init/$NAMESPACE/mso/mso/encryption.key) +OPENSTACK_API_ENCRYPTED_KEY=`echo -n "$OPENSTACK_API_KEY" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 25 -p` +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_ENCRYPTED_PASSWORD_HERE/$OPENSTACK_API_ENCRYPTED_KEY/g" {} \; + +find /config-init/$NAMESPACE/ -type f -exec sed -i -e "s/OPENSTACK_TENANT_NAME_HERE/$OPENSTACK_TENANT_NAME/g" {} \; + +echo "Done!"
\ No newline at end of file |