Skip to content
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

Don't strip formatting when generating docs #159

Closed
poblahblahblah opened this issue May 19, 2021 · 4 comments
Closed

Don't strip formatting when generating docs #159

poblahblahblah opened this issue May 19, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@poblahblahblah
Copy link

Hello,

Love the project as it's super helpful.

One thing I am wanting to do is embed a valid example of a kubernetes manifest to illustrate how someone can fix a warning or a violation, e.g. if the rule is to check that the container is not running as root, I would like the policy documentation to look something like this:

# @title Containers should not run as root
#
# Containers should not run as root.
#
#  The following snippet is an example of how to satisfy this requirement:
#
# ```
# apiVersion: apps/v1
# kind: Deployment
# metadata:
#   name: redis
# spec:
#   template:
#     spec:
#       containers:
#         - name: redis
#           image: redis:6.2
#           securityContext:
#             runAsNonRoot: true
#             runAsUser: 1000
# ```
#
# @kinds apps/DaemonSet apps/Deployment apps/StatefulSet core/Pod

I can do this just fine, but the resulting markdown loses all formatting and renders the following snippet:

apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
template:
spec:
containers:
- name: redis
image: redis:6.2
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000

I'm not sure what is reasonable as I am fairly new to the tool, so any guidance would be appreciated.

@jalseth jalseth added the enhancement New feature or request label May 21, 2021
@jalseth
Copy link
Collaborator

jalseth commented May 21, 2021

Hi @poblahblahblah , thanks for opening this request. This is currently occurring because we trim the comments to make sure our @title etc. tags are recognized, even if someone accidentally has an extra space or similar.

This should be possible though, and definitely seems useful so we'll look into it.

@jpreese
Copy link
Collaborator

jpreese commented Jun 2, 2021

@poblahblahblah PR #168 should handle this request and it will be included in the next release!

@poblahblahblah
Copy link
Author

@jpreese That is excellent! Thank you so much!

@jpreese
Copy link
Collaborator

jpreese commented Jun 2, 2021

@poblahblahblah this has been released in v0.14.0 -- https://github.com/plexsystems/konstraint/releases/tag/v0.14.0

@jpreese jpreese closed this as completed Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants