399d1044328554a9caf79f24704f7f4ecd8f523b
[integration.git] / test / security / check_versions / README.md
1 # Kubernetes Binaries Versions Inspector
2
3 **Kubernetes Binaries Versions Inspector** (`k8s_bin_versions_inspector`) is a
4 python module for verifying versions of CPython and OpenJDK binaries installed
5 in the kubernetes cluster containers.
6
7 ## Commands
8
9 ### Install dependencies
10
11 To install dependencies for normal usage of script, run this command.
12
13 ```bash
14 pip3 install -r requirements.txt
15 ```
16
17 ### Code formatting
18
19 ```bash
20 black src tests
21 ```
22
23 ### Code static analysis
24
25 ```bash
26 pylint -d C0330 src
27 ```
28
29 ### Automatic tests
30
31 To running the automated tests is required to have properly configured
32 kubernetes cluster, which is in the virtual machine, that is containing
33 development environment.
34
35 ```bash
36 PYTHONPATH=src pytest -vv -s tests
37 ```
38
39 ### Removing caches
40
41 ```bash
42 find -name __pycache__   -exec rm -Rf {} +
43 find -name .pytest_cache -exec rm -Rf {} +
44 ```
45
46 ## Acceptable format
47
48 Example of the acceptable file format:
49
50 ```yaml
51 python:
52     - 3.6.9
53     - 3.7.3
54 java:
55     - 11.0.7
56 ```
57
58 ## Paths research
59
60 Commands to research for the paths
61 of the software binaries in multiple docker images:
62
63 ```bash
64 docker run --entrypoint /bin/sh python:buster   -c "which python"
65 docker run --entrypoint /bin/sh python:alpine   -c "which python"
66 docker run --entrypoint /bin/sh python:slim     -c "which python"
67 docker run --entrypoint /bin/sh python:2-buster -c "which python"
68 docker run --entrypoint /bin/sh python:2-alpine -c "which python"
69 docker run --entrypoint /bin/sh python:2-slim   -c "which python"
70 docker run --entrypoint /bin/sh ubuntu:bionic   -c "apt-get update && apt-get install -y python  && which python"
71 docker run --entrypoint /bin/sh ubuntu:bionic   -c "apt-get update && apt-get install -y python3 && which python3"
72 docker run --entrypoint /bin/sh openjdk         -c "type java"
73 ```
74
75 ## Todo
76
77 List of features, that should be implemented:
78
79 - Complete license and copyrights variables.
80 - Find a way, to safe searching of the container files from Kubernetes API.
81 - Parallelization of executing binaries on the single container.
82 - Parallelization of versions determination in multiple containers.
83 - Support for determination the old versions of OpenJDK (attribute `-version`).
84 - Deleting namespace from cluster in development environment (for example,
85   during cluster reset), cause hanging in namespace terminating state.
86 - Find a nicer way to extracting exit code from execution result.
87
88 ## Links
89
90 - <https://github.com/kubernetes-client/python>
91 - <https://github.com/kubernetes-client/python/issues/812>
92 - <https://success.docker.com/article/kubernetes-namespace-stuck-in-terminating>