Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for canonical k8s #357

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6a4ddbb
add support for canonical k8s
Thanhphan1147 May 28, 2024
adb5651
Update integration_test_run.yaml
Thanhphan1147 May 28, 2024
3bef35a
Update integration_test_run.yaml
Thanhphan1147 May 28, 2024
e2ade54
Update integration_test_run.yaml
Thanhphan1147 May 28, 2024
6fe14a1
Update integration_test_run.yaml
Thanhphan1147 May 28, 2024
56ac319
Update integration_test_run.yaml
Thanhphan1147 May 28, 2024
7cc4b8e
Update integration_test_run.yaml
Thanhphan1147 May 28, 2024
07507bd
Update integration_test_run.yaml
Thanhphan1147 May 28, 2024
3013104
Update integration_test_run.yaml
Thanhphan1147 May 29, 2024
b0ec51f
Update integration_test_run.yaml
Thanhphan1147 May 29, 2024
3ac9fa8
Update integration_test_run.yaml
Thanhphan1147 May 29, 2024
88dfe2f
add_charmcraft_channel_input
Thanhphan1147 Jun 3, 2024
89cb80b
Update integration_test_run.yaml
Thanhphan1147 Jun 11, 2024
6643704
Update integration_test_run.yaml
Thanhphan1147 Jun 11, 2024
659ae73
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jun 13, 2024
fb46702
properly setup canonical-k8s LB
Thanhphan1147 Jun 18, 2024
a12ca67
set lb first address.
Thanhphan1147 Jun 18, 2024
3a9a461
update variable naming
Thanhphan1147 Jun 18, 2024
bbf062b
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jun 18, 2024
023e01b
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jun 20, 2024
31858e9
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jun 21, 2024
98771b2
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jul 1, 2024
1eed04c
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jul 1, 2024
fb30398
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jul 1, 2024
6f21d0d
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Jul 8, 2024
865c423
Merge branch 'main' into add_support_for_canonical_k8s
arturo-seijas Oct 25, 2024
5352f48
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ on:
If this parameter is not specified, the default behavior is to use 'artifact' for pull requests
originating from forked repositories, and 'registry' for all other cases.
default: ""
use-canonical-k8s:
type: boolean
description: (Experimental) Whether to use canonical k8s instead of microk8s
default: false
working-directory:
type: string
description: The working directory for jobs
Expand Down Expand Up @@ -331,6 +335,7 @@ jobs:
plan: ${{ needs.plan.outputs.plan }}
pre-run-script: ${{ inputs.pre-run-script }}
provider: ${{ inputs.provider }}
use-canonical-k8s: ${{ inputs.use-canonical-k8s }}
registry: ghcr.io
self-hosted-runner-arch: ${{ inputs.self-hosted-runner-arch }}
self-hosted-runner-label: ${{ inputs.self-hosted-runner-label }}
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/integration_test_run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ on:
type: string
description: Target directory to do the Trivy testing
default: "."
use-canonical-k8s:
type: boolean
description: (Experimental) Whether to use canonical k8s instead of microk8s
default: false
working-directory:
type: string
description: The working directory for jobs
Expand Down Expand Up @@ -171,10 +175,26 @@ jobs:
)) || inputs.runs-on
}}
steps:
- name: Setup Canonical k8s
if: ${{ inputs.use-canonical-k8s }} == true
id: canonical-k8s
run: |
sudo snap install k8s --channel=1.30-classic/beta --classic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can reuse the channel input here currently used for microk8s to be able to customise the snap channel

sudo k8s bootstrap
mkdir -p ~/.kube
sudo k8s config > ~/.kube/config
echo "kubeconfig=$(sudo k8s config | base64 -w 0)" >> $GITHUB_OUTPUT

IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')
LB_FIRST_ADDR="$(echo "${IPADDR}" | awk -F'.' '{print $1,$2,$3,100}' OFS='.')"
LB_LAST_ADDR="$(echo "${IPADDR}" | awk -F'.' '{print $1,$2,$3,255}' OFS='.')"
LB_ADDR_RANGE="${LB_FIRST_ADDR}-${LB_LAST_ADDR}"
sudo k8s set load-balancer.cidrs=$LB_ADDR_RANGE load-balancer.enabled=true load-balancer.l2-mode=true
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: ${{ inputs.provider }}
credentials-yaml: ${{ steps.canonical-k8s.outputs.kubeconfig }}
microk8s-addons: >-
${{
(
Expand Down Expand Up @@ -296,7 +316,7 @@ jobs:
echo "MODULE=$module" >> $GITHUB_ENV
- name: Run k8s integration tests
working-directory: ${{ inputs.working-directory }}
if: ${{ inputs.provider == 'microk8s' }}
if: ${{ inputs.provider == 'microk8s' }} || ${ inputs.provider == 'k8s' }
run: |
tox -e ${{ inputs.test-tox-env }} -- --model testing --keep-models ${{ env.SERIES }} ${{ env.MODULE }} ${{ env.ARGS }} ${{ inputs.extra-arguments }} ${{ secrets.INTEGRATION_TEST_ARGS }}
- name: Run lxd integration tests
Expand Down
Loading