-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: new apply functionality #446
base: master
Are you sure you want to change the base?
Conversation
… fashion so that we can use the kubectl functionality with streams.
Quality Gate passedIssues Measures |
return nil, err | ||
} | ||
|
||
f := &replacedStdin{orig: os.Stdin} |
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.
why pointing os.File to os.Stdin ?
|
||
f := &replacedStdin{orig: os.Stdin} | ||
|
||
os.Stdin = stdinRead |
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.
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 |
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.
why setting back os.Stdin to f only on error ?
orig *os.File | ||
} | ||
|
||
func pumpToStdin(data io.Reader) (*replacedStdin, error) { |
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.
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 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