k0s Check Network #1852
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: k0s Check Network | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 23 * * *" | |
env: | |
MAKEFLAGS: -j | |
jobs: | |
build-k0s: | |
name: "Build :: k0s" | |
if: github.repository == 'k0sproject/k0s' | |
uses: ./.github/workflows/build-k0s.yml | |
with: | |
target-os: linux | |
target-arch: amd64 | |
check-network: | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_TERRAFORM_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_TERRAFORM_KEY }} | |
AWS_DEFAULT_REGION: eu-west-1 | |
TF_VERSION: 1.2.2 | |
KUBECONFIG: ${{ github.workspace }}/kubeconfig | |
name: "K8s Network Conformance Testing" | |
if: github.repository == 'k0sproject/k0s' | |
needs: [build-k0s] | |
runs-on: ubuntu-24.04 | |
outputs: | |
k0s_version: ${{ steps.bin_info.outputs.K0S_VERSION }} | |
kubernetes_version: ${{ steps.k0s_build.outputs.KUBERNETES_VERSION }} | |
defaults: | |
run: | |
working-directory: ./inttest/sonobuoy/terraform | |
steps: | |
- name: Run git checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Prepare build environment | |
working-directory: ./ | |
run: .github/workflows/prepare-build-env.sh | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: ${{ env.TF_VERSION }} | |
- name: Terraform Init | |
run: terraform init | |
- name: Download k0s executable | |
uses: actions/download-artifact@v4 | |
with: | |
name: k0s-linux-amd64 | |
- name: Set k0s' Version | |
id: bin_info | |
working-directory: ./ | |
run: | | |
chmod +x k0s | |
K0S_VER=$(./k0s version) | |
if [ -z "$K0S_VER" ]; then | |
echo "empty k0s version. failing..." | |
exit 1 | |
fi | |
echo K0S_VERSION="$K0S_VER" >> $GITHUB_OUTPUT | |
- name: Terraform Apply | |
env: | |
TF_VAR_k0s_version: ${{ steps.bin_info.outputs.K0S_VERSION }} | |
TF_VAR_k0s_binary_path: ${{ github.workspace }}/k0s | |
run: | | |
PR_NUMBER=$(echo ${GITHUB_REF} | cut -d / -f 3 ) | |
export TF_VAR_cluster_name="k0s_pr_${PR_NUMBER}" | |
# debug | |
echo "k0s_version = ${TF_VAR_k0s_version}" | |
# Start SSH Agent | |
eval `ssh-agent -s` | |
terraform apply -auto-approve | |
- name: Create k0s Cluster using k0sctl | |
id: k0sctl | |
run: | | |
# download k0sctl | |
curl --proto '=https' --tlsv1.2 --retry 5 --retry-all-errors -sSLfo k0sctl "https://github.com/k0sproject/k0sctl/releases/download/${K0SCTL_VERSION}/k0sctl-linux-amd64" | |
chmod +x ./k0sctl | |
./k0sctl apply -c k0sctl.yaml | |
# save kubeconfig file | |
./k0sctl kubeconfig > $KUBECONFIG | |
- name: Run Sonobuoy | |
run: make check-network | |
working-directory: ./inttest | |
- name: Terraform Destroy | |
env: | |
TF_VAR_k0s_version: ${{ steps.bin_info.outputs.K0S_VERSION }} | |
run: | | |
PR_NUMBER=$(echo ${GITHUB_REF} | cut -d / -f 3 ) | |
export TF_VAR_cluster_name="k0s_pr_${PR_NUMBER}" | |
terraform destroy -auto-approve | |
if: ${{ always() }} | |
- name: slack notify | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
uses: 8398a7/action-slack@v3 | |
with: | |
job_name: "K8s Network Conformance Testing" | |
status: ${{ job.status }} | |
fields: workflow,ref,commit,author,job,took # selectable (default: repo,message) | |
if: ${{ always() }} # Pick up events even if the job fails or is canceled. |