-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Allow creation from dict #795
Merged
k8s-ci-robot
merged 19 commits into
kubernetes-client:master
from
oz123:util-improvements
Jul 23, 2019
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
aa28bc7
Allow create from string or from dict
oz123 cee4e49
Rename create_from_map to create_from_dict, add tests
oz123 50ef874
Merge branch 'master' into util-improvements
oz123 18f45c9
Fix wrong import name
oz123 0779fc9
Fix collection of execptions when applying yaml
oz123 2b83c68
Fix for a flaky test failing because k8s is slow
oz123 8d41478
Explicitly use other deployment names for test
oz123 408d405
Handle StringIO for Python2 properly
oz123 38894cc
Fix import for StringIO
oz123 139848e
Relax pycodestyle: import only allowed at the top
oz123 f6566ee
Rename yml_document paramter and update documentation
oz123 3489838
Merge remote-tracking branch 'upstream/master' into util-improvements
oz123 4fa0e87
Correct the documentation for create_from_dict
oz123 5c912f9
Throw exception from create_from_dict
oz123 ed67d89
Remove un-necessary if block
oz123 9e40421
create_from_yaml function deals with files only
oz123 ab002f7
Remove obsolete test
oz123 6100392
Add optional namespace to create_from_dict
oz123 e867c29
Merge branch 'master' into util-improvements
oz123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
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.
It may be a bit odd to expect a yaml string as input.
Wrapping preexisting strings into file-like objects is normally done by the caller the reasoning being if you have already have stream you have to read it into memory just for the function to convert it back to a memory stream.
Wrapping a pre-existing memory object into a stream on the otherhand is cheap as it just boils down to a memory view.
The usual interface is file path or file-like object. a file-like is also still acceptable for the argument name yaml_file, while that name does not really fit for a string.
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.
The reason we want to support string input is that
kubectl create -f -
takes a stdin input. I know it's kinda weird since bash does not really have dicts, but the functionality is there...https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#create
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.
that kind of my point stdin is not a string, stdin is a file-like object
so to use this function like
kubectl create -f -
you callcreate_from_yaml(sys.stdin)
the mapping of a potential
-
commandline argument to stdin should be done by the caller