-
Notifications
You must be signed in to change notification settings - Fork 111
Minor fixes #242
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
base: main
Are you sure you want to change the base?
Minor fixes #242
Conversation
✅ Deploy Preview for agent-sandbox canceled.
|
|
Hi @alex-akv. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
janetkuo
left a comment
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.
/lgtm
| * **Using Helm:** Similar to KRO, we can use Helm to create a client side composition of resources and use the helm-cli to manage it. | ||
|
|
||
| This example demonstrates the second approach, using KRO to define a new `AgenticSandbox` CRD that encapsulates a `Sandbox`, a `NetworkPolicy`, and a `Service`. | ||
| This example demonstrates the second approach, using KRO to define a new `AgentSandbox` CRD that encapsulates a `Sandbox`, a `NetworkPolicy`, and a `Service`. |
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.
AgenticSandbox is the correct CRD. Please revert changes in this file. This CRD is defined using KRO, see https://github.com/kubernetes-sigs/agent-sandbox/blob/main/examples/composing-sandbox-nw-policies/rgd.yaml#L13
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.
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.
Not all changes in this file are reverted. It should use AgenticSandbox instead of AgentSandbox. It is a separate CRD from the core CRD in this example.
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.
Got it, reverted in commit: 369112a
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: alex-akv The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/ok-to-test |
| # Composing Sandbox with Network Policies | ||
|
|
||
| The `Sandbox` API is a low-level primitive for creating secure sandboxes. In real-world scenarios, you often want to compose a `Sandbox` with other Kubernetes resources, such as `NetworkPolicy`, `Ingress` and `Service`, to create a more complete and secure "agentic sandbox" environment. | ||
| The `Sandbox` API is a low-level primitive for creating secure sandboxes. In real-world scenarios, you often want to compose a `Sandbox` with other Kubernetes resources, such as `NetworkPolicy`, `Ingress` and `Service`, to create a more complete and secure "agent sandbox" environment. |
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.
Please keep the original text here.
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.
Reverted the change in commit: f7e48e9
| kubectl get agenticsandboxes | ||
| kubectl get agenticsandboxes demo -o yaml | ||
| kubectl get AgenticSandboxes | ||
| kubectl get AgenticSandboxes demo -o yaml |
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.
It conventional to use lower cases in kubectl commands
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.
Using lower cases in commands now: f7e48e9
|
|
||
| ``` | ||
| kubectl delete agenticsandbox demo | ||
| kubectl delete AgenticSandbox demo |
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.
ditto
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.
Fixed in commit: f7e48e9
| - --ip=0.0.0.0 | ||
| - --port=8888 | ||
| - --notebook-dir=/home/jovyan/work | ||
| - --ServerApp.token='' |
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.
This disables authentication, which is a security risk if the pod is exposed.
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.
Warning users about this in commit: 782f53e
examples/jupyterlab/jupyterlab.yaml
Outdated
| - --ip=0.0.0.0 | ||
| - --port=8888 | ||
| - --notebook-dir=/home/jovyan/work | ||
| - --ServerApp.token='' |
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.
Same comment about security risks
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.
Warning users about this in commit: 782f53e
| namespace: default | ||
| type: Opaque | ||
| stringData: | ||
| token: "HF_TOKEN" # Replace with actual token or use --from-literal |
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.
It's better to document a kubectl create secret command in the doc rather than providing a Secret manifest here that requires editing.
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.
Updated approach in commit: f7e48e9
| memory: "4Gi" | ||
| ephemeral-storage: "1Gi" | ||
| securityContext: | ||
| runAsUser: 0 # Need root for chown |
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.
Is chown truly needed? Could you instead configure the init container to run as the jovyan user? Something like:
securityContext:
runAsUser: 1000There 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.
I did exactly that in commit: f7e48e9
barney-s
left a comment
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.
This is a solid addition to the examples. I have identified several areas for improvement:
- Maintainability: The manifests hardcode the Python 3.12 path. This will break if the base image is updated to a newer Python version.
- Correctness: The
jupyterlab.yamlmanifest appears to rely on a ConfigMap that it doesn't define. Also, theinitContainerin both manifests is missingPYTHONPATH, which will cause the download script to fail. - Security: The JupyterLab configuration disables XSRF checks and allows all origins. While acceptable for a demo, a warning is warranted.
- Consistency: The pre-download script misses the model used in the experiment notebook.
Please review the detailed comments below.
| ``` | ||
|
|
||
| ### 5. Use the Agent | ||
| ### 6. Use the Agent |
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.
Typo in the following block: interraction should be interaction.
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.
Fixed typo in commit: f7e48e9
| ``` | ||
| kubectl get agenticsandboxes | ||
| kubectl get agenticsandboxes demo -o yaml | ||
| kubectl get AgenticSandboxes |
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.
Conventionally, Kubernetes resource names in kubectl commands are lowercase (e.g., agenticsandboxes). Using CamelCase AgenticSandboxes is supported but unusual.
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.
Corrected in commit: f7e48e9
| echo "Installing Python dependencies to persistent storage..." | ||
| pip install --no-cache-dir \ | ||
| --target=/home/jovyan/.local/lib/python3.12/site-packages \ | ||
| -r /config/requirements.txt |
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.
The path /home/jovyan/.local/lib/python3.12/site-packages hardcodes the Python version (3.12). If the base image jupyterhub/k8s-singleuser-sample is updated to a version with a different Python version, this path will be incorrect. Consider determining the path dynamically or ensuring it matches the image's Python version.
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.
Pushed the change in commit: f7e48e9
| -r /config/requirements.txt | ||
|
|
||
| python /config/download_models.py /home/jovyan/.cache/huggingface | ||
|
|
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.
The initContainer installs packages to a custom target directory but does not set PYTHONPATH to include it. The execution of download_models.py (which imports huggingface_hub) will likely fail with an ImportError. Please add PYTHONPATH to the initContainer environment variables.
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.
Addressed in commit: f7e48e9
| echo "Initialization complete!" | ||
| env: | ||
| - name: HF_TOKEN | ||
| valueFrom: |
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.
The path /home/jovyan/.cache/huggingface is repeated in the command arguments. Consider using the $HF_HOME environment variable in the command for better maintainability (e.g., python ... $HF_HOME).
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.
Corrected in commit: f7e48e9
| echo "Installing Python dependencies to persistent storage..." | ||
| pip install --no-cache-dir \ | ||
| --target=/home/jovyan/.local/lib/python3.12/site-packages \ | ||
| -r /config/requirements.txt |
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.
Hardcoded Python version python3.12. See comment on jupyterlab-full.yaml.
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.
Fixed in commit: f7e48e9
examples/jupyterlab/jupyterlab.yaml
Outdated
| -r /config/requirements.txt | ||
|
|
||
| python /config/download_models.py /home/jovyan/.cache/huggingface | ||
|
|
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.
Missing PYTHONPATH in initContainer. See comment on jupyterlab-full.yaml.
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.
Taken care of in commit: f7e48e9
|
|
||
| volumes: | ||
| - name: init-files | ||
| configMap: |
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.
This manifest references a ConfigMap named jupyter-init-files in the volumes section, but unlike jupyterlab-full.yaml, this ConfigMap is not defined in this file. If applied as is, the Pod will fail to start. Please document that the ConfigMap must be created separately or include it here.
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.
This is intended - jupyterlab-full.yaml is including all the configmaps in it's yaml, while jupyterlab.yaml is minimalistic and istructs users in the README.md -> Method B: Modular Deployment -> to create the configmap using kubectl. Added comment on top of the jupyterlab.yaml in commit: f7e48e9
|
|
||
| if __name__ == "__main__": | ||
| model_names = [ | ||
| "Qwen/Qwen3-Embedding-0.6B", |
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.
This script only downloads Qwen/Qwen3-Embedding-0.6B. However, experiment.ipynb uses distilbert-base-uncased-finetuned-sst-2-english. If the sandbox is run in an environment without internet access, the experiment notebook will fail. Consider adding the model used in the experiment to this pre-download list.
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.
Added missing model in commit: f7e48e9
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 5, |
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.
The notebook contains execution outputs. It is generally recommended to clear outputs before committing notebooks to version control to keep the diff clean and reduce repository size.
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.
Removed outputs in commit: f7e48e9
|
@alex-akv: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions 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. I understand the commands that are listed here. |
No description provided.