-
Couldn't load subscription status.
- Fork 16
support lookups for pod names #16
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
Conversation
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
## Description Allows invocations like: `kubectl curl http://deployment/<deployment-name>` Instead of requiring `kubectl curl http://<pod-name>` With the latter format, you have to manually look up the pod name first. Supported workload resources: * `deployment` (abbreviation: `deploy`) * `statefulset` (abbreviation: `sts`) * `daemonset` (abbreviation: `ds`) ### Usage examples Previous requirement: ``` % kubectl curl -i -n ctlstore http://ctlstore-executive-shadow-568cd76f89-ggc2f:3000/status HTTP/1.1 200 OK Date: 2025年9月24日 20:16:09 GMT Content-Length: 0 % kubectl curl -i -n ctlstore ctlstore-executive-shadow-568cd76f89-ggc2f:3000/status HTTP/1.1 200 OK Date: 2025年9月24日 20:16:09 GMT Content-Length: 0 ``` Newly supported variations: ``` % kubectl curl -i -n ctlstore http://deploy/ctlstore-executive-shadow:3000/status HTTP/1.1 200 OK Date: 2025年9月24日 20:56:40 GMT Content-Length: 0 % kubectl curl -i -n ctlstore deploy/ctlstore-executive-shadow:3000/status HTTP/1.1 200 OK Date: 2025年9月24日 20:16:35 GMT Content-Length: 0 ```
zhou-hongyu
zhou-hongyu
approved these changes
Sep 24, 2025
erikdw
added a commit
that referenced
this pull request
Sep 24, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Allows invocations like:
kubectl curl http://deployment/<deployment-name>Instead of requiring
kubectl curl http://<pod-name>With the latter format, you have to manually look up the pod name first.
Supported workload resources:
deployment(abbreviation:deploy)statefulset(abbreviation:sts)daemonset(abbreviation:ds)Logic Wildness Note
I used ChatGPT to craft the logic -- having it deal with the non-standard URL format where we have a
/in the middle of the "hostname" is what makes it hairy. But I feel this is cleaner and easier to remember than if we took an extra CLI argument to distinguish which type of resource controller we are interrogating. (e.g.,--resource deployment).Note
I think we can adapt the logic to also aggressively search for resource names under each resource controller.
e.g., for
curl http://foobarwe could first see iffoobaris a pod, and if not we see if it's one of the supported resource controllers in this preference (preferring common app-level resource controller ofdeployment, then less commonlystatefulset, and very rarelydaemonset).Won't implement that in this PR though.
Usage examples
Previous requirement:
Newly supported variations:
Testing
Firstly, added unit tests.
Tested locally, see above examples. Also tested with
daemonsetandstatefulset: