You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the ability to convert a single K8s Object to a Pod Security Policy,
instead of reading all objects from a live cluster.
- Add spf13/cobra to add subcommands "inspect", which covers the
existing functionality, and "convert", which converts a single K8s
Object as a yaml file.
- Move the code that generates a PodSecurityPolicy from lists of
ContainerSecuritySpec/PodSecuritySpec to a standalone package in
generator/generator.go. It only has a few minor changes:
- It has a struct so it's more like an object than a standalone
function.
- The provided service account is optional. When not provided
e.g. nil, "secret" is always added as an allowed volume type.
- When used by the converter, the namespace and serverGitVersion
are set to default values "default" and "v1.11", which allows
enforcement of ReadOnly filesystems.
- Error handling at the top level is done by log.Fatalf instead of
panic(), to make problems like incorrect arguments a bit more
graceful.
- Add logging at least for the conversion path, showing the files that
are read and written at debug level.
Copy file name to clipboardExpand all lines: README.MD
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,14 @@
1
1
# Kube PodSecurityPolicy Advisor
2
2
3
+
kube-psp-advisor is a tool that makes it easier to create K8s Pod Security Policies (PSPs) from either a live K8s environment or from a single .yaml file containing a pod specification (Deployment, DaemonSet, Pod, etc).
4
+
5
+
It has 2 subcommands, `kube-psp-advisor inspect` and `kube-psp-advisor convert`. `inspect` connects to a K8s API server, downloads all Pod-related objects in a given namespace, and generates a PSP based on the properties of those objects. `convert` works without connecting to an API Server, reading a single .yaml file containing a object with a pod spec and generating a PSP based on the file.
6
+
3
7
## Build and Run locally
4
8
1.```make build```
5
-
2.```./kube-psp-advisor``` to generate Pod Security Policy based on running cluster configuration
6
-
3.```./kube-psp-advisor --report``` to print the details reports (why this PSP is recommended for the cluster)
9
+
2.```./kube-psp-advisor inspect``` to generate Pod Security Policy based on running cluster configuration
10
+
3.```./kube-psp-advisor inspect --report``` to print the details reports (why this PSP is recommended for the cluster)
11
+
4.```./kube-psp-advisor convert --podFile <path> --pspFile <path>``` to generate a PSP from a single .yaml file.
0 commit comments