k8s-deprec8tions-templ8r
Well that's a stupid name...
Yes, yes it is!
About
A simple tool to render Go templates from deprecations in the Kubernetes API schema.
Useful for crafting things like Rego policies to flag deprecations.
It works by downloading the Swagger file from the Kubernetes repo (version of your choice)
and inspecting each API/API property's description
field for occurrences of "deprecated". It then provides
some abstract objects you can build Go templates around to render this information as you please.
Usage
k8s-deprec8ions-templ8r -version v1.20.2 -template templates/kove.rego.gotmpl
or with the Docker image
docker run --rm -it \
-v $(pwd)/templates:/kdt/templates \
ghcr.io/cmacrae/k8s-deprec8ions-templ8r:v0.1.0 \
-path swagger -version v1.20.2 -template templates/kove.rego.gotmpl
Note: You must use -path swagger
with this image
Options
-force
Whether to force download the Kubernetes API Swagger file
-log-level string
Log level. Should be: debug, info, warn, error (default "info")
-path string
Path to read/download the Kubernetes API Swagger file (default same as 'version')
-template string
Path to the template to render
-version string
Kubernetes version to check for deprecations (default "master")
Implementations
Some example templates can be found in the templates/
directory.
The k8s-deprec8ions-templ8r template is used to provide policies for the k8s-deprec8ions-templ8r project: k8s-deprec8ions-templ8r-deprecations
Acknowledgements/Attributions
The meat of this code is based off kubepug, so a big thank you to @rikatz
for his work on a great tool!