diff options
author | stark, steven <steven.stark@att.com> | 2019-09-19 15:43:00 -0700 |
---|---|---|
committer | Brian Freeman <bf1936@att.com> | 2019-10-08 19:31:25 +0000 |
commit | 6754bc1b77065026d499a76d203d12257d33a113 (patch) | |
tree | 762cd3b32b7cc9366c663fa7e5f59ce94001019b /deployment/aks/configure_nfs_pod.sh | |
parent | 92b3cd11dbd906f9304a2436498c6109f8d9a0f5 (diff) |
[INT] Adding deployments scripts for ONAP on AKS
Patch 2 - updating readme and removing dash character from BUILD parameter
Patch 3 - updating image url to amd instead of arm, fixing NFS os disk parameter
Issue-ID: INT-1270
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: I1d8824b3c098855c9094e27fad8c820e4df42677
Diffstat (limited to 'deployment/aks/configure_nfs_pod.sh')
-rwxr-xr-x | deployment/aks/configure_nfs_pod.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/deployment/aks/configure_nfs_pod.sh b/deployment/aks/configure_nfs_pod.sh new file mode 100755 index 000000000..96f66a6f3 --- /dev/null +++ b/deployment/aks/configure_nfs_pod.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Copyright 2019 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +PRIVATE_KEY=$1 +KUBECONFIG=$2 +NFS_IP=$3 +ADMIN_USER=$4 + +export KUBECONFIG=$KUBECONFIG + +echo "setting up nfs on AKS nodes" +kubectl create configmap aks-key --from-file=$PRIVATE_KEY + +for IPADDRESS in `kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}'`; do + +cat <<EOF | kubectl create -f - +apiVersion: v1 +kind: Pod +metadata: + generateName: configure-nfs- +spec: + containers: + - name: configure-nfs + image: alpine + env: + - name: IP_ADDRESS + value: "$IPADDRESS" + - name: NFS_IP + value: "$NFS_IP" + volumeMounts: + - name: aks-key + mountPath: /aks-key + command: ["/bin/sh"] + args: + - -c + - apk update && \ + apk add openssh-client && \ + sh -c "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /aks-key/id_rsa $ADMIN_USER@\$IP_ADDRESS \"sudo apt-get update; sudo apt-get install nfs-common; sudo rm -rf /dockerdata-nfs; sudo mkdir /dockerdata-nfs; sudo mount -t nfs \$NFS_IP:/dockerdata-nfs /dockerdata-nfs/\"" + restartPolicy: Never + volumes: + - name: aks-key + configMap: + name: aks-key + defaultMode: 0600 +EOF + +done + +# TODO +# Add actual pod status check here +echo "sleeping 30 seconds" +sleep 30 + +kubectl delete configmap aks-key +kubectl get pods | grep configure-nfs | while read line; do + pod=`echo $line | awk '{print $1}'` + kubectl delete pod $pod +done |