Skip to content

Commit

Permalink
chore: test kb upgrade 0.8 to 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
JashBook committed Jun 12, 2024
1 parent 1954776 commit b4b20d9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 201 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/kbcli-test-k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,6 @@ permissions:
contents: read

jobs:
test-playground:
if: ${{ inputs.TEST_TYPE == '' }}
uses: ./.github/workflows/test-kbcli.yml
with:
cloud-provider: ${{ inputs.CLOUD_PROVIDER }}
region: ${{ inputs.REGION }}
release-version: "${{ inputs.KB_VERSION }}"
test-type: "4"
test-type-name: "playground"
test-args: "${{ inputs.ARGS }}"
branch-name: ${{ inputs.BRANCH_NAME }}
secrets: inherit

terraform-init-k8s:
uses: ./.github/workflows/terraform-init.yml
with:
Expand Down Expand Up @@ -1271,13 +1258,3 @@ jobs:
--url ${{ vars.TEST_BOT_WEBHOOK }} \
--title "$test_title" \
--result "$TEST_RESULT"
terraform-destroy-k8s:
if: ${{ always() }}
needs: [ terraform-init-k8s, send-message ]
uses: ./.github/workflows/terraform-destroy.yml
with:
cloud-provider: ${{ inputs.CLOUD_PROVIDER }}
artifact-name: cicd-${{ inputs.CLOUD_PROVIDER }}-${{ github.sha }}
region: ${{ inputs.REGION }}
secrets: inherit
179 changes: 1 addition & 178 deletions .github/workflows/terraform-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,186 +128,9 @@ jobs:
creds: ${{ env.AZURE_CREDENTIALS_CN }}
environment: azurechinacloud

