Coder Social home page Coder Social logo

Comments (8)

Toerq avatar Toerq commented on June 19, 2024 2

Hi there! I'm interested in working on implementing the --input feature and was exploring the proposed solution.

While going through the discussion, I noticed the suggestion of using two commands:

  1. k8sgpt analyze --save

  2. k8sgpt analyze --from-save <file_path>

I was wondering if the k8sgpt analyze --save command is intended to capture the cluster state using a similar approach as the following command:

kubectl get all --all-namespaces -o yaml > cluster_state.yaml

I'm thinking of implementing the functionality by:

Using k8sgpt analyze --save to save the initial state.

Modifying k8sgpt analyze to accept the saved YAML file as input through the --from-save flag.

That would be a great start, but double check if there are any missing needed resources when running "get all". I don't think you will get any custom CRD resources that might be relevant for instance.

It would also be great if you can choose to mask any sensitive values such as "secrets" when running the "--save" command.

from k8sgpt.

AlexsJones avatar AlexsJones commented on June 19, 2024 1

It's a really interesting idea, but there would be a lot of "State" to download and capture locally.
It's possible, but we would need to really think about how we're doing that.
There might well be a few phases e.g.

Storing the initial data

1. k8sgpt analyze --save

Retrieving from files

2. k8sgpt analyze --from-save

from k8sgpt.

Toerq avatar Toerq commented on June 19, 2024

It's a really interesting idea, but there would be a lot of "State" to download and capture locally. It's possible, but we would need to really think about how we're doing that. There might well be a few phases e.g.

Storing the initial data

1. k8sgpt analyze --save

Retrieving from files

2. k8sgpt analyze --from-save

This would be an excellent solution.
Do you have any idea of how long this would take to implement?

from k8sgpt.

AlexsJones avatar AlexsJones commented on June 19, 2024

I don't think it's difficult technically, just a little time consuming, because you'd need to pull all of the resources that we have analysers for. Probably one of the easiest ways would be to extend the analyser interface to explain the types it needs to go get, then iterate through that and store locally into files.

I would say it's a few days of work

from k8sgpt.

the-tech-pilot avatar the-tech-pilot commented on June 19, 2024

Hi there! I'm interested in working on implementing the --input feature and was exploring the proposed solution.
While going through the discussion, I noticed the suggestion of using two commands:

  1. k8sgpt analyze --save
  2. k8sgpt analyze --from-save <file_path>

I was wondering if the k8sgpt analyze --save command is intended to capture the cluster state using a similar approach as the following command:
kubectl get all --all-namespaces -o yaml > cluster_state.yaml

I'm thinking of implementing the functionality by:

Using k8sgpt analyze --save to save the initial state.
Modifying k8sgpt analyze to accept the saved YAML file as input through the --from-save flag.

from k8sgpt.

ronaldpetty avatar ronaldpetty commented on June 19, 2024

@the-tech-pilot how you doing on this? Anything you want to have peer reviewed or help with?

from k8sgpt.

harshanarayana avatar harshanarayana commented on June 19, 2024

@ronaldpetty @the-tech-pilot I have been working on getting something like this done for my internal use case and I got it working without too much of code changes using the client-go' fake client and prepend reactor.

harshanarayana@401ce5a

I would be more than happy to contribute a full working version of this if it is acceptable.

from k8sgpt.

harshanarayana avatar harshanarayana commented on June 19, 2024

Right now, In my case, the files are named as kubectl_get_<resource>_[--namespace_<ns>]_-o_yaml.log and a few lines at the tail end has metadata that I am stripping off.

from k8sgpt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.