-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ffd8cb
commit ebbaf1b
Showing
2 changed files
with
48 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# cis-yaml-to-md | ||
|
||
## Description | ||
|
||
This script parses YAML files from an input directory and generates corresponding Markdown files in an output directory using a Jinja2 template. | ||
|
||
This allows us to define a set of input files that contain CIS benchmarks and generate a complete report in Markdown format. | ||
|
||
## Usage | ||
|
||
1. Clone our fork of the kube-bench repository | ||
|
||
``` | ||
git clone [email protected]:canonical/kube-bench.git | ||
cd kube-bench && git checkout ck8s # TODO remove when merged | ||
cd .. | ||
``` | ||
|
||
2. Create a virtual environment | ||
|
||
``` | ||
python3 -m venv venv | ||
source /venv/bin/activate | ||
``` | ||
|
||
3. Install requirements | ||
|
||
``` | ||
pip install -r requirements.txt | ||
``` | ||
|
||
4. Run the script | ||
|
||
``` | ||
python3 cis-yaml-to-md.py --input-dir=./kube-bench/cfg/cis-1.24-ck8s --output-dir=../../../docs/src/_parts/cis/ | ||
``` | ||
|
||
You should see the following output: | ||
|
||
``` | ||
INFO:__main__:Rendered kube-bench/cfg/cis-1.24-ck8s/policies.yaml to ../../../docs/src/_parts/cis/policies.md. | ||
INFO:__main__:Rendered kube-bench/cfg/cis-1.24-ck8s/node.yaml to ../../../docs/src/_parts/cis/node.md. | ||
INFO:__main__:Rendered kube-bench/cfg/cis-1.24-ck8s/controlplane.yaml to ../../../docs/src/_parts/cis/controlplane.md. | ||
INFO:__main__:Rendered kube-bench/cfg/cis-1.24-ck8s/master.yaml to ../../../docs/src/_parts/cis/master.md. | ||
INFO:__main__:Rendered kube-bench/cfg/cis-1.24-ck8s/etcd.yaml to ../../../docs/src/_parts/cis/etcd.md | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Jinja2==3.1.4 | ||
PyYAML==6.0.1 |