-
Notifications
You must be signed in to change notification settings - Fork 71
[test] Add Cilium BGP LB e2e test #290
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b6af5a7
Add Cilium BGP LB e2e test
komer3 bd9cb3f
Makefile fix
komer3 104f1a5
Adding nanode cleanup
komer3 275cfc0
nit fix: adding eod
komer3 bf4ed94
Adding right kubeconfig path for patchs in Makefile
komer3 4efe366
fix up the test
komer3 0359ebd
debug
komer3 fce1d2a
Handle multiple nodes for labeling
komer3 827b153
fix?
komer3 b1ad112
Syntax fix
komer3 422b7ca
fix?
komer3 fa28e56
test
komer3 6190572
fix
komer3 4c3ef44
Using bash/shell script to patch to make thing reabable and fix issue…
komer3 738fb4b
Enable old tests back and some clean up
komer3 1f3acdf
Address comments
komer3 5ceecb0
fixes
komer3 130e5be
Delete nanode incase we hit some error case
komer3 6a2893a
Merge branch 'main' into cilium-bgp-lb-e2e
komer3 9a20380
Change the dir structure
komer3 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
| apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
| kind: Test | ||
| metadata: | ||
| name: cilium-bgp-test | ||
| spec: | ||
| namespace: "cilium-bgp-test" | ||
| steps: | ||
| - name: Check if CCM is deployed | ||
| try: | ||
| - assert: | ||
| file: ../test/assert-ccm-resources.yaml | ||
| - name: Create a pod and service with load balancer type cilium-bgp | ||
| try: | ||
| - apply: | ||
| file: create-pod-service.yaml | ||
| catch: | ||
| - describe: | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| - describe: | ||
| apiVersion: v1 | ||
| kind: Service | ||
| - name: Verify CiliumLoadBalancerIPPool creation | ||
| try: | ||
| - assert: | ||
| resource: | ||
| apiVersion: cilium.io/v2alpha1 | ||
| kind: CiliumLoadBalancerIPPool | ||
| metadata: | ||
| name: cilium-bgp-test-test-bgp-svc-pool | ||
| spec: | ||
| disabled: false | ||
| - name: Verify CiliumBGPPeeringPolicy | ||
| try: | ||
| - assert: | ||
| resource: | ||
| apiVersion: cilium.io/v2alpha1 | ||
| kind: CiliumBGPPeeringPolicy | ||
| metadata: | ||
| name: linode-ccm-bgp-peering | ||
| spec: | ||
| nodeSelector: | ||
| matchLabels: | ||
| cilium-bgp-peering: "true" | ||
| - name: Check LoadBalancer IP assignment | ||
| try: | ||
| - assert: | ||
| resource: | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: test-bgp-svc | ||
| status: | ||
| conditions: | ||
| - status: "True" | ||
| type: cilium.io/IPAMRequestSatisfied | ||
| - name: Verify IP sharing on labeled nodes | ||
| try: | ||
| - script: | ||
| content: | | ||
| set -e | ||
|
|
||
| # Get the LoadBalancer IP | ||
| LB_IP=$(kubectl get svc test-bgp-svc -n cilium-bgp-test -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
|
|
||
| # Get nodes with BGP label | ||
| BGP_NODES=$(kubectl get nodes -l cilium-bgp-peering=true -o name) | ||
|
|
||
| if [ -z "$BGP_NODES" ]; then | ||
| echo "No nodes found with label cilium-bgp-peering=true" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if IP is shared on each BGP node | ||
| for node in $BGP_NODES; do | ||
| NODE_ID=$(kubectl get $node -o jsonpath='{.spec.providerID}' | sed 's|linode://||') | ||
| echo "Node ID: $NODE_ID" | ||
|
|
||
| SHARED_IPS=$(curl -H "Authorization: Bearer $LINODE_TOKEN" \ | ||
| "https://api.linode.com/v4/linode/instances/$NODE_ID/ips" | \ | ||
| jq -r '.ipv4.shared[].address') | ||
| echo "shared IPs: $SHARED_IPS" | ||
|
|
||
| if ! echo "$SHARED_IPS" | grep -q "$LB_IP"; then | ||
| echo "LoadBalancer IP $LB_IP not found in shared IPs of node $node" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if the nanode has the shared IP | ||
| NANODE_ID=$(curl -H "Authorization: Bearer $LINODE_TOKEN" \ | ||
| "https://api.linode.com/v4/linode/instances" | \ | ||
| jq -r '.data[] | select(.label | endswith("e2e-test")) | .id') | ||
|
|
||
| NANODE_IPS=$(curl -H "Authorization: Bearer $LINODE_TOKEN" \ | ||
| "https://api.linode.com/v4/linode/instances/$NANODE_ID/ips" | \ | ||
| jq -r '.ipv4.public[].address') | ||
|
|
||
| if ! echo "$NANODE_IPS" | grep -q "$LB_IP"; then | ||
| echo "LoadBalancer IP not found in nanode (IP placeholder) IPs" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Delete the nanode | ||
| curl -X DELETE -H "Authorization: Bearer $LINODE_TOKEN" \ | ||
| "https://api.linode.com/v4/linode/instances/$NANODE_ID" | ||
|
|
||
| done | ||
| check: | ||
| ($error == null): true | ||
| (contains($stdout, 'LoadBalancer IP not found in shared IPs of node')): false | ||
| (contains($stdout, 'LoadBalancer IP not found in nanode IPs')): false | ||
|
|
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: test-pod-1 | ||
| labels: | ||
| app: test-bgp | ||
| spec: | ||
| containers: | ||
| - name: nginx | ||
| image: nginx:latest | ||
| ports: | ||
| - containerPort: 80 | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: test-bgp-svc | ||
| spec: | ||
| type: LoadBalancer | ||
| ports: | ||
| - port: 80 | ||
| targetPort: 80 | ||
| selector: | ||
| app: test-bgp |
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.
Uh oh!
There was an error while loading. Please reload this page.