Skip to content
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

Add support for uploading file via InputStream #3721

Closed
rohanKanojia opened this issue Jan 7, 2022 · 0 comments · Fixed by #3724
Closed

Add support for uploading file via InputStream #3721

rohanKanojia opened this issue Jan 7, 2022 · 0 comments · Fixed by #3724
Assignees
Milestone

Comments

@rohanKanojia
Copy link
Member

Is your enhancement related to a problem? Please describe

This was originally requested by @yaojiqunaer in #3568

Right now uploading a file to kubernetes pod requires file Path as an argument:

Boolean upload = client.pods().inNamespace("default")
          .withName("exwc796")
          .inContainer("nginxrokumar")
          .dir(destFile)
          .upload(source.toPath());

As suggested by @yaojiqunaer it would be nice to have an additional upload(InputStream in) method:

Upload method only support java.nio.file.Path as a local file path, if i use the org.springframework.web.multipart.MultipartFile uploaded files, are unable to get the file(getFile methord is forbit),so i must write multiPartFIle inputStrem to local disk and then read file as Path . Why not support both Path and InputStream?

Describe the solution you'd like

Add upload(InputStream in) method to Pod file upload DSL

Describe alternatives you've considered

No response

Additional context

No response

@rohanKanojia rohanKanojia self-assigned this Jan 7, 2022
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jan 7, 2022
Refactor PodUpload.upload implementation to expose a method which will
recieve InputStream which can be reused by newly added
upload(InputStream) method

Signed-off-by: Rohan Kumar <[email protected]>
@manusa manusa added this to the 5.12.0 milestone Jan 11, 2022
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jan 11, 2022
Refactor PodUpload.upload implementation to expose a method which will
recieve InputStream which can be reused by newly added
upload(InputStream) method

Signed-off-by: Rohan Kumar <[email protected]>
manusa pushed a commit that referenced this issue Jan 12, 2022
Refactor PodUpload.upload implementation to expose a method which will
recieve InputStream which can be reused by newly added
upload(InputStream) method

Signed-off-by: Rohan Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants