Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
eaudetcobello committed Oct 22, 2024
1 parent 83f3b44 commit 2f54e43
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 301 deletions.
237 changes: 79 additions & 158 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,105 +4,72 @@ on:
pull_request:

permissions:
id-token: write
contents: read

jobs:
# build-provider-e2e-images:
# name: Build Provider E2E Images
# runs-on : [self-hosted, linux, X64, jammy, large]
# steps:
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# # We run into rate limiting issues if we don't authenticate
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Check out repo
# uses: actions/checkout@v4
# - name: Install requirements
# run: |
# sudo apt update
# sudo apt install -y make docker-buildx
# sudo snap install go --classic --channel=1.22/stable
# sudo snap install kubectl --classic --channel=1.30/stable
# - name: Build provider images
# #run: sudo make docker-build-e2e
# run: |
# docker pull ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:ci-test
# docker tag ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:ci-test ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:dev
# docker pull ghcr.io/canonical/cluster-api-k8s/controlplane-controller:ci-test
# docker tag ghcr.io/canonical/cluster-api-k8s/controlplane-controller:ci-test ghcr.io/canonical/cluster-api-k8s/controlplane-controller:dev
# - name: Save provider image
# run: |
# sudo docker save -o provider-images.tar ghcr.io/canonical/cluster-api-k8s/controlplane-controller:dev ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:dev
# sudo chmod 775 provider-images.tar
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: e2e-images
# path: |
# provider-images.tar

