Project: Monokle (App Definition and Development / Application Definition & Image Build)
File: compare-sync.md

The Compare & Sync functionality allows you to compare and synchronize two sets of resources. Each set of resources can be one of the following: Resources from your local manifest files. Resources from a cluster. Resources from the of a Helm Chart. Resources from the of a Kustomization. Here are some of the scenarios where Compare & Sync can help you: Compare local resources to the resources in your cluster AND: Deploy local resources to the cluster. Extract cluster resources to local. Compare resources between two clusters AND: Deploy resources from one cluster to another. Compare resources between a Helm Chart or Kustomization preview to a cluster AND: Deploy the output of the Helm chart to the cluster. Compare resources between a Helm Chart or Kustomization preview to your local resources AND: Extract resources from the preview to your local files. Compare the output of a Helm Chart using two different values files. Compare the output of two different Helm Charts. Compare the output of a Helm Chart to the output of a Kustomization. Compare two Kustomization outputs. To use Compare & Sync follow these steps: Browse to a folder containing manifests/Kustomizations/Helm charts. Press the Compare Resources button in the menu on the left: In the image below you can see an overview of the Compare & Sync modal with each section highlighted in a color that will be explained: The top bar, highlighted in <span style="color:red">red</span>, contains a checkbox to select all rows and then 4 numbered inputs: Search input for quickly filtering all rows by the name of the resources. Input for setting the default namespace that a resource should have if it's not already specified in it's yaml content. Dropdown for selecting different options of comparison: `View all` shows all resources from both left and right columns. `Only matching` will show only the resources that exist in both columns. `Only non-matching` will show resources that do not exist in either of the columns. `View left join` will show all resources from the left column, but only matching resources in the right

`View right join` will show all resources from the right column, but only matching resources in the left column. Filter button which opens a panel that contains more filtering options. Under the top bar, we have two columns which both have their own configuration panel. In the overview, the columns are already configured. Before configuring the columns, the UI will look like this: Each column can be configured to specify the source of the resources that will be loaded in that column. If we look back at the Overview image from above, the <span style="color:green">green</span> highlights show the following numbered inputs: The dropdown to choose the source type for that column. The options are: `Local` for loading the resources from the local files in the current project. `Cluster` for loading resources from a cluster. `Helm Preview` for loading the output of a Helm Chart dry run. `Kustomize Preview` for loading the output of a Kustomization dry run. Button for reloading the current resource set. Button for clearing the configuration of that column. An additional inputs that appears depending on the source type: For `Cluster`, this input will be a dropdown for selecting the desired context. For `Helm Preview`, there will be two inputs, one for choosing the Chart and one for choosing the Values file. For `Kustomize Preview` there will be one input for choosing the Kustomization file. After both columns are configured with the desired sources, the comparison will take place and you will be able to see the two sets of resources side by side (<span style="color:gold">yellow</span> color in the Overview image). Clicking on a resource name will open a read-only editor for a quick view of the resource content. The sections highlighted in <span style="color:#89CFF0">light blue</span> in the Overview image show the actions that can be done on the resources. In the middle <span style="color:blue">blue</span> section, each row of matching resources have the actions that can be applied to the resources. The Diff button appears only if there are differences between the two resources. The bottom buttons can be used for doing batch operations on the resources that are checked.