File tree 1 file changed +22
-3
lines changed
1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -4,10 +4,29 @@ USERNAME=`id -un`
4
4
cd ~ /.kube
5
5
mkdir -p keys
6
6
7
- profile=$( minikube profile list -o json | jq ' .valid' | jq -r ' .[].Name' )
7
+ profiles=$( minikube profile list -o json | jq -r ' .valid | .[] | select(.Status=="Running") | .Name' )
8
+
9
+ profiles_count=$( echo " $profiles " | wc -l | tr -d ' [:space:]' )
10
+
11
+ if [ " $profiles_count " != 1 ]; then
12
+ options=($profiles )
13
+ echo " Select running cluster you want to copy files from?"
14
+ select opt in " ${options[@]} "
15
+ do
16
+ profile_name=$opt
17
+ if [ " $profile_name " == " " ]; then
18
+ echo " Wrong option"
19
+ continue
20
+ fi
21
+ break
22
+ done
23
+ fi
24
+
25
+ echo " Using minikube profile $profile_name "
26
+
8
27
cp /Users/${USERNAME} /.minikube/ca.crt keys/
9
- cp /Users/${USERNAME} /.minikube/profiles/$profile /client.crt keys/
10
- cp /Users/${USERNAME} /.minikube/profiles/$profile /client.key keys/
28
+ cp /Users/${USERNAME} /.minikube/profiles/$profile_name /client.crt keys/
29
+ cp /Users/${USERNAME} /.minikube/profiles/$profile_name /client.key keys/
11
30
12
31
gsed -i " s/\/Users\/${USERNAME} \/.minikube\/profiles\/minikube/.\/keys/g" config
13
32
gsed -i " s/\/Users\/${USERNAME} \/.minikube/.\/keys/g" config
You can’t perform that action at this time.
0 commit comments