Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: NikitaSkrynnik <nikita.skrynnik@xored.com>
  • Loading branch information
NikitaSkrynnik committed Aug 21, 2024
1 parent c0b0850 commit 3600614
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ jobs:

- name: Setup gke
run: |
NSM_KUBERNETES_VERSION=$(echo ${{ vars.NSM_KUBERNETES_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 "$NSM_KUBERNETES_VERSION" | tr -d '"')
if [ -z "$GKE_CLUSTER_VERSION"]; then
echo "GKE cluster version is not valid: $GKE_CLUSTER_VERSION"
exit 1
fi
scripts/gke/gke-start.sh
env:
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }}
Expand All @@ -85,43 +76,44 @@ jobs:
GKE_CLUSTER_ZONE: us-central1-a
GKE_CLUSTER_TYPE: n1-standard-2
GKE_CLUSTER_NUM_NODES: 1
K8S_VERSION: ${{ vars.NSM_KUBERNETES_VERSION }}
KUBECONFIG: /tmp/config1
USE_GKE_GCLOUD_AUTH_PLUGIN: true
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}

- name: Setup aws
run: |
AWS_K8S_VERSION1=${{ vars.NSM_KUBERNETES_VERSION }}
echo $AWS_K8S_VERSION1
AWS_K8S_VERSION_SHORT=$(echo $AWS_K8S_VERSION | cut -d "." -f 1-2 | cut -c 2-)
scripts/aws/aws-start.sh
env:
KUBECONFIG: /tmp/config2
AWS_REGION: us-east-2
AWS_CLUSTER_NAME: aws-${{ github.run_id }}-${{ github.run_number }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_K8S_VERSION: ${{ vars.NSM_KUBERNETES_VERSION }}
K8S_VERSION: ${{ vars.NSM_KUBERNETES_VERSION }}
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}

- name: Setup aks
run: |
AKS_K8S_VERSION=$(echo ${{ vars.NSM_KUBERNETES_VERSION }} | cut -d '.' -f 1,2 | cut -c 2-)
az login --service-principal --username ${AZURE_SERVICE_PRINCIPAL} --password ${AZURE_SERVICE_PRINCIPAL_SECRET} --tenant ${AZURE_TENANT}
scripts/aks/aks-start.sh ${AZURE_RESOURCE_GROUP} ${AZURE_CLUSTER_NAME} ${AZURE_CREDENTIALS_PATH} ${KUBECONFIG}
scripts/aks/aks-start.sh ${AZURE_RESOURCE_GROUP} ${AZURE_CLUSTER_NAME} ${AZURE_CREDENTIALS_PATH} ${KUBECONFIG} ${AKS_K8S_VERSION}
env:
KUBECONFIG: /tmp/config3
AZURE_RESOURCE_GROUP: nsm-ci
AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }}
AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }}
AZURE_SERVICE_PRINCIPAL_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }}
AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
K8S_VERSION: ${{ vars.NSM_KUBERNETES_VERSION }}
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}

- 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:
Expand Down
7 changes: 5 additions & 2 deletions scripts/aks/aks-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
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 <resource-group> <cluster-name> <kube-config-path>"
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"

echo -n "Creating AKS cluster '$AZURE_CLUSTER_NAME'..."
az aks create \
--resource-group "$AZURE_RESOURCE_GROUP" \
--name "$AZURE_CLUSTER_NAME" \
--kubernetes-version $AKS_K8S_VERSION \
--kubernetes-version "$AKS_K8S_VERSION" \
--node-count 1 \
--node-vm-size Standard_B2s \
--enable-node-public-ip \
Expand Down
7 changes: 4 additions & 3 deletions scripts/aws/aws-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export IAM_NAME=ebs-csi-controller-sa

apt-get update && apt-get -y install curl dnsutils

echo $AWS_K8S_VERSION
curl -LO https://storage.googleapis.com/kubernetes-release/release/$AWS_K8S_VERSION/bin/linux/amd64/kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/"$K8S_VERSION"/bin/linux/amd64/kubectl
chmod +x kubectl
mkdir -p ~/.local/bin
mv ./kubectl ~/.local/bin/kubectl
Expand All @@ -21,9 +20,11 @@ curl -o aws-iam-authenticator https://s3.us-west-2.amazonaws.com/amazon-eks/1.21
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-)
echo $AWS_K8S_VERSION
eksctl create cluster \
--name "${AWS_CLUSTER_NAME}" \
--version ${AWS_K8S_VERSION_SHORT} \
--version "${AWS_K8S_VERSION}" \
--nodegroup-name "${AWS_CLUSTER_NAME}-workers" \
--node-type t3.xlarge \
--nodes 1
Expand Down
12 changes: 12 additions & 0 deletions scripts/gke/gke-start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/bin/bash

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
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}" \
Expand Down

0 comments on commit 3600614

Please sign in to comment.