Skip to content

Commit

Permalink
compatible(integration_test_charm): Add input that would enable metal…
Browse files Browse the repository at this point in the history
…lb for integration tests (#244)

We need metallb enabled for integration tests where we are creating
`loadbalancer` type service in
canonical/mysql-router-k8s-operator#328

Add ability to enable metallb
  • Loading branch information
shayancanonical authored Nov 27, 2024
1 parent e3f522c commit b8b359d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/integration_test_charm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ on:
Required if `cloud` input is "microk8s"
required: false
type: string
metallb-addon:
description: |
Whether to enable metallb
required: false
type: boolean
default: false
lxd-snap-channel:
description: LXD snap channel
default: latest/stable
Expand Down Expand Up @@ -367,6 +373,11 @@ jobs:
sg '${{ steps.parse-cloud.outputs.group }}' -c "microk8s.kubectl rollout status --namespace kube-system --watch --timeout=5m deployments/coredns"
sg '${{ steps.parse-cloud.outputs.group }}' -c "retry --times 3 --delay 5 -- sudo microk8s enable hostpath-storage"
sg '${{ steps.parse-cloud.outputs.group }}' -c "microk8s.kubectl rollout status --namespace kube-system --watch --timeout=5m deployments/hostpath-provisioner"
if [[ '${{ inputs.metallb-addon }}' = 'true' ]]
then
IPADDR=$(ip -4 -j route get 2.2.2.2 | sed -n -e 's/^.*prefsrc\":"\([^ "]*\).*/\1/p')
sg '${{ steps.parse-cloud.outputs.group }}' -c "retry --times 3 --delay 5 -- sudo microk8s enable metallb:$IPADDR-$IPADDR"
fi
mkdir ~/.kube/
# Used by lightkube and kubernetes (Python package)
sg '${{ steps.parse-cloud.outputs.group }}' -c "microk8s config > ~/.kube/config"
Expand Down

0 comments on commit b8b359d

Please sign in to comment.