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

feat: add custom-analyzer cmd #1207

Merged
merged 13 commits into from
Aug 10, 2024

Conversation

matthisholleville
Copy link
Contributor

Closes #

📑 Description

Introduced the ability to manage custom analyzers in the K8sGPT application, enabling users to a
dd, deploy, and configure custom analyzers from various sources. This enhancement supports extending
the application's analytical capabilities by integrating external analysis tools, thus offering mor
e flexibility and customization options to meet specific user needs.

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

demo-custom-analyzers.mov

Introduced the ability to manage custom analyzers in the K8sGPT application, enabling users to add, deploy, and configure custom analyzers from various sources. This enhancement supports extending the application's analytical capabilities by integrating external analysis tools, thus offering more flexibility and customization options to meet specific user needs.

Signed-off-by: Matthis Holleville <[email protected]>
Introduced the ability to remove custom analyzers, streamlining the management process and ensuring flexibility in custom analyzer configuration. This enhancement addresses the need for dynamic customization and maintenance of analyzer setups, facilitating easier updates and modifications to the analysis environment.

Signed-off-by: Matthis Holleville <[email protected]>
…alyzers

Implemented a new list command within the customAnalyzer module to enable users to view all configured custom analyzers. This enhancement aims to improve usability by providing a straightforward method for users to inspect their custom analyzer configurations directly from the command line.

Signed-off-by: Matthis Holleville <[email protected]>
This update introduces commands to manage custom analyzers in the k8sgpt tool, enhancing flexibility and control over analyzer configurations without the need for direct installation or docker dependency.

Signed-off-by: Matthis Holleville <[email protected]>
@matthisholleville matthisholleville requested review from a team as code owners July 21, 2024 10:34
@DonCorleone92
Copy link

Just curious, does it support the analyzers with custom CRDs?

@matthisholleville
Copy link
Contributor Author

@DonCorleone92 you can develop your own analyzer logic, so yes, you can analyze any type of CRDs. You just need to integrate them into your analyzer logic. As for the AI provider, you can use the widely available ones ( like openai, ... ), but I recommend training a model with LocalAI using your custom CRDs. The AI's analysis recommendations will be more accurate this way.

@arbreezy
Copy link
Member

arbreezy commented Jul 21, 2024

Great PR @matthisholleville, i think we should support private registries as well

@matthisholleville
Copy link
Contributor Author

@arbreezy Shouldn't we refer to daemon authentication ( docker login ) instead?

@arbreezy
Copy link
Member

@arbreezy Shouldn't we refer to daemon authentication ( docker login ) instead?

Oh if it picks it up automatically, then it should be fine

@matthisholleville
Copy link
Contributor Author

Well spotted, @arbreezy ! Thanks to your comment, I noticed another issue. The version you reviewed never performed a pull. So, if the image was not available in the daemon's local registry, it could not be used. I updated it with a commit that pulls the image if it does not exist, while also adding authentication via username/password.

Added authentication support for pulling private Docker images when adding custom analyzers, enhancing security and access control.

Signed-off-by: Matthis Holleville <[email protected]>
@AlexsJones
Copy link
Member

We probably need an example of at least one custom analyzer wrapped in a docker container before we merge this

@AlexsJones
Copy link
Member

@matthisholleville I love the PR and the enthusiasm. I'd like you to break it up into two pieces please.
One should be the commands just to add/remove/update/list the config file that has custom_analyzer in it.

