From c52662b7f3691bafaad044230847ef4f14e77f63 Mon Sep 17 00:00:00 2001 From: NikitaSkrynnik Date: Thu, 22 Aug 2024 11:09:44 +1100 Subject: [PATCH] cleanup + fix shell linter issues Signed-off-by: NikitaSkrynnik --- .github/workflows/ci.yaml | 7 +------ scripts/aks/aks-start.sh | 5 ++--- scripts/aws/aws-start.sh | 6 +++--- scripts/gke/gke-start.sh | 5 +---- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fb546ad..85271b1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,6 +64,7 @@ jobs: uses: actions/checkout@v4 with: path: ${{ github.workspace }}/src/github.com/${{ github.repository }} + - name: Setup gke run: | scripts/gke/gke-start.sh @@ -113,12 +114,6 @@ jobs: mv ./kubectl /usr/local/bin/kubectl - name: Run interdomain testing run: | - echo "cluster1" - kubectl version --kubeconfig=$KUBECONFIG1 - echo "cluster2" - kubectl version --kubeconfig=$KUBECONFIG2 - echo "cluster3" - kubectl version --kubeconfig=$KUBECONFIG3 go test -count 1 -timeout 2h -race -v ./... -parallel 4 env: KUBECONFIG1: /tmp/config1 diff --git a/scripts/aks/aks-start.sh b/scripts/aks/aks-start.sh index 09b1560..c71661a 100755 --- a/scripts/aks/aks-start.sh +++ b/scripts/aks/aks-start.sh @@ -2,14 +2,13 @@ readonly AZURE_RESOURCE_GROUP=$1 readonly AZURE_CLUSTER_NAME=$2 readonly AZURE_CREDENTIALS_PATH=$3 + if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -z "$3" ]]; then echo "Usage: aks-start.sh " exit 1 fi -AKS_K8S_VERSION=$(echo $K8S_VERSION | cut -d '.' -f 1,2 | cut -c 2-) -echo "k8s version: $K8S_VERSION" -echo "AKS K8S: $AKS_K8S_VERSION" +AKS_K8S_VERSION=$(echo "$K8S_VERSION" | cut -d '.' -f 1,2 | cut -c 2-) echo -n "Creating AKS cluster '$AZURE_CLUSTER_NAME'..." az aks create \ diff --git a/scripts/aws/aws-start.sh b/scripts/aws/aws-start.sh index 561099e..415ab5c 100755 --- a/scripts/aws/aws-start.sh +++ b/scripts/aws/aws-start.sh @@ -7,15 +7,15 @@ export IAM_NAME=ebs-csi-controller-sa apt-get update && apt-get -y install curl dnsutils -curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp; \ +curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_"$(uname -s)"_amd64.tar.gz" | tar xz -C /tmp; \ mv /tmp/eksctl /usr/local/bin; \ eksctl version -curl -Lo aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.6.22/aws-iam-authenticator_0.6.22_$(uname -s)_amd64; \ +curl -Lo aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.6.22/aws-iam-authenticator_0.6.22_"$(uname -s)"_amd64; \ chmod 755 aws-iam-authenticator; \ mv ./aws-iam-authenticator /usr/local/bin -AWS_K8S_VERSION=$(echo $K8S_VERSION | cut -d "." -f 1-2 | cut -c 2-) +AWS_K8S_VERSION=$(echo "$K8S_VERSION" | cut -d "." -f 1-2 | cut -c 2-) echo $AWS_K8S_VERSION eksctl create cluster \ --name "${AWS_CLUSTER_NAME}" \ diff --git a/scripts/gke/gke-start.sh b/scripts/gke/gke-start.sh index 6ef4e0b..2988a62 100755 --- a/scripts/gke/gke-start.sh +++ b/scripts/gke/gke-start.sh @@ -4,14 +4,11 @@ K8S_VERSION=$(echo ${K8S_VERSION} | cut -d '.' -f 1,2 | cut -c 2-) GKE_CLUSTER_VERSION=$(gcloud container get-server-config --zone="$GKE_CLUSTER_ZONE" --format=json \ | jq '.channels[] | select (.channel=="REGULAR") | .validVersions[]' \ | grep -m 1 "$K8S_VERSION" | tr -d '"') -if [ -z "$GKE_CLUSTER_VERSION"]; then +if [ -z "$GKE_CLUSTER_VERSION" ]; then echo "GKE cluster version is not valid: $GKE_CLUSTER_VERSION" exit 1 fi -echo $K8S_VERSION -echo $GKE_CLUSTER_VERSION - gcloud components install gke-gcloud-auth-plugin gcloud components update time gcloud container clusters create "${GKE_CLUSTER_NAME}" \