-
Notifications
You must be signed in to change notification settings - Fork 12
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
Thanhphan1147
wants to merge
31
commits into
main
Choose a base branch
from
add_support_for_canonical_k8s
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
6a4ddbb
add support for canonical k8s
Thanhphan1147 adb5651
Update integration_test_run.yaml
Thanhphan1147 3bef35a
Update integration_test_run.yaml
Thanhphan1147 e2ade54
Update integration_test_run.yaml
Thanhphan1147 6fe14a1
Update integration_test_run.yaml
Thanhphan1147 56ac319
Update integration_test_run.yaml
Thanhphan1147 7cc4b8e
Update integration_test_run.yaml
Thanhphan1147 07507bd
Update integration_test_run.yaml
Thanhphan1147 3013104
Update integration_test_run.yaml
Thanhphan1147 b0ec51f
Update integration_test_run.yaml
Thanhphan1147 3ac9fa8
Update integration_test_run.yaml
Thanhphan1147 88dfe2f
add_charmcraft_channel_input
Thanhphan1147 89cb80b
Update integration_test_run.yaml
Thanhphan1147 6643704
Update integration_test_run.yaml
Thanhphan1147 659ae73
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 fb46702
properly setup canonical-k8s LB
Thanhphan1147 a12ca67
set lb first address.
Thanhphan1147 3a9a461
update variable naming
Thanhphan1147 bbf062b
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 023e01b
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 31858e9
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 98771b2
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 1eed04c
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 fb30398
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 6f21d0d
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 865c423
Merge branch 'main' into add_support_for_canonical_k8s
arturo-seijas 5352f48
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 b9d648e
Merge remote-tracking branch 'origin/main' into add_support_for_canon…
Thanhphan1147 1327c6e
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 731049a
Merge branch 'main' into add_support_for_canonical_k8s
Thanhphan1147 e612f12
Update integration_test_run.yaml
Thanhphan1147 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,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 | ||
|
@@ -174,6 +178,21 @@ jobs: | |
)) || inputs.runs-on | ||
}} | ||
steps: | ||
- name: Setup Canonical k8s | ||
if: inputs.use-canonical-k8s && inputs.provider == 'k8s' | ||
id: canonical-k8s | ||
run: | | ||
sudo snap install k8s --channel=${{ inputs.channel }} --classic | ||
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='.')" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not know much about this, but you will this work out of the box? You are in a subnet with other machines that may reply to arp requests for some of those ips. |
||
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: Disable snap autorefresh | ||
run: sudo snap refresh --hold=2h | ||
- name: Wait for last autorefresh | ||
|
@@ -246,6 +265,7 @@ jobs: | |
uses: charmed-kubernetes/actions-operator@main | ||
with: | ||
provider: ${{ inputs.provider }} | ||
credentials-yaml: ${{ steps.canonical-k8s.outputs.kubeconfig }} | ||
microk8s-addons: >- | ||
${{ | ||
( | ||
|
@@ -355,7 +375,7 @@ jobs: | |
echo "ARGS=$args" >> $GITHUB_ENV | ||
- name: Run k8s integration tests | ||
working-directory: ${{ inputs.working-directory }} | ||
if: ${{ inputs.provider == 'microk8s' }} | ||
if: ${{ inputs.provider == 'microk8s' }} || ${ inputs.provider == 'k8s' } | ||
run: | | ||
[ -n "${{ vars.INTEGRATION_TEST_SECRET_ENV_NAME }}" ] && export ${{ vars.INTEGRATION_TEST_SECRET_ENV_NAME }}="${{ secrets.INTEGRATION_TEST_SECRET_ENV_VALUE }}" || : | ||
[ -n "${{ vars.INTEGRATION_TEST_SECRET_ENV_NAME_1 }}" ] && export ${{ vars.INTEGRATION_TEST_SECRET_ENV_NAME_1 }}="${{ secrets.INTEGRATION_TEST_SECRET_ENV_VALUE_1 }}" || : | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use another input variable for the channel? The default is latest/stable, and that does not exists for that snap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not the best but I don't know if it's worth adding another option for this. I believe it might lead to confusion