In the second PR we can discuss the "--pull" flag mechanics (what you've done in docker).

e.g.

k8sgpt analyzer add security_scanner_linux -p 8085 -h localhost  # or k8sgpt analyzer add security_scanner_linux --pull --p 8085 -h localhost"

@matthisholleville
Copy link
Contributor Author

@AlexsJones I removed Docker installation type

Removed the installation and deployment functionality for custom analyzers, streamlining the process of adding analyzers. This change focuses on simplifying the configuration by eliminating the need for specifying installation types, package URLs, and authentication details for Docker images. The goal is to enhance user experience by making the addition of custom analyzers more straightforward and less error-prone.

Signed-off-by: Matthis Holleville <[email protected]>
To ensure the integrity and consistency of analyzer names, we introduced a validation step that checks the format of the name against a predefined regex pattern. This change aims to prevent the creation of analyzers with invalid names, enhancing the system's reliability and usability.

Signed-off-by: Matthis Holleville <[email protected]>
Refactored the customAnalyzer package and its references to use consistent snake_case naming for improved code readability and alignment with Go naming conventions.

Signed-off-by: Matthis Holleville <[email protected]>
@AlexsJones AlexsJones merged commit db26d24 into k8sgpt-ai:main Aug 10, 2024
8 checks passed
ronaldpetty pushed a commit to ronaldpetty/k8sgpt that referenced this pull request Aug 17, 2024
* feat: add custom analyzer management capability

Introduced the ability to manage custom analyzers in the K8sGPT application, enabling users to add, deploy, and configure custom analyzers from various sources. This enhancement supports extending the application's analytical capabilities by integrating external analysis tools, thus offering more flexibility and customization options to meet specific user needs.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: enhance custom analyzer management with removal functionality

Introduced the ability to remove custom analyzers, streamlining the management process and ensuring flexibility in custom analyzer configuration. This enhancement addresses the need for dynamic customization and maintenance of analyzer setups, facilitating easier updates and modifications to the analysis environment.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: add list command to customAnalyzer for displaying configured analyzers

Implemented a new list command within the customAnalyzer module to enable users to view all configured custom analyzers. This enhancement aims to improve usability by providing a straightforward method for users to inspect their custom analyzer configurations directly from the command line.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: add support for listing, adding, and removing custom analyzers

This update introduces commands to manage custom analyzers in the k8sgpt tool, enhancing flexibility and control over analyzer configurations without the need for direct installation or docker dependency.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: support private docker image authentication for custom analyzers

Added authentication support for pulling private Docker images when adding custom analyzers, enhancing security and access control.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: remove Docker custom analyzer installation

Removed the installation and deployment functionality for custom analyzers, streamlining the process of adding analyzers. This change focuses on simplifying the configuration by eliminating the need for specifying installation types, package URLs, and authentication details for Docker images. The goal is to enhance user experience by making the addition of custom analyzers more straightforward and less error-prone.

Signed-off-by: Matthis Holleville <[email protected]>

* fix: remove unused packageUrl

Signed-off-by: Matthis Holleville <[email protected]>

* feat: update add command description to reflect broader functionality

Signed-off-by: Matthis Holleville <[email protected]>

* feat: Add name validation for custom analyzer creation

To ensure the integrity and consistency of analyzer names, we introduced a validation step that checks the format of the name against a predefined regex pattern. This change aims to prevent the creation of analyzers with invalid names, enhancing the system's reliability and usability.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: refactor customAnalyzer package for consistent naming

Refactored the customAnalyzer package and its references to use consistent snake_case naming for improved code readability and alignment with Go naming conventions.

Signed-off-by: Matthis Holleville <[email protected]>

---------

Signed-off-by: Matthis Holleville <[email protected]>
Signed-off-by: Ronald Petty <[email protected]>
AlexsJones pushed a commit that referenced this pull request Oct 24, 2024
* feat: add custom analyzer management capability

Introduced the ability to manage custom analyzers in the K8sGPT application, enabling users to add, deploy, and configure custom analyzers from various sources. This enhancement supports extending the application's analytical capabilities by integrating external analysis tools, thus offering more flexibility and customization options to meet specific user needs.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: enhance custom analyzer management with removal functionality

Introduced the ability to remove custom analyzers, streamlining the management process and ensuring flexibility in custom analyzer configuration. This enhancement addresses the need for dynamic customization and maintenance of analyzer setups, facilitating easier updates and modifications to the analysis environment.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: add list command to customAnalyzer for displaying configured analyzers

Implemented a new list command within the customAnalyzer module to enable users to view all configured custom analyzers. This enhancement aims to improve usability by providing a straightforward method for users to inspect their custom analyzer configurations directly from the command line.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: add support for listing, adding, and removing custom analyzers

This update introduces commands to manage custom analyzers in the k8sgpt tool, enhancing flexibility and control over analyzer configurations without the need for direct installation or docker dependency.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: support private docker image authentication for custom analyzers

Added authentication support for pulling private Docker images when adding custom analyzers, enhancing security and access control.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: remove Docker custom analyzer installation

Removed the installation and deployment functionality for custom analyzers, streamlining the process of adding analyzers. This change focuses on simplifying the configuration by eliminating the need for specifying installation types, package URLs, and authentication details for Docker images. The goal is to enhance user experience by making the addition of custom analyzers more straightforward and less error-prone.

Signed-off-by: Matthis Holleville <[email protected]>

* fix: remove unused packageUrl

Signed-off-by: Matthis Holleville <[email protected]>

* feat: update add command description to reflect broader functionality

Signed-off-by: Matthis Holleville <[email protected]>

* feat: Add name validation for custom analyzer creation

To ensure the integrity and consistency of analyzer names, we introduced a validation step that checks the format of the name against a predefined regex pattern. This change aims to prevent the creation of analyzers with invalid names, enhancing the system's reliability and usability.

Signed-off-by: Matthis Holleville <[email protected]>

* feat: refactor customAnalyzer package for consistent naming

Refactored the customAnalyzer package and its references to use consistent snake_case naming for improved code readability and alignment with Go naming conventions.

Signed-off-by: Matthis Holleville <[email protected]>

---------

Signed-off-by: Matthis Holleville <[email protected]>
Signed-off-by: AlexsJones <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants