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

Add audit logs to minikube logs output #10350

Merged
merged 10 commits into from
Feb 19, 2021
Merged

Conversation

spowelljr
Copy link
Member

@spowelljr spowelljr commented Feb 2, 2021

Implements: #10335

Implementation reads in audit logs from file, converts the logs from JSON to structs, converts the structs into table cells, and finally converts the cells into a formatted table. Also added minikube version to the audit logging.

==> Audit <==
|---------|-------------------|----------|--------------|---------|-------------------------------|-------------------------------|
| Command |       Args        | Profile  |     User     | Version |          Start Time           |           End Time            |
|---------|-------------------|----------|--------------|---------|-------------------------------|-------------------------------|
| start   | --alsologtostderr | minikube | powellsteven | v1.17.1 | Fri, 12 Feb 2021 12:58:01 MST | Fri, 12 Feb 2021 12:58:49 MST |
| logs    | --user=cat        | minikube | cat          | v1.17.1 | Fri, 12 Feb 2021 13:00:12 MST | Fri, 12 Feb 2021 13:00:27 MST |
| delete  | --all             | minikube | powellsteven | v1.17.1 | Fri, 12 Feb 2021 13:00:38 MST | Fri, 12 Feb 2021 13:00:42 MST |
|---------|-------------------|----------|--------------|---------|-------------------------------|-------------------------------|

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 2, 2021
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

pkg/minikube/audit/logFile.go Show resolved Hide resolved
pkg/minikube/logs/logs.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 4, 2021
@spowelljr spowelljr changed the title Added audit logs to minikube logs output Add audit logs to minikube logs output Feb 5, 2021
pkg/minikube/audit/entry_test.go Outdated Show resolved Hide resolved
pkg/minikube/audit/entry.go Outdated Show resolved Hide resolved
pkg/minikube/audit/report.go Outdated Show resolved Hide resolved
pkg/minikube/audit/entry.go Outdated Show resolved Hide resolved
pkg/minikube/audit/entry.go Outdated Show resolved Hide resolved
pkg/minikube/audit/report.go Outdated Show resolved Hide resolved
pkg/minikube/audit/report.go Outdated Show resolved Hide resolved
pkg/minikube/audit/report_test.go Show resolved Hide resolved
@medyagh
Copy link
Member

medyagh commented Feb 19, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Feb 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh, spowelljr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 19, 2021
@minikube-pr-bot
Copy link

kvm2 Driver
error collecting results for kvm2 driver: timing run 0 with Minikube (PR 10350): timing cmd: [/home/performance-monitor/.minikube/minikube-binaries/10350/minikube start --driver=kvm2]: starting cmd: fork/exec /home/performance-monitor/.minikube/minikube-binaries/10350/minikube: exec format error
docker Driver
error collecting results for docker driver: timing run 0 with Minikube (PR 10350): timing cmd: [/home/performance-monitor/.minikube/minikube-binaries/10350/minikube start --driver=docker]: starting cmd: fork/exec /home/performance-monitor/.minikube/minikube-binaries/10350/minikube: exec format error

@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 74.1s 67.4s 72.6s
Average time for minikube: 71.4s

Times for Minikube (PR 10350): 70.5s 68.5s 70.6s
Average time for Minikube (PR 10350): 69.9s

Averages Time Per Log

+--------------------------------------------+----------+---------------------+
|                    LOG                     | MINIKUBE | MINIKUBE (PR 10350) |
+--------------------------------------------+----------+---------------------+
| * minikube v1.17.1 on Debian               | 0.1s     | 0.0s                |
| 9.11 (kvm/amd64)                           |          |                     |
| * Using the kvm2 driver based              | 0.0s     | 0.0s                |
| on user configuration                      |          |                     |
| * Starting control plane node              | 0.0s     | 0.0s                |
| minikube in cluster minikube               |          |                     |
| * Creating kvm2 VM (CPUs=2,                | 43.8s    | 42.1s               |
| Memory=3700MB, Disk=20000MB)               |          |                     |
| ...                                        |          |                     |
| * Preparing Kubernetes v1.20.2             | 17.2s    | 16.9s               |
| on Docker 20.10.2 ...                      |          |                     |
|   - Generating certificates                | 1.8s     | 1.6s                |
| and keys ...                               |          |                     |
|   - Booting up control plane               | 5.4s     | 5.7s                |
| ...                                        |          |                     |
|   - Configuring RBAC rules ...             | 0.9s     | 0.9s                |
| * Verifying Kubernetes                     | 0.1s     | 0.1s                |
| components...                              |          |                     |
|   - Using image                            | 1.5s     | 1.5s                |
| gcr.io/k8s-minikube/storage-provisioner:v4 |          |                     |
| * Enabled addons:                          | 0.1s     |                     |
| default-storageclass,                      |          |                     |
| storage-provisioner                        |          |                     |
| * Done! kubectl is now                     | 0.0s     | 0.0s                |
| configured to use "minikube"               |          |                     |
| cluster and "default"                      |          |                     |
| namespace by default                       |          |                     |
+--------------------------------------------+----------+---------------------+

docker Driver
Times for minikube: 29.2s 32.7s 28.1s
Average time for minikube: 30.0s

Times for Minikube (PR 10350): 31.8s 27.2s 28.8s
Average time for Minikube (PR 10350): 29.3s

Averages Time Per Log

