Skip to content

Commit 2c6a717

Browse files
authored
Adding KUBECONFIG path validation instead of directly checking for anon.conf (#11)
1 parent 0300183 commit 2c6a717

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ Run these two commands to pull in all the required dependencies and set the appr
1010

1111
Linux:
1212
```
13-
./linux/setup_k8s.sh
1413
export KUBECONFIG = "/path/to/your/anon.conf"
14+
./linux/setup_k8s.sh
1515
```
1616

1717
Windows PowerShell (elevated permissions required, so run as admin):
1818
```
19-
.\windows\setup_k8s.ps1
2019
$env:KUBECONFIG = "C:\path\to\your\anon.conf"
20+
.\windows\setup_k8s.ps1
2121
```
2222

2323
Refer to https://kubernetes.io/docs/tasks/tools/ if you would rather install kubectl manually.

linux/setup_k8s.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ set -e
66

77
echo "Starting Kubernetes setup..."
88

9-
if [ ! -f "anon.conf" ]; then
10-
echo "Please download anon.conf from the AMD OSSCI confluence site to get started"
9+
# Exit early if KUBECONFIG is not set to a valid path
10+
if [ -z "$KUBECONFIG" ]; then
11+
echo "KUBECONFIG is not set or empty. Exiting"
12+
echo "Please download the authentication file from the AMD OSSCI confluence site and set KUBECONFIG env variable to the file path"
1113
echo "You will need this auth file to access the k8s cluster"
1214
exit 1
15+
elif [ ! -f "$KUBECONFIG" ]; then
16+
echo "File $KUBECONFIG does not exit. Exiting"
17+
echo "Plese make sure the KUBECONFIG env variable is correctly set to the authentication file path"
18+
exit 1
19+
else
20+
echo "KUBECONFIG is set to: $KUBECONFIG"
1321
fi
1422

1523
echo "Downloading kubectl..."

0 commit comments

Comments
 (0)