arlon
arlon copied to clipboard
Pre-flight diff
As a user implementing GitOps I would like to see the potential impact of applying a bundle or profile prior to applying them to the target cluster.
So that i can be fully informed of the changes that will be made when ArgoCD applies the bundle.
ArgoCD has a built in diff engine https://github.com/argoproj/gitops-engine/blob/master/pkg/diff/diff.go that can compare an ArgoCD App to its related source stored in GIt. This diff allows users to inspect the code when an app is out of sync. What it doesn’t do is expose the potential impact of delploying an ArgoCD App.
For example; If a user creates a bundle of RBAC policies and deploys them via ArgoCD they could potentially remove Role Bindings that ultimately break the cluster.
By building a pre-flight assesment diff users are better positioned to understand the impact of making a change.
The text based diff needs to be able to consume data from a running cluster and then compare it to objects stored in Git This feature needs to enable the following CLI based workflow.
New Pre-flight check
Run arlon pre-flight <<profile or bundle>> <<cluster>>
The CLI then collects the data form Git and the Cluster
The CLI generates a text based diff.
If multiple objects are present then the CLI should present each one by one.
The CLI should save the data for use later
Import Existing check
run arlon pre-flight -f <<existing data file>>
Diff is displayed
OSS Examples
Below are two open source diff engines that could be leveraged.
CLI based diff engine https://www.linuxlinks.com/diff-so-fancy-attractive-diffs-diff-highlight/
https://user-images.githubusercontent.com/51425288/171516023-ef7f6ca3-a55b-4662-a531-cb62b84b95a4.png
OR
https://www.linuxlinks.com/delta-viewer-git-diff-output/
Aha! Link: https://pf9.aha.io/features/ARLON-158
I have an app that does just this. I recently released a Github app called Infro that several companies use internally that allows Argo CD users to preview Kubernetes changes in Github pull requests before they merge. I’m providing it for free to open source projects (https://github.com/broersma-forslund/homelab/pull/158#issuecomment-1962289857 an example in the wild). Here’s a setup guide with links to documentation. It’s in early stages, so I’m sure there will be warts. All feedback is welcome!