With the addition of the latest changes, the missing test case when an
event happens after the currently set latest event has been covered.
Partially Addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
- Added missing test cases to ensure proper testing of the Ingress
analyzer. The addition of these missing test cases has increased the
code coverage of this analyzer to over 97%.
Partially Addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
* Added new tests for the `Node` analyzer defined in the `pkg/analyzer`
package.
* The addition of these new tests has increased the code coverage of the
node.go file to over 96%.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
- Added a network policy allowing traffic to all pods. Resulting in
additional failures in the results.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
- This commit removes unnecessary tests defined in the pkg/kubernetes
package.
- The removed tests were found to be flaky and were causing a
significant increase in CI time without adding much value to
the codebase.
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
* Added new tests for the `Service` analyzer defined in the
`pkg/analyzer` package.
* The addition of these new tests has increased the code coverage of the
service.go file to over 97%.
* Additionally addressed some flaky tests related to the `ReplicaSet`and
`PersisentVolumeClaim` analyzers.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Co-authored-by: Aris Boutselis <arisboutselis08@gmail.com>
- Removed test cases which required access to `/root` from the
`pkg/util` package.
- Fixed flaky `PodDisruptionBudget` test.
- Fixed a typo in `PersistentVolumeClaim` test.
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
* feat: add Google Vertex AI as provider to utilize gemini via GCP
Signed-off-by: Mario Fahlandt <mfahlandt@pixel-haufen.de>
* fix: adjust providerId description
Signed-off-by: Mario Fahlandt <mfahlandt@pixel-haufen.de>
---------
Signed-off-by: Mario Fahlandt <mfahlandt@pixel-haufen.de>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Aris Boutselis <arisboutselis08@gmail.com>
This commit introduces comprehensive tests for the
`PersistentVolumeClaim` analyzer defined in the `pkg/analyzer` package.
Adding these tests increases the code coverage of the `pvc.go` file to
>95%.
I also made minor modifications to the ReplicaSet test to ensure all
expectations were met.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
This commit introduces comprehensive tests for the `PodDisruptionBudget`
analyzer defined in the `pkg/analyzer` package.
Adding these tests increases the code coverage of the `pdb.go` file to
>96%.
Additionally, a potential crash in case of empty or nil PDB status
conditions has been addressed.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
This commit introduces comprehensive tests for the mutating webhook
analyzer defined in the `pkg/analyzer` package.
Adding these tests increases the code coverage of the
`mutating_webhook.go` file to almost 95%.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
This commit introduces comprehensive tests for the ReplicaSet analyzer
defined in the `pkg/analyzer` package.
Adding these tests increases the code coverage of the `rs.go` file to
>95%.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
This commit introduces comprehensive tests for the validating webhook
analyzer defined in the `pkg/analyzer` package.
Adding these tests increases the code coverage of the
`validating_webhook.go` file to almost 95%.
Partially addresses: https://github.com/k8sgpt-ai/k8sgpt/issues/889
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Now, the default value of the `backend` flag for the analyze command
will be an empty string. And the `NewAnalysis` function has been
modified to use the default backend set by the user if the backend flag
is not provided and the `defaultprovider` is set in the config file.
Otherwise, backend will be set to "openai".
Fixes: https://github.com/k8sgpt-ai/k8sgpt/issues/902
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Co-authored-by: JuHyung Son <sonju0427@gmail.com>
* chore: updated deps
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: adding aws types
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: first cut
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: first pass at aws integration with EKS
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: fixed linting
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated wording based on PR
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: improved the kubeconfig
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
This commit adds new unit tests for the `pkg/util` package bumping the
code coverage to 84%
Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
* Log analyzer failed with multiple containers in the pod #884
Signed-off-by: lwan3 <lili_wan@intuit.com>
* Merge conflicts from main
Signed-off-by: lwan3 <lili_wan@intuit.com>
---------
Signed-off-by: lwan3 <lili_wan@intuit.com>
Co-authored-by: lwan3 <lili_wan@intuit.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
* fix: set result name and namespace to trivy vulnreport and configauditreport
Signed-off-by: Johannes Kleinlercher <johannes.kleinlercher@suxess-it.com>
* fix: increase linter timeout
Signed-off-by: Johannes Kleinlercher <johannes@kleinlercher.at>
---------
Signed-off-by: Johannes Kleinlercher <johannes.kleinlercher@suxess-it.com>
Signed-off-by: Johannes Kleinlercher <johannes@kleinlercher.at>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
* feat: enables remote custom analyzers
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: fixed test that was broken
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: hiding custom analysis behind a flag
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: resolved govet issue
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated deps
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated deps
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: linting improvements and catching false positives
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: linting improvements and catching false positives
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: linting improvements and catching false positives
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: increase linter time out
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: wip interactive mode
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: tidied up a bit
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated go mod
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: const prompt
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated based on comments feedback
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated enum
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated enum
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: initial Prometheus analyzers
Added a prometheus integration with two analyzers:
1. PrometheusConfigValidate
2. PrometheusConfigRelabelReport
The integration does not deploy any Prometheus stack in the cluster.
Instead, it searches the provided --namespace for a Prometheus
configuration, stored in a ConfigMap or Secret. If it finds one, it
unmarshals it into memory and runs the analyzers on it.
PrometheusConfigValidate checks if the actual Prometheus configuration is valid or has
any errors.
PrometheusConfigRelabelReport tries to distill the scrape config
relabeling rules to give a concise label set per job that targets need
to have to be scraped. This analyzer is unconventional, in that it does
not necessarily mean there are issues with the config. It merely tries
to give a human-readable explanation of the relabel rules it discovers,
leaning on the LLM and prompt.
Tested on both kube-prometheus and Google Managed Prometheus
stacks.
Signed-off-by: Daniel Clark <danielclark@google.com>
* review: feedback cycle 1
Simplify ConfigValidate prompt and add comments.
Signed-off-by: Daniel Clark <danielclark@google.com>
* review: feedback cycle 2
Add Prometheus configuration discovery to integration activate command.
Also improve logging to make this more clear to users.
Signed-off-by: Daniel Clark <danielclark@google.com>
---------
Signed-off-by: Daniel Clark <danielclark@google.com>
* refactor: Simplified IAI; made caching and processing consisent.
Signed-off-by: bwplotka <bwplotka@gmail.com>
* feat: Added Google AI API e.g. for Gemini models.
Signed-off-by: bwplotka <bwplotka@gmail.com>
---------
Signed-off-by: bwplotka <bwplotka@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Thomas Schuetz <38893055+thschue@users.noreply.github.com>
* chore: added basic server startup test
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: refactored wg.add move
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Signed-off-by: swastik959 <Sswastik959@gmail.com>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
Signed-off-by: Johannes Kleinlercher <johannes@kleinlercher.at>
Signed-off-by: Thomas Schuetz <38893055+thschue@users.noreply.github.com>
Co-authored-by: Thomas Schuetz <38893055+thschue@users.noreply.github.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
* feat: wip log analyzer
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: turns off log by default
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: turns off log by default
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Thomas Schuetz <38893055+thschue@users.noreply.github.com>
* add amazonbedrock AI provider
Signed-off-by: Su Wei <suwei007@gmail.com>
* add amazonbedrock, change model list to const var
Signed-off-by: Su Wei <suwei007@gmail.com>
* update iai config and auth cmd, add providerRegion
Signed-off-by: Wei Su <wsuam@amazon.com>
* fix filename wrong
Signed-off-by: Wei Su <wsuam@amazon.com>
* chore: added some doc info
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Su Wei <suwei007@gmail.com>
Signed-off-by: Wei Su <wsuam@amazon.com>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Wei Su <wsuam@amazon.com>
Co-authored-by: Aris Boutselis <aris.boutselis@senseon.io>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
* feat: more significant refactor
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: more significant refactor
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: reworked the integration activate/deactivation
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated schema for list integrations
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* fix: error with incorrect error being swallowed
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: added namespace check
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: fixed issue with namespace and skip install validation
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: openAI explicit value for maxToken and temp
Because when k8sgpt talks with vLLM, the default MaxToken is 16,
which is so small.
Given the most model supports 2048 token(like Llama1 ..etc), so
put here for a safe value.
Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>
* feat: make temperature a flag
Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>
---------
Signed-off-by: Peter Pan <Peter.Pan@daocloud.io>
* chore: updated schema for integrations support (#616)
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
wip: enabling integration activation
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
wip: enabling integration activation
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* wip
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: skipinstall fixed
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: fixed filters for integrations but its ugly
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated library
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated go mod
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: updated go mod
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: show each ConfigAuditReport check
Signed-off-by: Johannes Kleinlercher <johannes@kleinlercher.at>
* feat: mask sensitive data in configauditreport messages
Signed-off-by: Johannes Kleinlercher <johannes@kleinlercher.at>
---------
Signed-off-by: Johannes Kleinlercher <johannes@kleinlercher.at>
* feat: adding config audit report
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
* feat: adding config audit report
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
* feat: adding config audit report analyzer mechnics
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
* feat: adding config audit report analyzer mechnics
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
* chore: updated naming
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
* chore: updated naming
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
* chore: updated var names
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
---------
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
Signed-off-by: cleverhu <shouping.hu@daocloud.io>
Signed-off-by: cleverhu <zhubai.hsp@xuelanyun.com>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: cleverhu <shouping.hu@daocloud.io>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
If user specify `--kubeconfig` when running k8sgpt, it should use the
kubeconfig file to login the corresponding cluster instead of getting auth info via SA.
Closes#604
Signed-off-by: Jian Zhang <jiazha@redhat.com>
* chore: fixing edge cases with missing wh service
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: fixing edge cases with missing wh service
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* Update validating_webhook.go
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Aris Boutselis <aris.boutselis@senseon.io>
The PDB event is a historical record, it's not a good choice to judge the pdb latest status based on it.
So, use the `stataus` instead of `event` to check it.
Closes: #476
Signed-off-by: Jian Zhang <jiazha@redhat.com>
* feat: added the ability to set a user default AI provider
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: added the ability to set a user default AI provider
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: s3 based caching
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: s3 based caching
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* updated README.md
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* update README.md
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* updated README.md
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: region is a must have
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: clarified remove command
* updated remove.go
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: test fmt causing issues will open another pr
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: added the ability to set a user default AI provider
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* feat: added the ability to set a user default AI provider
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* chore: added provider to json output
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
---------
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
* 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>
* fix: stop execution after matching condition in RunAnalysis()
The commit fixes the issue where the RunAnalysis() function continues execution even after matching a condition. The fix ensures that the execution stops at the end of the corresponding if statement, improving the control flow and preventing unnecessary processing.
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
* feat: include filters parameter in AnalyzeRequest initialization
The commit introduces a new feature where the filters parameter is included in the initialization of the AnalyzeRequest. This enhancement allows for more specific analysis by specifying filters during the analysis process.
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
---------
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
Before, the default value set for the `--kubeconfig` flag prevented the
`KUBECONFIG` env variable to be ever taken into consideration. This
behavior has now been fixed.
If `--kubeconfig` flag is set, it takes precedence over the `KUBECONFIG` env
variable.
fixes#331
Signed-off-by: Patrick Pichler <git@patrickpichler.dev>
Co-authored-by: Patrick Pichler <git@patrickpichler.dev>