2 # Copyright 2019 AT&T Intellectual Property. All rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
20 if [ -z "$CONF" ]; then
21 echo "Configuration file required, exiting..."
27 kubectl create configmap onap-bootstrap --from-file=$DIR/bootstrap/ --from-file=kubeconfig=$KUBECONFIG --from-file=onap.conf=$CONF
29 cat <<EOF | kubectl apply -f -
36 - name: onap-bootstrap
40 value: "/tmp/onap-bootstrap-files"
42 - name: onap-bootstrap
43 mountPath: /onap-bootstrap
53 apk add openjdk8-jre && \
54 export PATH=$PATH:/usr/lib/jvm/java-1.8-openjdk/bin && \
55 curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl && \
56 chmod +x ./kubectl && \
57 mv ./kubectl /usr/local/bin/kubectl && \
58 cd /onap-bootstrap && \
60 export KUBECONFIG=kubeconfig && \
61 sh -c "/onap-bootstrap/bootstrap.sh"
64 - name: onap-bootstrap
70 echo "Creating pod to Bootstrap ONAP with OpenStack details."
71 echo "This might take a while if OpenStack is still launching..."
76 while [ "$podstatus" != "Error" ] && [ "$podstatus" != "Completed" ] && [ $COUNTER -lt 60 ]; do
77 podstatus=`kubectl get pods | grep onap-bootstrap | head -1 | awk '{print $3}'`
78 echo "onap-bootstrap is $podstatus"
79 COUNTER=$((COUNTER +1))
83 echo "onap-bootstrap pod logs available at /tmp/onap-bootstrap-log"
84 kubectl logs onap-bootstrap > /tmp/onap-bootstrap-log
86 kubectl delete pod onap-bootstrap
87 kubectl delete configmap onap-bootstrap
89 if [ "$podstatus" = "Error" ]; then
90 echo "ONAP bootstrap failed!"