feat: new apply functionality#446
Draft
mfrancisc wants to merge 2 commits intocodeready-toolchain:masterfrom
Draft
feat: new apply functionality#446mfrancisc wants to merge 2 commits intocodeready-toolchain:masterfrom
mfrancisc wants to merge 2 commits intocodeready-toolchain:masterfrom
Conversation
… fashion so that we can use the kubectl functionality with streams.
|
mfrancisc
commented
Jan 28, 2025
| return nil, err | ||
| } | ||
|
|
||
| f := &replacedStdin{orig: os.Stdin} |
Contributor
Author
There was a problem hiding this comment.
why pointing os.File to os.Stdin ?
|
|
||
| f := &replacedStdin{orig: os.Stdin} | ||
|
|
||
| os.Stdin = stdinRead |
Contributor
Author
There was a problem hiding this comment.
again , I'm not sure I follow why we need this . Could we point stdinRead to *os.File directly ?
Also does this mean it's using a file for storing the data or it's using the stdin stream?
| os.Stdin = stdinRead | ||
|
|
||
| if _, err = io.Copy(stdinWrite, data); err != nil { | ||
| os.Stdin = f.orig |
Contributor
Author
There was a problem hiding this comment.
why setting back os.Stdin to f only on error ?
| orig *os.File | ||
| } | ||
|
|
||
| func pumpToStdin(data io.Reader) (*replacedStdin, error) { |
Contributor
Author
There was a problem hiding this comment.
could you please add a few comments explaining how the "trick" works ? I'm not 100% following all the swaps between the various variables ...
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
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.



THIS IS EXPERIMENTAL and the PR might be closed!
This is an attempt to leverage the kubectl apply package for applying objects on the clusters.
Unfortunately atm the package only supports applying from files and stdin, it doesn't support custom input.
See: kubernetes/kubectl#1670
wrt: KUBESAW-139