cli
cli copied to clipboard
Add `--kubernetes` flag to make dapr invoke cmd support kubernetes
Description
Support the invoke cmd on kubernetes mode.
The process is similar:
- Get the Pod corresponding to the App
- Complete the specific communication through the
SubResource("proxy")
ofRESTClient
- Direct access to App's
AppPort
port or access to daprd'sHttpPort
port
+-----------------+
| |
AppPort | +-------------+ |
+----------------------------> | APP | |
+----------+ | +-------------+ |
| dapr cli | | |
+----------+ | +-------------+ |
+----------------------------> | Daprd | |
HttpPort | +-------------+ |
| |
| pod |
+-----------------+
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[436] #[848]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:
- [x] Code compiles correctly
- [x] Created/updated tests
- [x] Extended the documentation
Can we add test case for this?
Sorry, just saw the reply.
Thank you tanvigour for review. I wrote part of the test code. There may be problems with code style or edge cases. Please review.
Welcome to add test cases.
There is a problem with using proxy
to access the HttpPort
, mainly because the address that daprd listens to is 127.0.0.1
, and the proxy cannot access this port.
So now our project(https://github.com/tkeel-io/cli/issues/74) uses portforward
for invoke
. The basic process is as follows:
- Get the Pod corresponding to the App
- Build a tunnel between the local and target pod through RESTClient's SubResource("portforward")
- Access daprd's
HttpPort
port through the local tunnel port
This part of the implementation needs to modify portforward.go
to implement random ports (https://github.com/dapr/cli/issues/863).
@imneov Can you signoff on your commits? https://github.com/dapr/cli/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-signing-your-work
@imneov Can you sign off all your commits ? https://github.com/dapr/cli/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-signing-your-work
@imneov Can you fix conflicts in the PR?
@imneov Can you fix conflicts in the PR?
Yes, I fix it.
Thanks for the changes ... We will try to review this soon ...
@imneov Can you fix the DCO check error please?
@imneov Can you fix the DCO check error please?
Done!
@imneov thanks for this PR, I would like to merge.
Please:
- Fix the minor linter issue that's causing the build to fail: https://github.com/dapr/cli/pull/862/files#diff-394f01f0edcfeaefbe1674ebeb954536600c800255e813c99ff5d94eba59e7a9R170
- Add usage instructions to
README.md
@imneov thanks for this PR, I would like to merge.
Please:
- Fix the minor linter issue that's causing the build to fail: https://github.com/dapr/cli/pull/862/files#diff-394f01f0edcfeaefbe1674ebeb954536600c800255e813c99ff5d94eba59e7a9R170
- Add usage instructions to
README.md
I was fixed the linter and try to add usage instructions.
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!
@pravinpushkar Please review this PR
@pravinpushkar Please review this PR
Looking at it now.
@imneov Please fix the small lint issue. PR looks fine. We need to update this here also to be in sync - https://docs.dapr.io/reference/cli/dapr-invoke/
ping @imneov
@imneov Please fix the small lint issue. PR looks fine. We need to update this here also to be in sync - https://docs.dapr.io/reference/cli/dapr-invoke/
Do I need to submit a PR for docs?
@imneov Please fix the small lint issue. PR looks fine. We need to update this here also to be in sync - https://docs.dapr.io/reference/cli/dapr-invoke/
@pravinpushkar Sorry I didn't find the lint error. what command do I need to run?
@imneov Please fix the small lint issue. PR looks fine. We need to update this here also to be in sync - https://docs.dapr.io/reference/cli/dapr-invoke/
@pravinpushkar Sorry I didn't find the lint error. what command do I need to run?
@imneov the lint error is available in this view https://github.com/dapr/cli/pull/862/files
(there is only one of such).
Codecov Report
Attention: Patch coverage is 69.60784%
with 31 lines
in your changes are missing coverage. Please review.
Project coverage is 28.60%. Comparing base (
619cd9c
) to head (f62550c
).
:exclamation: Current head f62550c differs from pull request most recent head 5ad56cc. Consider uploading reports for the commit 5ad56cc to get more accurate results
Files | Patch % | Lines |
---|---|---|
pkg/kubernetes/invoke.go | 69.60% | 24 Missing and 7 partials :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #862 +/- ##
==========================================
+ Coverage 22.55% 28.60% +6.05%
==========================================
Files 40 40
Lines 4758 4017 -741
==========================================
+ Hits 1073 1149 +76
+ Misses 3607 2784 -823
- Partials 78 84 +6
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@pravinpushkar HI~ Is there anything else I need to do?
@imneov Please fix the small lint issue. PR looks fine. We need to update this here also to be in sync - https://docs.dapr.io/reference/cli/dapr-invoke/
Do I need to submit a PR for docs?
Yes, If not done already then please create a doc issue and PR and link it here. I have triggered the PR checks let's see.
Support the invoke cmd on kubernetes mode.
OK , Thanks for you reply. @pravinpushkar
There is doc issue(https://github.com/dapr/docs/issues/2846) and PR(https://github.com/dapr/docs/pull/2847)
@pravinpushkar Hi~ Is there any work I need to do?
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!
@mukundansundar - What is happening with this issue/PR?