# build-k8s-snap-e2e-images:
# name: Build K8s Snap E2E Images
# if: false
# runs-on: [self-hosted, linux, X64, jammy, large]
# steps:
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# # We run into rate limiting issues if we don't authenticate
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Check out repo
# uses: actions/checkout@v4
# - name: Install requirements
# run: |
# sudo apt update
# sudo apt install -y make docker-buildx
# sudo snap install go --classic --channel=1.22/stable
# sudo snap install kubectl --classic --channel=1.30/stable
# - name: Build k8s-snap images
# working-directory: hack/
# run: |
# ./build-e2e-images.sh
# - name: Save k8s-snap image
# run: |
# sudo docker save -o k8s-snap-image-old.tar k8s-snap:dev-old
# sudo docker save -o k8s-snap-image-new.tar k8s-snap:dev-new
# sudo chmod 775 k8s-snap-image-old.tar
# sudo chmod 775 k8s-snap-image-new.tar
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: e2e-images
# path: |
# k8s-snap-image-old.tar
# k8s-snap-image-new.tar
build-e2e-images:
name: Build & Run E2E Images
runs-on: [self-hosted, linux, X64, jammy, large]
steps:
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# We run into rate limiting issues if we don't authenticate
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check out repo
uses: actions/checkout@v4
- name: Install requirements
run: |
sudo apt update
sudo snap install go --classic --channel=1.22/stable
sudo apt install make
sudo apt install docker-buildx
sudo snap install kubectl --classic --channel=1.30/stable
- name: Build provider images
run: sudo make docker-build-e2e
- name: Build k8s-snap images
working-directory: hack/
run: |
./build-e2e-images.sh
- name: Save provider image
run: |
sudo docker save -o provider-images.tar ghcr.io/canonical/cluster-api-k8s/controlplane-controller:dev ghcr.io/canonical/cluster-api-k8s/bootstrap-controller:dev
sudo chmod 775 provider-images.tar
- name: Save k8s-snap image
run: |
sudo docker save -o k8s-snap-image-old.tar k8s-snap:dev-old
sudo docker save -o k8s-snap-image-new.tar k8s-snap:dev-new
sudo chmod 775 k8s-snap-image-old.tar
sudo chmod 775 k8s-snap-image-new.tar
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: e2e-images
path: |
provider-images.tar
k8s-snap-image-old.tar
k8s-snap-image-new.tar
run-e2e-tests:
name: Run E2E Tests
runs-on: [self-hosted, linux, X64, jammy, xlarge]
#needs: [build-provider-e2e-images]
needs: build-e2e-images
strategy:
max-parallel: 1 # Only one at a time because of AWS resource limitations (like maximum number of elastic ip's)
matrix:
infra:
- "aws"
#- "docker"
ginkgo_focus:
#- "KCP remediation"
#- "MachineDeployment remediation"
- "KCP remediation"
- "MachineDeployment remediation"
- "Workload cluster creation"
#- "Workload cluster scaling"
#- "Workload cluster upgrade"
- "Workload cluster scaling"
- "Workload cluster upgrade"
# TODO(ben): Remove once all tests are running stable.
fail-fast: false
steps:
- name: Login to GitHub Container Registry
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# We run into rate limiting issues if we don't authenticate
Expand All @@ -111,81 +78,35 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check out repo
uses: actions/checkout@v4
# - name: Setup tmate session
# uses: canonical/action-tmate@main
# with:
# detached: true
# - name: Install requirements
# run: |
# sudo apt update
# sudo snap install go --classic --channel=1.22/stable
# sudo snap install kubectl --classic --channel 1.31/stable
# sudo apt install make
# ./hack/install-aws-nuke.sh
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: e2e-images
# path: .
# - name: Load provider image
# run: sudo docker load -i provider-images.tar
# - name: Load k8s-snap old image
# if: matrix.infra == 'docker'
# run: |
# sudo docker load -i k8s-snap-image-old.tar
# - name: Load k8s-snap new image
# if: matrix.infra == 'docker' && matrix.ginkgo_focus == 'Workload cluster upgrade'
# run: |
# sudo docker load -i k8s-snap-image-new.tar
# - name: Create docker network
# run: |
# sudo docker network create kind --driver=bridge -o com.docker.network.bridge.enable_ip_masquerade=true
# - name: Increase inotify watches
# run: |
# # Prevents https://cluster-api.sigs.k8s.io/user/troubleshooting#cluster-api-with-docker----too-many-open-files
# sudo sysctl fs.inotify.max_user_watches=1048576
# sudo sysctl fs.inotify.max_user_instances=8192
- name: Install clusterawsadm
if: matrix.infra == 'aws'
- name: Install requirements
run: |
curl -L https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/v2.6.1/clusterawsadm-linux-amd64 -o clusterawsadm
chmod +x ./clusterawsadm
sudo mv ./clusterawsadm /usr/local/bin
clusterawsadm version
- name: Configure AWS Credentials
id: creds
if: matrix.infra == 'aws'
uses: aws-actions/configure-aws-credentials@v4
sudo apt update
sudo snap install go --classic --channel=1.22/stable
sudo apt install make
sudo apt install docker-buildx
sudo snap install kubectl --classic --channel=1.30/stable
- name: Download artifacts
uses: actions/download-artifact@v4
with:
audience: sts.amazonaws.com
aws-region: us-east-2
role-to-assume: arn:aws:iam::018302341396:role/GithubOIDC
role-duration-seconds: 3600
output-credentials: true
- name: Set AWS Credentials as Environment Variables
if: matrix.infra == 'aws'
name: e2e-images
path: .
- name: Load provider image
run: sudo docker load -i provider-images.tar
- name: Load k8s-snap old image
run: |
#echo "AWS_ACCESS_KEY_ID=${{ steps.creds.outputs.aws-access-key-id }}" >> "$GITHUB_ENV"
#echo "AWS_SECRET_KEY_ID=${{ steps.creds.outputs.aws-secret-access-key }}" >> "$GITHUB_ENV"
#echo "AWS_SESSION_TOKEN=${{ steps.creds.outputs.aws-session-token }}" >> "$GITHUB_ENV"
#echo "AWS_REGION=us-east-2" >> "$GITHUB_ENV"
#export AWS_ACCESS_KEY_ID=${{ steps.creds.outputs.aws-access-key-id }}
export AWS_SECRET_KEY_ID="${{ steps.creds.outputs.aws-secret-access-key }}"
echo "AWS_SECRET_KEY_ID=${{ steps.creds.outputs.aws-secret-access-key }}" >> "$GITHUB_ENV"
#export AWS_SESSION_TOKEN=${{ steps.creds.outputs.aws-session-token }}
AWS_B64ENCODED_CREDENTIALS=$(clusterawsadm bootstrap credentials encode-as-profile --region us-east-2)
echo "AWS_B64ENCODED_CREDENTIALS=$AWS_B64ENCODED_CREDENTIALS" >> "$GITHUB_ENV"
echo "::add-mask::$AWS_B64ENCODED_CREDENTIALS"
- name: Run e2e tests
if: ${{!(matrix.infra == 'aws' && (matrix.ginkgo_focus == 'KCP remediation' || matrix.ginkgo_focus == 'MachineDeployment remediation'))}}
sudo docker load -i k8s-snap-image-old.tar
- name: Load k8s-snap new image
if: matrix.ginkgo_focus == 'Workload cluster upgrade'
run: |
sudo docker load -i k8s-snap-image-new.tar
- name: Create docker network
run: |
sudo snap install juju --classic --channel 2.9/stable
juju bootstrap aws/us-east-2 vimdiesel-aws --force --bootstrap-series jammy --bootstrap-constraints "arch=amd64" --model-default test-mode=true --model-default resource-tags=owner=vimdiesel --model-default automatically-retry-hooks=false --model-default 'logging-config=<root>=DEBUG' --model-default image-stream=daily --debug
juju scp -m controller "$DIR"/run-e2e-test.sh 0:/home/ubuntu/run-e2e-test.sh
juju exec --model controller --unit controller/0 -- AWS_B64ENCODED_CREDENTIALS=${AWS_B64ENCODED_CREDENTIALS} /home/ubuntu/run-e2e-test.sh
- name: Cleanup AWS account
if: false
sudo docker network create kind --driver=bridge -o com.docker.network.bridge.enable_ip_masquerade=true
- name: Increase inotify watches
run: |
# Prevents https://cluster-api.sigs.k8s.io/user/troubleshooting#cluster-api-with-docker----too-many-open-files
sudo sysctl fs.inotify.max_user_watches=1048576
sudo sysctl fs.inotify.max_user_instances=8192
- name: Run e2e tests
run: |
aws-nuke run --config ./hack/aws-nuke-config.yaml --force --force-sleep 3 --no-dry-run
sudo E2E_INFRA=docker GINKGO_FOCUS="${{ matrix.ginkgo_focus }}" SKIP_RESOURCE_CLEANUP=true make test-e2e
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ GINKGO_NODES ?= 1 # GINKGO_NODES is the number of parallel nodes to run
GINKGO_TIMEOUT ?= 2h
GINKGO_POLL_PROGRESS_AFTER ?= 60m
GINKGO_POLL_PROGRESS_INTERVAL ?= 5m
E2E_INFRA ?= aws
E2E_INFRA ?= docker
E2E_CONF_FILE ?= $(TEST_DIR)/e2e/config/ck8s-$(E2E_INFRA).yaml
SKIP_RESOURCE_CLEANUP ?= false
USE_EXISTING_CLUSTER ?= false
Expand Down Expand Up @@ -408,7 +408,3 @@ $(CONTROLLER_GEN): ## Build controller-gen from tools folder.

$(CONVERSION_GEN): ## Build conversion-gen from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) k8s.io/code-generator/cmd/conversion-gen $(CONVERSION_GEN_BIN) $(CONVERSION_GEN_VER)

.PHONY: nuke
nuke:
aws-nuke -c ~/.config/aws-nuke/nuke-config.yaml --no-dry-run
41 changes: 0 additions & 41 deletions hack/aws-nuke-config.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions hack/juju-create-aws-instance.sh

This file was deleted.

27 changes: 0 additions & 27 deletions hack/run-e2e-test.sh

This file was deleted.

Loading

0 comments on commit 2f54e43

Please sign in to comment.