+--------------------------------------------+----------+---------------------+
|                    LOG                     | MINIKUBE | MINIKUBE (PR 10350) |
+--------------------------------------------+----------+---------------------+
| * minikube v1.17.1 on Debian               | 1.5s     | 0.2s                |
| 9.11 (kvm/amd64)                           |          |                     |
| * Using the docker driver                  | 0.6s     | 0.1s                |
| based on user configuration                |          |                     |
| * Starting control plane node              | 0.1s     | 0.1s                |
| minikube in cluster minikube               |          |                     |
| * Creating docker container                | 10.7s    | 11.6s               |
| (CPUs=2, Memory=3700MB) ...                |          |                     |
| * Preparing Kubernetes v1.20.2             | 15.9s    | 16.2s               |
| on Docker 20.10.2 ...                      |          |                     |
| * Verifying Kubernetes                     | 0.1s     | 0.1s                |
| components...                              |          |                     |
|   - Using image                            | 1.1s     | 0.9s                |
| gcr.io/k8s-minikube/storage-provisioner:v4 |          |                     |
| * Enabled addons:                          | 0.1s     | 0.1s                |
| storage-provisioner,                       |          |                     |
| default-storageclass                       |          |                     |
| * Done! kubectl is now                     | 0.0s     | 0.0s                |
| configured to use "minikube"               |          |                     |
| cluster and "default"                      |          |                     |
| namespace by default                       |          |                     |
+--------------------------------------------+----------+---------------------+

@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 72.3s 72.3s 71.7s
Average time for minikube: 72.1s

Times for Minikube (PR 10350): 70.4s 68.3s 68.3s
Average time for Minikube (PR 10350): 69.0s

Averages Time Per Log

+--------------------------------------------+----------+---------------------+
|                    LOG                     | MINIKUBE | MINIKUBE (PR 10350) |
+--------------------------------------------+----------+---------------------+
| * minikube v1.17.1 on Debian               | 0.1s     | 0.1s                |
| 9.11 (kvm/amd64)                           |          |                     |
| * Using the kvm2 driver based              | 0.0s     | 0.0s                |
| on user configuration                      |          |                     |
| * Starting control plane node              | 0.0s     | 0.0s                |
| minikube in cluster minikube               |          |                     |
| * Creating kvm2 VM (CPUs=2,                | 44.7s    | 42.1s               |
| Memory=3700MB, Disk=20000MB)               |          |                     |
| ...                                        |          |                     |
| * Preparing Kubernetes v1.20.2             | 2.3s     | 2.1s                |
| on Docker 20.10.2 ...                      |          |                     |
|   - Generating certificates                | 4.5s     | 4.5s                |
| and keys ...                               |          |                     |
|   - Booting up control plane               | 16.5s    | 16.7s               |
| ...                                        |          |                     |
|   - Configuring RBAC rules ...             | 1.6s     | 1.4s                |
| * Verifying Kubernetes                     | 0.1s     | 0.1s                |
| components...                              |          |                     |
|   - Using image                            | 1.6s     | 1.6s                |
| gcr.io/k8s-minikube/storage-provisioner:v4 |          |                     |
| * Enabled addons:                          | 0.6s     | 0.5s                |
| storage-provisioner,                       |          |                     |
| default-storageclass                       |          |                     |
| * Done! kubectl is now                     | 0.0s     | 0.0s                |
| configured to use "minikube"               |          |                     |
| cluster and "default"                      |          |                     |
| namespace by default                       |          |                     |
+--------------------------------------------+----------+---------------------+

docker Driver
Times for minikube: 38.1s 26.9s 27.0s
Average time for minikube: 30.7s

Times for Minikube (PR 10350): 28.0s 26.8s 29.0s
Average time for Minikube (PR 10350): 28.0s

Averages Time Per Log

+--------------------------------------------+----------+---------------------+
|                    LOG                     | MINIKUBE | MINIKUBE (PR 10350) |
+--------------------------------------------+----------+---------------------+
| * minikube v1.17.1 on Debian               | 1.3s     | 0.2s                |
| 9.11 (kvm/amd64)                           |          |                     |
| * Using the docker driver                  | 0.2s     | 0.2s                |
| based on user configuration                |          |                     |
| * Starting control plane node              | 0.1s     | 0.1s                |
| minikube in cluster minikube               |          |                     |
| * Creating docker container                | 11.2s    | 10.4s               |
| (CPUs=2, Memory=3700MB) ...                |          |                     |
| * Preparing Kubernetes v1.20.2             | 16.7s    |                     |
| on Docker 20.10.3 ...                      |          |                     |
| * Verifying Kubernetes                     | 0.1s     | 0.1s                |
| components...                              |          |                     |
|   - Using image                            | 1.0s     | 0.9s                |
| gcr.io/k8s-minikube/storage-provisioner:v4 |          |                     |
| * Enabled addons:                          | 0.1s     | 0.1s                |
| storage-provisioner,                       |          |                     |
| default-storageclass                       |          |                     |
| * Done! kubectl is now                     | 0.0s     | 0.0s                |
| configured to use "minikube"               |          |                     |
| cluster and "default"                      |          |                     |
| namespace by default                       |          |                     |
+--------------------------------------------+----------+---------------------+

@medyagh medyagh merged commit 26351ff into kubernetes:master Feb 19, 2021
@spowelljr spowelljr deleted the addAudit branch June 28, 2021 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants