Commit Graph

132 Commits

Author SHA1 Message Date
Matthis
f0d3f36f6d
fix: use coreAnalyzer if there are no filters selected and no active_filters (#432)
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-05-17 09:36:47 +01:00
Peter Pan
e66de8c4ce
chore: gofmt fix and enable in CI (#414)
* gofmt the files

Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>

* add UT and goFMT to PR Gate (Github Action for PR)

Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>

---------

Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
2023-05-15 06:53:59 +01:00
Peter Pan
ed73485d92
chore: make go-lint happy (#405)
Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>
2023-05-12 12:24:30 +01:00
Patrick Pichler
947e94f353 fix: use correct result slice for cronjob analyzer
Signed-off-by: Patrick Pichler <git@patrickpichler.dev>
2023-04-25 22:31:24 +02:00
Patrick Pichler
8adde6bf87 fix: report failure if network policy doesn't match any pods
Before, there was no failure reported by the netpol analyzer, if the
matcher on the policy doesn't match any pods.

Signed-off-by: Patrick Pichler <git@patrickpichler.dev>
2023-04-25 22:31:24 +02:00
Patrick Pichler
2616220935
fix: remove pointer to loop variable when searching the latest event to analyze (#328)
Having a pointer to a range variable will always yield the latest value
the loop sees. This leads to subtle bugs. To prevent this from
happening, the range variable was assigned to a temp variable, which is
then referenced as a pointer.

Signed-off-by: Patrick Pichler <git@patrickpichler.dev>
Co-authored-by: Patrick Pichler <git@patrickpichler.dev>
2023-04-25 11:06:45 +02:00
Thomas Schuetz
d0f7a1105f
chore: change license to Apache-2 (#313)
* chore: change license to Apache-2

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-04-21 19:46:31 +02:00
Peter Pan
3c7e0bba1d chore: analyze Pod ReadinessProbe faliure
Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>
2023-04-20 03:52:47 -04:00
Rakshit Gondwal
71732037fa
feat: improve HPA analyzer to check ScaleTargetRef resources (#283)
* feat: improve HPA analyzer to check ScaleTargetRef resources

Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>

* feat: modify tests

Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>

* feat: improve all ScaleTargetRef to check for resources

Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>

* test: add test cases for all ScaleTargetRef types

Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>

* refactor: use interface to avoid dupplication

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>

* test: add test case for NoResourceConfiguredForScaleTargetRef

Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>

---------

Signed-off-by: Rakshit Gondwal <rakshitgondwal3@gmail.com>
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
Co-authored-by: Matthis <99146727+matthisholleville@users.noreply.github.com>
2023-04-18 15:27:06 +02:00
Matthis
3d684a2af7
fix: deployment/cronjob namespace filtering (#290)
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-17 17:37:19 +02:00
Matthis
a3becc9906
feat: add server metrics (#273)
* feat: expose metrics path & init analyzer errors metrics

This commit add metrics path & the analyzer error metrics in the codebase. The changes have been made across all analyzers and include the addition of a new metric with label values for the analyzer's name, analyzed object's name, and namespace. The metric's value is set to the length of the analyzer objects failures.

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: add metric to cronjob & deployment & netpol

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: expose metric to NodeAnalyzer

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

---------

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-15 19:03:37 +02:00
Dominik Augustin
6247a1c0f3
feat: add node analyzer (#272)
Signed-off-by: Dominik Augustin <dom.augustin@gmx.at>
2023-04-14 15:08:47 +02:00
Alex Jones
ddb51c7af4 chore: removing field
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-14 09:14:45 +01:00
Alex Jones
19e1b94e7c feat: anoymization based on pr feedback
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-14 07:40:27 +01:00
Alex Jones
fe529510b6 feat: anoymization based on pr feedback
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-14 07:39:05 +01:00
Alex Jones
f9b25d9e85 chore: fixing up tests
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-13 21:48:33 +01:00
Alex Jones
498d454c17 chore: fixing up tests
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-13 21:44:33 +01:00
Alex Jones
23071fd2e6 chore: additional analyzers
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-13 21:25:41 +01:00
Matthis Holleville
c0afc0f5c9 feat: refactor integration to use Failure object
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-12 11:40:51 +02:00
Alex Jones
ced0de6448
Merge branch 'main' into feat/integrate
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-11 19:24:30 +01:00
Alex Jones
4d20f70fb4 chore: fixing filters
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-11 19:22:12 +01:00
Alex Jones
3682f5c7eb feat: integration ready for first review
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-11 19:22:12 +01:00
Alex Jones
c809af3f47 chore: Fixing broken tests
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-11 19:22:12 +01:00
Alex Jones
4984840de1 wip
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-11 19:22:06 +01:00
Alex Jones
80ac51c804 chore: compiling successfully
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-04-11 19:22:06 +01:00
Matthis Holleville
11326c1c5f feat: improve documentation & update hpa message
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-11 13:28:05 +02:00
Matthis Holleville
705d2a0dce fix: pdb test
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-10 23:44:16 +02:00
Matthis Holleville
30e33495e0 Merge branch 'main' into feature/add-anonymize-option 2023-04-10 23:12:30 +02:00
Matthis Holleville
d2a84ea2b5 feat: add anonymization flag
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-10 23:12:02 +02:00
HOLLEVILLE Matthis
a582d444c5
fix: use hpa namespace instead analyzer namespace (#230)
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-10 07:49:22 +02:00
Aris Boutselis
c8ba7d62d2
feat: add storage class names' check.
Signed-off-by: Aris Boutselis <aris.boutselis@senseon.io>
2023-04-07 21:39:14 +01:00
Aris Boutselis
c041ce2bbb
feat: introduce StatefulSet analyser.
Signed-off-by: Aris Boutselis <aris.boutselis@senseon.io>
2023-04-06 13:31:58 +01:00
Matthis Holleville
ba4d701681 fix: Spelling
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-05 16:06:35 +02:00
Matthis Holleville
a24d1f1b30 fix: fixed hpa tests after rebase
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-05 08:53:49 +02:00
Thomas Schuetz
8958a45b9b
Merge branch 'main' into feature/add-tests-to-hpa-analyzer 2023-04-05 08:40:35 +02:00
Thomas Schuetz
0195bfab30
chore: analyzer and ai interfacing (#200)
* chore: analyzer and ai interfacing

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

* fix: backend variable for aiProvider in cmd

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

* fix: changed folders for analyzers

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

* chore: renamed analyzers

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

* fix: fixed ingress tests after rebase

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

* fix: fixed ingress tests after rebase

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

---------

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-04-05 08:40:12 +02:00
Matthis Holleville
5a59abb55d feat: add tests for hpa analyzer
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-04 22:59:26 +02:00
Matthis Holleville
e27e9409dc feat: add tests for ingress analyzer && Use t.Fatalf to report a fatal error if RunAnalysis returns an unexpected error
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-04-04 01:08:53 +02:00
AlexsJones
44cc8f7ad6 feat: service test
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-04-02 21:24:04 +01:00
AlexsJones
35b838bfaf feat: adding unit testing and example
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-04-02 21:17:05 +01:00
AlexsJones
426f562be8 feat: analyzer ifacing
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-04-02 20:32:44 +01:00
Alex Jones
ea1ca44dba
Merge branch 'main' into feature/pdb-analyzer 2023-04-02 14:11:46 +01:00
Dominik Augustin
1190fe60fd fix: hpaAnalyzer analysis result is using wrong parent
Signed-off-by: Dominik Augustin <dom.augustin@gmx.at>
2023-04-02 15:05:07 +02:00
Dominik Augustin
ceff0084df fix: spelling of PodDisruptionBudget
Signed-off-by: Dominik Augustin <dom.augustin@gmx.at>
2023-04-02 14:57:24 +02:00
Dominik Augustin
532a5ce033 feat: add pda analyzer
Adds a PodDisruptionBudget analyzer, that checks if PDBs have matching
pods with their defined selector.

Signed-off-by: Dominik Augustin <dom.augustin@gmx.at>
2023-04-02 14:38:39 +02:00
Matthis Holleville
5dad75fbe9 feat: check if ScaleTargetRef is possible option
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-31 19:47:10 +02:00
HOLLEVILLE Matthis
4916fef9d6 fix: update client API call to use StatefulSet instead of Deployment
Co-authored-by: Dominik Augustin <yeahservice@users.noreply.github.com>
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-31 19:39:17 +02:00
Matthis Holleville
360387249f feat: add hpa analyzer and init additionalAnalyzers
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-31 18:22:01 +02:00
Matthis Holleville
3ed545f33f feat: rework filters
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-31 15:46:20 +02:00
Matthis Holleville
32ddf6691c feat: add & remove default filter(s) to analyze.
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-30 23:18:43 +02:00
HOLLEVILLE Matthis
6e17c9e285
feat: add filter command add "list" subcommand (#159)
* feat: add filter command add "list" subcommand to display available filters

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: create specific file to filterList

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: rename ListAnalyzers to ListFilters

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

---------

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-30 20:58:41 +02:00
HOLLEVILLE Matthis
b061566404
feat: add Ingress class validation (#154)
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-30 13:48:53 +02:00
Alex Jones
ab63bd0dd1
Merge branch 'main' into fix/ingress-object-meta-value 2023-03-30 08:49:48 +01:00
Alex Jones
548039ebe6 feat: improvement to analysis speed
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-03-30 08:19:35 +01:00
Aris Boutselis
bf49a51c62
fix: Change ObjectMeta value in Ingress analyser.
Signed-off-by: Aris Boutselis <aris.boutselis@senseon.io>
2023-03-30 00:10:19 +01:00
HOLLEVILLE Matthis
86c7e81e18
feat: add secret validation to ingress analyzer (#141)
This commit adds a check to the ingress analyzer that verifies whether the secret declared in the ingress exists on the cluster. This helps to ensure that only valid secrets are used in the ingress configuration.

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-29 20:36:50 +00:00
HOLLEVILLE Matthis
fe683b71b8
feat: init ingress analyzer (#138)
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
2023-03-29 18:27:05 +02:00
Alex Jones
b78ab3d9b5
feat: added namespace filter (#127)
* feat: added namespace filter

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>

* chore: Moved the explain bool out

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>

---------

Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-28 21:10:42 +02:00
AlexsJones
5890e3a79c fix: short term solution for exhaustion
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-28 14:00:50 +01:00
AlexsJones
6f90386fc9 feat: this stops service exiting the program
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-28 12:56:28 +01:00
Alex Jones
a270f7c89f
feat: enables overwriting of cache (#95) 2023-03-28 11:43:12 +02:00
AlexsJones
a194d4a509 chore: moved code
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-27 10:59:48 +01:00
AlexsJones
1bc839c48b wip fixing missing details
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-27 10:25:25 +01:00
Alex Jones
aa8203261f
Merge branch 'main' into feat/pvc 2023-03-26 16:22:13 +01:00
Thomas Schuetz
88d49ae21c
feat: added analysis for pvcs
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-25 23:25:21 +01:00
Thomas Schuetz
deebec629e Merge branch 'main' of github.com:k8sgpt-ai/k8sgpt into feat/endpoint_missing 2023-03-25 23:05:16 +01:00
Thomas Schuetz
14e85b08ff
feat: find parent objects and add information about them (#72)
* feat: find parent objects

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

* fix: missing parent when explain is used

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>

---------

Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-25 23:03:34 +01:00
Alex Jones
a1093dcfe4
feat: also fixes bug if the events feed is empty (#73)
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-25 22:59:15 +01:00
Thomas Schuetz
961fb6c555
feat: add service analysis
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-25 22:53:14 +01:00
Thomas Schuetz
9c7d55955b
fix: missing parent when explain is used
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-25 15:57:48 +01:00
Thomas Schuetz
b29c6e4582
feat: find parent objects
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-25 14:25:22 +01:00
Alex Jones
979f13f043
feat: initial json implementation (#68)
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-24 23:10:30 +01:00
Alex Jones
bdb2e739d4 interfaced out ai clients
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
2023-03-24 12:01:36 +00:00
Thomas Schuetz
8e6b9886ea Merge branch 'main' of github.com:k8sgpt-ai/k8sgpt into feat/rs_fail 2023-03-23 11:56:26 +01:00
Thomas Schuetz
8ac56e062b
feat: find replicaset errors
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 19:05:04 +01:00
AlexsJones
ca534b337a updated the guard on the event
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 15:17:59 +00:00
AlexsJones
f873cf317f reads the event stream to correlate against OOMKill events
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 15:13:34 +00:00
AlexsJones
e4f138dc00 adding performance optimisation through local caching
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 11:19:26 +00:00
AlexsJones
9409998884 merged main
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-22 09:38:45 +00:00
Thomas Schuetz
a307c132b3
chore: change module repo
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
2023-03-22 07:40:21 +01:00
AlexsJones
144617e20d first
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-21 21:23:59 +00:00
AlexsJones
365a5674ba restructure
Signed-off-by: AlexsJones <alexsimonjones@gmail.com>
2023-03-21 21:00:18 +00:00