-
Notifications
You must be signed in to change notification settings - Fork 45
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
Use Renderer to generate the ConfigMap #2120
Use Renderer to generate the ConfigMap #2120
Conversation
Hello slaperche-scality,My role is to assist you with the merge of this Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list:
|
a8f24cd
to
d276aa4
Compare
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.
LGTM. One minor concern: the SLS renderer takes a content
object, whilst we often put multiple objects in a single SLS file as a YAML document stream (objects separated by ---
). This renderer could be more generalized by taking a list of objects as objects
and render them accordingly.
Good point, and shouldn't be too hard to support: I can add a new commit for that. |
We will need it to implement a YAML renderer. Refs: #2070 Signed-off-by: Sylvain Laperche <[email protected]>
Add a new serialization format: YAML. This can be used as base for an SLS serializer. In order to handle long string payload and binary content we add two helpers (`YAMLDocument.text` and `YAMLDocument.bytestring`) that use custom renderers in order to have a readable encoding (using `|` string block literal) and right encoding (use Base64 for binary contents). Refs: #2070 Signed-off-by: Sylvain Laperche <[email protected]>
PyYAML has type annotations provided by typeshed, but those are incomplete. The long term solution would be to improve the type annotations in typeshed, but for now we will selectively ignore the errors. Note that we can't simply ignore the whole YAML library (like we do for `docker` or `doit`) because it *has* type annotations. Trying to do so results in a mypy warning: note: unused 'type: ignore' comment Refs: #2070 Signed-off-by: Sylvain Laperche <[email protected]>
For now we define a SLS as a YAML file with optional shebang and list of imports. Since both YAML and SLS renderer uses YAML dump, we extract it into an helper. Refs: #2070 Signed-off-by: Sylvain Laperche <[email protected]>
Use the brand new SaltState serializer to generate the Dex ConfigMap. Get rid of the now useless helper that were used to manually generate YAML-encoded strings. Closes: #2070 Signed-off-by: Sylvain Laperche <[email protected]>
Refs: #2070 Signed-off-by: Sylvain Laperche <[email protected]>
d276aa4
to
be59122
Compare
Done, I've added support for list of objects. |
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.
Not 100% sure I'm 100% comfortable with this approach, since now we have an SLS in the Salt tree that's not represented by any file in the 'source' salt/
tree, but OK.
try: | ||
dumper.open() # type: ignore | ||
for document in data: | ||
dumper.represent(document) # type: ignore |
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.
I assume this then adds the ---
?
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.
Yes, I've tested locally.
And the code is highly inspired from official PyYAML code.
/approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
The following branches will NOT be impacted:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue None. Goodbye slaperche-scality. |
Component:
buildchain
Context:
We want to generate SLS from the buildchain, and we have to shove huge string inside it while trying to keep it readable AND have a valid YAML in the end.
Summary:
Instead of creating/formatting the SLS content by hand, let's use a YAML renderer.
Acceptance criteria:
You can build a working ISO
Closes: #2070