- name: get deploy path
id: get_deploy_path
run: |
DEPLOY_PATH=""
if [[ "${{ inputs.cloud-provider }}" == "eks" && "${{ inputs.test-mode }}" == "performance" ]]; then
DEPLOY_PATH="./aws/eks-default-vpc-multinode"
elif [[ "${{ inputs.cloud-provider }}" == "eks" ]]; then
DEPLOY_PATH="./aws/eks-default-vpc"
elif [[ "${{ inputs.cloud-provider }}" == "gke" ]]; then
DEPLOY_PATH="./gcp/gke-cicd"
elif [[ "${{ inputs.cloud-provider }}" == "aks" ]]; then
DEPLOY_PATH="./azure/aks-cicd"
elif [[ "${{ inputs.cloud-provider }}" == "aks-cn" ]]; then
DEPLOY_PATH="./azure/aks-cn-cicd"
fi
echo "deploy-path:"$DEPLOY_PATH
echo deploy-path=${DEPLOY_PATH} >> $GITHUB_OUTPUT
- name: terraform init k8s
id: terraform_init
run: |
COUNTS=""
if [[ -n "${{ inputs.test-type }}" ]]; then
COUNTS=$(echo "${{ inputs.test-type }}" | grep -o "|" | wc -l)
COUNTS=$(( $COUNTS + 1 ))
fi
NODE_TYPE="${{ inputs.node-type }}"
if [[ "${{ inputs.test-mode }}" == "smoke" ]]; then
if [[ -z "$COUNTS" ]]; then
if [[ "${{ inputs.kb-version }}" == "v0.5."* ]]; then
COUNTS=3
elif [[ "${{ inputs.kb-version }}" == "v0.6."* ]]; then
COUNTS=4
else
COUNTS=6
fi
elif [[ $COUNTS -gt 1 ]]; then
COUNTS=$(( $COUNTS - 1 ))
fi
if [[ "${{ inputs.cloud-provider }}" == "eks" ]]; then
if [[ "${{ inputs.instance-type }}" == "arm64" ]]; then
NODE_TYPE="t4g.medium"
else
NODE_TYPE="t3a.medium"
fi
elif [[ "${{ inputs.cloud-provider }}" == "gke" ]]; then
if [[ "${{ inputs.instance-type }}" == "arm64" ]]; then
NODE_TYPE=t2a-standard-2
else
NODE_TYPE="e2-standard-2"
fi
fi
echo "NODE_TYPE:$NODE_TYPE"
elif [[ "${{ inputs.test-mode }}" == "fault" && -z "$COUNTS" ]]; then
COUNTS=3
elif [[ "${{ inputs.test-mode }}" == "kubechat" && -z "$COUNTS" ]]; then
COUNTS=0
elif [[ "${{ inputs.test-mode }}" == "cloude2etest" && -z "$COUNTS" ]]; then
COUNTS=1
fi
NODE_SIZE="${{ inputs.node-size }}"
if [[ ("${{ inputs.cloud-provider }}" == "eks" || "${{ inputs.cloud-provider }}" == "aks" || "${{ inputs.cloud-provider }}" == "aks-cn" ) && -n "${COUNTS}" && -z "${NODE_SIZE}" ]]; then
NODE_SIZE="$(( $COUNTS * 2 ))"
elif [[ "${{ inputs.cloud-provider }}" == "gke" && -n "${COUNTS}" && -z "${NODE_SIZE}" ]]; then
NODE_SIZE="$(( $COUNTS / 2 + 1 ))"
fi
if [[ ("${{ inputs.cloud-provider }}" == "eks" || "${{ inputs.cloud-provider }}" == "aks" || "${{ inputs.cloud-provider }}" == "aks-cn" ) && -z "${NODE_SIZE}" && -z "${{ inputs.test-mode }}" ]]; then
if [[ "${{ inputs.kb-version }}" == "v0.5."* ]]; then
NODE_SIZE=4
elif [[ "${{ inputs.kb-version }}" == "v0.6."* ]]; then
NODE_SIZE=17
elif [[ "${{ inputs.kb-version }}" == "v0.7."* ]]; then
NODE_SIZE=33
elif [[ "${{ inputs.kb-version }}" == "v0.8."* ]]; then
NODE_SIZE=39
elif [[ "${{ inputs.kb-version }}" == "v0.9."* ]]; then
NODE_SIZE=42
fi
elif [[ "${{ inputs.cloud-provider }}" == "gke" && -z "${NODE_SIZE}" && -z "${{ inputs.test-mode }}" ]]; then
if [[ "${{ inputs.kb-version }}" == "v0.5."* ]]; then
NODE_SIZE=2
elif [[ "${{ inputs.kb-version }}" == "v0.6."* ]]; then
NODE_SIZE=6
elif [[ "${{ inputs.kb-version }}" == "v0.7."* ]]; then
NODE_SIZE=11
elif [[ "${{ inputs.kb-version }}" == "v0.8."* ]]; then
NODE_SIZE=13
elif [[ "${{ inputs.kb-version }}" == "v0.9."* ]]; then
NODE_SIZE=14
fi
fi
cd ${{ steps.get_deploy_path.outputs.deploy-path }}
cmd="bash run.sh --type 1 "
cmd="${cmd} --cluster-version '${{ inputs.cluster-version }}' "
cmd="${cmd} --instance-type '${{ inputs.instance-type }}' "
if [[ -n "${{ inputs.cluster-name }}" ]]; then
cmd="${cmd} --cluster-name ${{ inputs.cluster-name }} "
fi
if [[ -n "${{ inputs.region }}" ]]; then
cmd="${cmd} --cluster-region ${{ inputs.region }} "
fi
if [[ -n "${NODE_SIZE}" ]]; then
cmd="${cmd} --node-size ${NODE_SIZE} "
fi
if [[ -n "${NODE_TYPE}" ]]; then
cmd="${cmd} --node-type ${NODE_TYPE} "
fi
if [[ -n "${{ inputs.enable-spot }}" ]]; then
cmd="${cmd} --enable-spot ${{ inputs.enable-spot }} "
fi
if [[ -n "${{ inputs.disk-size}}" ]]; then
cmd="${cmd} --disk-size ${{ inputs.disk-size }} "
fi
if [[ "${{ inputs.cloud-provider }}" == "aks" && -n "${{ env.AZURE_CREDENTIALS }}" ]]; then
APP_ID="$( echo "${{ env.AZURE_CREDENTIALS }}" | yq eval '.clientId' -)"
APP_PASSWORD="$( echo "${{ env.AZURE_CREDENTIALS }}" | yq eval '.clientSecret' -)"
if [[ -n "${APP_ID}" ]]; then
cmd="${cmd} --app-id ${APP_ID} "
fi
if [[ -n "${APP_PASSWORD}" ]]; then
cmd="${cmd} --app-password ${APP_PASSWORD} "
fi
elif [[ "${{ inputs.cloud-provider }}" == "aks-cn" && -n "${{ env.AZURE_CREDENTIALS_CN }}" ]]; then
APP_ID="$( echo "${{ env.AZURE_CREDENTIALS_CN }}" | yq eval '.clientId' -)"
APP_PASSWORD="$( echo "${{ env.AZURE_CREDENTIALS_CN }}" | yq eval '.clientSecret' -)"
if [[ -n "${APP_ID}" ]]; then
cmd="${cmd} --app-id ${APP_ID} "
fi
if [[ -n "${APP_PASSWORD}" ]]; then
cmd="${cmd} --app-password ${APP_PASSWORD} "
fi
fi
echo "$cmd"
eval "$cmd"
K8S_CLUSTER_NAME="$(cat terraform.tfstate | yq eval '.outputs.cluster_name.value' -)"
K8S_CLUSTER_NAME="cicd-gke-p5cxdttn"
echo "k8s-cluster-name:${K8S_CLUSTER_NAME}"
echo k8s-cluster-name=${K8S_CLUSTER_NAME} >> $GITHUB_OUTPUT
- name: upload artifact
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
if-no-files-found: error
name: ${{ inputs.artifact-name }}
path: ${{ steps.get_deploy_path.outputs.deploy-path }}
retention-days: 1

- name: Setup kubectl
if: ${{ inputs.cloud-provider == 'gke' && inputs.test-mode == 'kubechat' }}
uses: azure/setup-kubectl@v3
with:
version: "v1.28.3"

- name: Setup gcloud
if: ${{ inputs.cloud-provider == 'gke' && inputs.test-mode == 'kubechat' }}
uses: google-github-actions/setup-gcloud@v1

- name: setup gke-gcloud-auth-plugin
if: ${{ inputs.cloud-provider == 'gke' && inputs.test-mode == 'kubechat' }}
uses: simenandre/setup-gke-gcloud-auth-plugin@v1

- name: get gke credential
if: ${{ inputs.cloud-provider == 'gke' && inputs.test-mode == 'kubechat' }}
run: |
gcloud container clusters get-credentials ${{ steps.terraform_init.outputs.k8s-cluster-name }} \
--zone ${{ inputs.region }} \
--project ${{ vars.GOOGLE_PROJECT }}
kubectl apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/container-engine-accelerators/master/nvidia-driver-installer/cos/daemonset-preloaded-latest.yaml

0 comments on commit b4b20d9

Please sign in to comment.