-
Notifications
You must be signed in to change notification settings - Fork 13
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
Argo CD based repos support #18
Comments
Yeah, I would also like to see Argo repos. For people interested in contributing, if you write a Python scanners |
I want to work on this, but im not entirely sure there is a easy way to parse bjw-s and argo version because of how many ways you can set up deployments with argo. |
I think it is okay to assume a certain file structure, and filter out anything that doesn't match |
Hey @whazor! Could you please explain a bit how this is structured? I'm a little confused how the scanners would be used so if I were to add support, I need to understand how to test it. |
What does a scanner do.A scanner reads all the YAML files, parses the YAML files and in the end populates SQL tables. This results in two SQL dbs ( Inside the frontend I use the Sqlite database to create kubesearch. So if you have something like flux_helm_release.py, or even multiple scanners, then I can add the Argo support in the frontend. Combining data from multiple filesBecause sometimes you need data from two separate files for showing the page correctly. For example, with Flux we want to know more about the Helm repo related to the release. The scanners scan independently and in the end, the results are combined via SQL joins in the frontend. So if you create Scanner structureScanners go through multiple stages as it otherwise the entire process takes too long.
Per file:
Finally:
ImprovementsOne thing that Argo might need is to add the ability to parse other files based on previous files. Currently we don't do this as it is more complicated and it was not yet needed. Or having more information about the file name. This should be easier to add to the relevant methods. |
There are at least two ways argo apps with helm can be done. One of which is similar to Flux in a way, and the other not so much as it's basically just kustomize with helm support. How well does it currently handle multiple yaml documents in one file? |
The kustomize route would indeed be difficult currently as it needs the ability to parse files based upon other files. Each YAML doc per file gets processed separately, but the |
That's also needed for #24 |
#28 got merged, which got like a handful of Argo repos into kubesearch. One of the issues is that the YAML parser fails on Go templating stuff. I guess those would need to be filtered before parsing the YAML file. |
I did also say this: #28 (comment) And no it was not ready yet as it was a draft. |
Actually, Argo results are getting inserted into the DB. So great job on getting the first argo results in kubesearch 🎉 . In particular PixelJonas has a lot of parsed Argo applications. The parsing happens in For example: metadata:
name: '{{.cluster}}-guestbook'
spec:
project: my-project
source:
repoURL: https://github.com/infra-team/cluster-deployments.git
targetRevision: HEAD
path: guestbook/{{.cluster}}
destination:
server: '{{.url}}'
namespace: guestbook In YAML, the |
I still think we need a way to do multiple files, as there are definitely differences how Argo handles the ones that are inside the application definition which is why some people (like me) don't use this way. I'm not entirely sure what would be the best way to do that as the kustomize way could be also non argo repos.. |
I don't know if this makes sense to say here or it is what you are trying to achieve right now, the repository has to have at least one file with the apiVersion of ArgoCD. Then, we would find multiple ways of setting the apps like: helm, kustomize or raw k8s objects. My repository can be used as an example: https://github.com/pando85/homelab |
It checks all files for apiversion, kind and that the definition includes helm. Others will get ignored. Your repo doesn't seem to have any which match that so it will not come apart of the search currently despite their being some argo repos already. Raw k8s objects are pain to parse, so probably not happening. |
Then you are doing something wrong because my repository as same as others uses that kind of structure. It is a common pattern in Argo CD definitions. This is common to Argo projects but if it contains kind
Personally, I always use Kustomize or Helm. I think that it is the most common pattern and it can be the first thing to add. We could parse k8s objects in the future. |
Currently the scanners are simple and based on a single YAML document. I think it would be a quick win to actually remove Go templating code via Regex from a file before doing the YAML parse. I would say that multiple files via kustomize is still doable, but already more difficult to implement. As you need to do the bookkeeping on which files need to be parsed and when. Ideally it doesnt slow down the search script too much. But actually parsing Go/Helm templates is way too complicated. Especially as a lot of variables are not present or knowable. |
That may be true, but as we are interested in Helm values, it becomes not relevant. As the parts that are relevant are Application, kind and that it includes Helm, eg https://github.com/samip5/k8s-dev-cluster/blob/90458ea939e174146b3d5f41483d6d84a9b1e7e4/kubernetes/infra/controllers/tor/application.yaml#L15 at least for the moment. ApplicationSet wouldn't help if the same file doesn't have anything else of interest which is how this currently works. |
It is planned supporting Argo CD repositories like mine: https://github.com/pando85/homelab
It could be great as there are a part of the community that based they repos in Argo CD.
Thank you for this great tool. I used it a lot! 🚀
The text was updated successfully, but these errors were encountered: