-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update the comment action in PR and README
- Loading branch information
Showing
3 changed files
with
157 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,63 @@ | ||
These scenarios are used by Github Workflow: [Publish Rendered Helm Chart Diff](../../../../.github/workflows/helm-loki-ci.yml). | ||
# Loki Helm Scenarios | ||
|
||
Each scenario is used as the values file for the Loki Helm chart to render Kubernetes manifests in `base` and `PR's` branch to compare the content and report the diff on Pull Request as a comment([example](https://github.com/grafana/loki/pull/14127#issuecomment-2348360828)). It gives the ability to the reviewer to understand how the changes in the chart modify resulting manifests. | ||
These scenarios are used by Github Workflow: [Publish Rendered Helm Chart Diff](../../../../.github/workflows/helm-diff-ci.yml). | ||
|
||
![img.png](images/img.png) | ||
Each scenario is used in a different job execution that will be used to deploy loki inside a K3D cluster in our github action workflow. | ||
|
||
The workflow reports three types of changes for each scenario: | ||
We deploy the scenario with the latest release and then we execute a helm diff with the current version in the workspace, the diff between the release deployed will be posted in the pull request inside a comment like [this](https://github.com/grafana/loki/pull/15734#issuecomment-2592439539) making clear to review. | ||
|
||
1. Added files - the manifests that are added in the current PR and that did not exist in `base` branch. | ||
>*NOTE*: the helm diff output file will be available for each scenario inside github action to download for 2 days, after this you may need to re-run the job if you would like to download the output files. | ||
![added.png](images/added.png) | ||
## Run scenarios locally | ||
|
||
All this process that we run in the CI can be done locally, the following steps would explain how. | ||
|
||
2. Modified files - the manifests that exist in both branches but the changes in PRs branch modify them. | ||
![modified.png](images/modified.png) | ||
## Requirements | ||
|
||
3. Removed files - the manifests that exist in `base` branch but do not exist in PRs branch. | ||
To run locally you will need the following tools in your local environment | ||
|
||
![removed.png](images/removed.png) | ||
* k3d or any kubernetes cluster | ||
* helm | ||
* [helm-diff plugin](https://github.com/databus23/helm-diff) | ||
|
||
## Run | ||
|
||
Make sure that you are pointing to the kubernetes cluster that you want to apply the chart and validate. | ||
|
||
Create a `${scenario}-values.yaml` file with the configuration that you would like to validate. | ||
|
||
Deploy in your kubernetes cluster the latest released version of the helm chart with your config file: | ||
|
||
```shell | ||
helm install --create-namespace loki-release grafana/loki -f ${scenario}-values.yaml | ||
``` | ||
|
||
Then run the helm diff plugin to compare the local helm chart to see the upgrade changes that will happen: | ||
|
||
```shell | ||
HELM_DIFF_USE_UPGRADE_DRY_RUN: true helm diff upgrade loki-release -f ${scenario}-values.yaml production/helm/loki | ||
``` | ||
|
||
The helm diff plugin will compare all manifests that are created in your local development kubernetes cluster and the generated by helm upgrade operation, the output will be printed in your terminal. | ||
|
||
### Configs for CSP specific | ||
|
||
To compare the changes specifically for a cloud provider the process is similar, the main difference that you will need to have access to the kubernetes cluster with the right permissions inside the cloud provider. | ||
|
||
In case that is not possible, the quick validation can be done in a different way, instead of deploy to the kubernetes cluster, we generate the manifests with helm like this: | ||
|
||
```shell | ||
helm template loki-release grafana/loki -f ${scenario}-values.yaml > release-manifest.yaml | ||
``` | ||
|
||
Then we make the same process with local chart version | ||
|
||
```shell | ||
helm template loki-release production/helm/loki -f ${scenario}-values.yaml > current-manifest.yaml | ||
``` | ||
|
||
As the last step you need to run a diff between both files: | ||
|
||
```shell | ||
diff current-manifest.yaml release-manifest.yaml | ||
``` |