-
Notifications
You must be signed in to change notification settings - Fork 34
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 a Starlark code generator #45
Merged
Merged
Conversation
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
Try it out: ``` isopod generate testdata/clusterrolebinding.yaml ``` Works with yaml or python. The code generator uses the kubernetes parser to get `runtime.Object`s. Reflect and a recursive function is used to generate the python code. The test covers all code by generating an entire file.
jonnylangefeld
force-pushed
the
jlf/starlark-code-generator
branch
4 times, most recently
from
May 20, 2020 16:14
4a2aa30
to
492529b
Compare
jonnylangefeld
force-pushed
the
jlf/starlark-code-generator
branch
from
May 20, 2020 16:20
492529b
to
6ac67b3
Compare
jonnylangefeld
force-pushed
the
jlf/starlark-code-generator
branch
from
May 20, 2020 16:39
a22bb9a
to
ba73ec8
Compare
This was referenced May 20, 2020
cxuu
reviewed
May 20, 2020
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.
This is so cool! Thank you for implementing this!
jonnylangefeld
force-pushed
the
jlf/starlark-code-generator
branch
from
May 20, 2020 20:40
306c141
to
125c13e
Compare
the method in the previous commit didnt work, because the string slice was in a different order than the value slice. They had to be ordered at the same time. The solution now is to introduce a separate map, that maps from strinkKey => valueKey. Now its bullet proof.
cxuu
approved these changes
May 21, 2020
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.
Try it out:
Works with yaml or json.
The code generator uses the kubernetes parser to get
runtime.Object
s.Reflect and a recursive function is used to generate the starlark code.
The test covers all code by generating multiple files.
Fix #46
Supports CRD
Supports
kube.put
for now, so that's allk8s
resources. Should supportkube.put_yaml
later for custom resources