Skip to content

Conversation

@shrutiyam-glitch
Copy link
Contributor

@shrutiyam-glitch shrutiyam-glitch commented Nov 20, 2025

Cloud Provider Kind
Cloud provider kind gateway helps in setting up the Gateway API Gateway resource within a KinD cluster, where the underlying implementation of that Gateway is handled by a cloud provider-like component designed for KinD, cloud-provider-kind(https://github.com/kubernetes-sigs/cloud-provider-kind/blob/main/README.md). This allows you to test and develop applications that utilize the Gateway API within a local KinD environment, with the Gateway behaving as if it were provisioned by a cloud provider.

After running the script ./run-test-kind.sh -

>kubectl get pods,svc,gateway,httproute
NAME                                             READY   STATUS    RESTARTS   AGE
pod/sandbox-router-deployment-7787dc8d67-4dp5q   1/1     Running   0          20m
pod/sandbox-router-deployment-7787dc8d67-97xh8   1/1     Running   0          20m

NAME                         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/kubernetes           ClusterIP   10.96.0.1      <none>        443/TCP    24m
service/sandbox-router-svc   ClusterIP   10.96.250.97   <none>        8080/TCP   20m

NAME                                             CLASS                 ADDRESS       PROGRAMMED   AGE
gateway.gateway.networking.k8s.io/kind-gateway   cloud-provider-kind   192.168.8.3   True         19m

NAME                                                       HOSTNAMES   AGE
httproute.gateway.networking.k8s.io/sandbox-router-route               19m

Python sdk tests related to gateway will be added in a following PR.

Previously tried methods - Contour gateway support for kind cluster (https://projectcontour.io/docs/1.33/guides/gateway-api/). It uses Envoy DaemonSet / Loadbalancer and requires port-forwarding.

@shrutiyam-glitch shrutiyam-glitch marked this pull request as draft November 20, 2025 22:50
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: shrutiyam-glitch
Once this PR has been reviewed and has the lgtm label, please assign janetkuo for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link

netlify bot commented Nov 20, 2025

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit b0f7503
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/6937b72b8ac9d6000739f2a5

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 20, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @shrutiyam-glitch. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 20, 2025
@janetkuo
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 21, 2025
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 26, 2025
@shrutiyam-glitch shrutiyam-glitch changed the title Contour gateway support for kind cluster Cloud-Provider-Kind gateway support for kind cluster Nov 26, 2025
@shrutiyam-glitch shrutiyam-glitch marked this pull request as ready for review December 1, 2025 13:57
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 1, 2025
@k8s-ci-robot k8s-ci-robot requested a review from janetkuo December 1, 2025 13:57
subprocess.run(cmd, cwd=repo_root, check=True, input=modified_content, text=True)


if args.gateway:
Copy link
Member

Choose a reason for hiding this comment

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

Starting a background host process inside deploy-to-kube is not the right way to go because it complicates lifecycle management (starting/stopping) and introduces dependencies into the deployment phase.

I suggest moving the cloud-provider-kind startup logic into gateway-kind/run-test-kind.sh or a dedicated setup script. This ensures the process is started specifically for the test session and cleaned up afterwards.

go_bin = os.path.expanduser('~/go/bin')
os.environ['PATH'] = f"{path}:{go_bin}"

print("Starting cloud-provider-kind in the background and enabling the Gateway API controller ...")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we take this to another dev/tool that specifically sets up the kube with the cloud provider gateway?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2025
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2025
Copy link
Contributor

@igooch igooch left a comment

Choose a reason for hiding this comment

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

Running into some issues when running the script locally:

~/agent-sandbox/clients/python/agentic-sandbox-client/gateway-kind$ ./run-test-kind.sh
...
========= ./run-test-kind.sh - Running the Python client tester... =========
Traceback (most recent call last):
  File "/usr/me/agent-sandbox/clients/python/agentic-sandbox-client/./test_client.py", line 17, in <module>
    from agentic_sandbox import SandboxClient
  File "/usr/me/agent-sandbox/clients/python/agentic-sandbox-client/agentic_sandbox/__init__.py", line 15, in <module>
    from .sandbox_client import SandboxClient
  File "/usr/me/agent-sandbox/clients/python/agentic-sandbox-client/agentic_sandbox/sandbox_client.py", line 26, in <module>
    from kubernetes import client, config, watch
ModuleNotFoundError: No module named 'kubernetes'
Cleaning up python-runtime and sandbox controller...
sandboxtemplate.extensions.agents.x-k8s.io "python-sandbox-template" deleted
statefulset.apps "agent-sandbox-controller" deleted
customresourcedefinition.apiextensions.k8s.io "sandboxes.agents.x-k8s.io" deleted
Deleting kind cluster...
make: *** No rule to make target 'delete-kind'.  Stop.
Cleanup completed.

echo "Applying CRD for router template"
sed -i "s|IMAGE_PLACEHOLDER|${SANDBOX_ROUTER_IMG}|g" sandbox_router.yaml
kubectl apply -f sandbox_router.yaml
sleep 60 # wait for sandbox-router to be ready
Copy link
Contributor

Choose a reason for hiding this comment

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

You can probably use kubectl rollout here since the sandbox router is a deployment.

Comment on lines 58 to 65
# echo "Setting up cloud-provider-kind for gateway ..."
# go install sigs.k8s.io/cloud-provider-kind@latest
# sudo install ~/go/bin/cloud-provider-kind /usr/local/bin

# echo "Starting cloud-provider-kind and enabling the Gateway API controller ..."
# cloud-provider-kind --gateway-channel standard &
# echo "Cloud Provider started."
# sleep 60
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these comments for?

Comment on lines 80 to 83
killall cloud-provider-kind
kubectl delete --ignore-not-found -f python-sandbox-template.yaml
kubectl delete --ignore-not-found statefulset agent-sandbox-controller -n agent-sandbox-system
kubectl delete --ignore-not-found crd sandboxes.agents.x-k8s.io
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're deleting the cluster there's no need to separately delete what's running on it.

kubectl delete --ignore-not-found crd sandboxes.agents.x-k8s.io
echo "Deleting kind cluster..."
cd ../../../../
make delete-kind || true
Copy link
Contributor

Choose a reason for hiding this comment

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

This didn't seem to work locally for me when running ./run-test-kind.sh:

:~/agent-sandbox/clients/python/agentic-sandbox-client/gateway-kind$ ./run-test-kind.sh
...
Deleting kind cluster...
make: *** No rule to make target 'delete-kind'.  Stop.
Cleanup completed.
~/agent-sandbox/clients/python/agentic-sandbox-client/gateway-kind$ kind get clusters
agent-sandbox

@@ -0,0 +1,99 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps a question for @janetkuo or @barney-s . Does it make sense to make this a go test file instead of a bash script?

My personal preference would be to make this a gateway_kind_test.go so that we can use features available to Golang like wait.PollUntilContextTimeout; not sure how that fits in to standards for this repo.

Copy link
Member

Choose a reason for hiding this comment

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

In this repo, we're experimenting with using Python for script, instead of bash (and remove .sh or .py so that it's easier to swap later). Using go would work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants