Skip to content

Commit

Permalink
Add build and test steps to README for curated packages (#3683)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaanvi5 authored Sep 3, 2024
1 parent 67e5e3e commit 8c79f7c
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 14 deletions.
41 changes: 36 additions & 5 deletions docs/development/packages/update-helm-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@ Helm charts used in EKS-A Packages are required to go through a series of modifi

Note helm chart structure varies by repo, so use judgment while applying following changes.

## Generate patch files
## Generate/Update patch files

Helm charts modifications are done through patches. To do so, we perform the following procedures:
- clone the target helm chart repo locally;
- update helm charts locally (see details at next step); and
- generate patch files using [`git format-patch`](https://git-scm.com/docs/git-format-patch).
Follow these steps for changes to the patches folder:
* Checkout the desired tag on upstream repo and create a new branch on your local workspace.

* Review the patches under patches folder in this repo. Apply the required patches to the new branch in the local clone of upstream repo created in the above step.

* Run `git am -3 <path to patches>` on the upstream clone, it does automatic conflict resolution via a three-way merge, if conflicts cannot be resolved automatically, git will pause.

* Run `git status` to identify the files with conflicts manually resolve the merge conflicts in those files, then run git add <resolved-files> to stage the resolved files.

* Once all conflicts are resolved, run `git am --continue` to complete applying the remaining patches

* Remove any patches that are either merged upstream or no longer needed.

* Run `git format-patch <commit>`, where <commit> is the last upstream commit on that tag. Move the generated patches from under the upstream fork to the patches directory

## Update helm charts locally
### Update `values.yaml` file
Expand Down Expand Up @@ -61,3 +71,24 @@ Note in some helm charts, fields above in `yaml` files are not hardcoded values

For packages that include CRDs as well as custom resources, the CRDs must be deployed before the rest of the resources. CRDs can't be included in the `templates` directory because the result is a single yaml file applied once. To overcome this issue, CRDs must be defined in their own package under the `templates` directory. Once a CRDs package is ready, a dependency to that package can be declared in the package bundle definition. To add the dependency to the resulting bundle file, add `PACKAGE_DEPENDENCIES=X` to your package `Makefile` in build tooling. If both the CRDs and the actual chart are built from the same project, you'll have to use the same workaround as used in metallb which involves redefining the helm/build and helm/push targets.


### Testing
For testing locally run steps below
* Run `export IMAGE_REPO='public.ecr.aws/<registry_alias>'`
* Run `make images` to build any images associated with package
* Run `make helm/build` to build the helm chart
* Run `make helm/push` to push built chart to registry defined in `IMAGE_REPO` above

Once the package/chart is in your personal registry test package

Using helm

```
helm install {NAME} oci://{chart_registry}/{chart_repo} —version {chart_version} --set sourceRegistry={chart_registry}
```
Using EKSA CLI

1. Generate local bundle using [generatebundlefile](https://github.com/aws/eks-anywhere-packages/tree/main/generatebundlefile) utility
2. Install PackageBundle in eksa cluster `kubectl apply -f bundle.yaml`
3. Edit PackageBundleController in your eksa cluster to point to your local registry
4. Install the package using EKSA CLI as decribed [here](https://anywhere.eks.amazonaws.com/docs/packages/prometheus/addpro/)
14 changes: 12 additions & 2 deletions projects/goharbor/harbor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,23 @@ You can find the latest version of its images [on ECR Public Gallery](https://ga

1. Review releases and changelogs in upstream [code repo](https://github.com/goharbor/harbor) and [chart repo](https://github.com/goharbor/harbor-helm), and decide on new version.
1. Review the patches under `patches/` folder and remove any that are either merged upstream or no longer needed.
1. Patch generation:
1. Current patch information:
* `patches`:
1. 0001 patch includes changes from `make/photon/common/install_cert.sh`
1. 0002 patch includes changes from `make gen_apis`
1. 0003 patch is generated by bumping vulnerable packages versions followed by `go mod tidy` and `go mod vendor`
1. 0003 patch to update tag for tencentcloud-skd-go, tag mentioned in go.mod file doesn't exist.
* `helm/patches`:
1. 0001 patch includes changes for adding digest, namespace and imagepullsecret support


1. Update the `GIT_TAG` file to have the new desired version based on the upstream release tags, and update the [`HELM_GIT_TAG`](https://github.com/aws/eks-anywhere-build-tooling/blob/main/projects/goharbor/harbor/Makefile#L57) in Makefile accordingly so the versions of referenced images in the chart match what is in `GIT_TAG`.
1. Compare the old tag to the new, looking specifically for Makefile changes. Check the `build` target for any build flag changes, tag changes, dependencies, etc. Check that the manifest target has not changed, this is called from our Makefile.
1. Check the `go.mod` file to see if the golang version has changed when updating a version. Update the field `GOLANG_VERSION` in Makefile to match the version upstream.
1. Update checksums and attribution using make `run-attribution-checksums-in-docker`.
1. Update the version at the top of this `README`.
1. Run `make generate` to update the `UPSTREAM_PROJECTS.yaml` file.

To make changes to the patches folder, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#generate-patch-files)


To test the upgrade, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#Testing).
19 changes: 17 additions & 2 deletions projects/metallb/metallb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,23 @@ MetalLB is a virtual-ip provider for kubernetes services of type load balancer.
1. Review [releases notes](https://metallb.universe.tf/release-notes/)
* Any changes to the upstream configuration needs a thorough review + testing
* Deprecation or removal of any protocol must be considered breaking
1. Update the `GIT_TAG` file to have the new desired version based on the upstream release tags.
1. Verify the golang version has not changed.
1. Update the `GIT_TAG` and `GOLANG_VERSION` files to have the new desired version based on the upstream release tags.
1. Review the patches under `patches/` folder and remove any that are either merged upstream or no longer needed.
1. Current patch information:
* `helm/patches`:
1. 0001 patch add support for packages in chart.
1. Run `make build` or `make release` to build package, if `apply patch` step fails during build follow the steps below to update the patch and rerun build/release again.
1. Run `make generate` from the root of the repo to update the `UPSTREAM_PROJECTS.yaml` file.
1. Update the version at the top of this `README`.
1. Verify no changes have been made to the dockerfiles [speaker](https://github.com/metallb/metallb/blob/main/speaker/Dockerfile)
[controller](https://github.com/metallb/metallb/blob/main/controller/Dockerfile)
1. Run `make generate` from the root of the repo to update the UPSTREAM_PROJECTS.yaml file.

To make changes to the patches folder, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#generate-patch-files)


To test the upgrade, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#Testing).


#### Make target changes
1. Run `make add-generated-help-block` from the project root to update available make targets.
11 changes: 9 additions & 2 deletions projects/prometheus/node_exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ The [Prometheus Node Exporter](https://github.com/prometheus/node_exporter) is a
### Updates

#### Version changes
1. Update the `GIT_TAG` file to have the new desired version based on the upstream release tags.
1. Run `make generate` from the root of the repo to update the `UPSTREAM_PROJECTS.yaml` file.
1. Update the `GIT_TAG` and `GOLANG_VERSION` file to have the new desired version based on the upstream release tags.
2. Run `make build` or `make release` to build package, if `apply patch` step fails during build follow the steps below to update the patch and rerun build/release again.
3. Run `make generate` from the root of the repo to update the `UPSTREAM_PROJECTS.yaml` file.
4. Update the version at the top of this `README`.


To make changes to the patches folder, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#generate-patch-files)

To test the upgrade, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#Testing).

#### Make target changes
1. Run `make add-generated-help-block` from the project root to update available make targets.
23 changes: 20 additions & 3 deletions projects/prometheus/prometheus/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
![Version](https://img.shields.io/badge/version-v2.53.1-blue)
![Version](https://img.shields.io/badge/version-v2.54.0-blue)
![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiTldscmdZWkd6NzlhUHJBbFJDRzlMc3NmaGxBOFJlYWE1a3BsVG9KcXhldDRCK05PL0lxNmVVUi9odlMzdXZCYXFxWTBCOUZDbS91R21KL1c5VkdQQ004PSIsIml2UGFyYW1ldGVyU3BlYyI6Im94dGM3UFc0MGRDN0pyREIiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=main)

## **Prometheus**

[Prometheus](https://github.com/prometheus/prometheus) is an open-source monitoring solution for collecting and aggregating metrics as time series data.

### Periodic Reviews
Review [image releases](https://github.com/prometheus/prometheus/tags) periodically to identify new releases and decide on an update plan and an update schedule.
Review [image releases](https://github.com/prometheus/prometheus/tags) and [chart releases](https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus) periodically to identify new releases and decide on an update plan and an update schedule.

### Updates

#### Version changes
1. Update the `GIT_TAG` and `HELM_GIT_TAG` files to have the new desired version based on the upstream release tags.
1. Update the `GIT_TAG`, `HELM_GIT_TAG`, and `GOLANG_VERSION` files to have the new desired version based on the upstream release tags.
1. Review the patches under `patches/` folder and remove any that are either merged upstream or no longer needed.
1. Current patch information:
* `helm/patches`:
1. 0001 patch removes prometheus chart dependencies.
1. 0002 patch adds node exporter component.
1. 0003 patch adds changes to update image repo
1. 0004 patch adds changes to update namespace
1. 0005 patch add changes for pod update strategy due to config map changes
1. 0006 patch update values.yaml and adds values.schema.json
1. Run `make build` or `make release` to build package, if `apply patch` step fails during build follow the steps below to update the patch and rerun build/release again.
1. Run `make generate` from the root of the repo to update the `UPSTREAM_PROJECTS.yaml` file.
1. Update the version at the top of this `README`.


To make changes to the patches folder, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#generate-patch-files)


To test the upgrade, follow the steps mentioned [here](https://github.com/aws/eks-anywhere-build-tooling/blob/main/docs/development/packages/update-helm-charts.md#Testing).

#### Make target changes
1. Run `make add-generated-help-block` from the project root to update available make targets.

0 comments on commit 8c79f7c

Please sign in to comment.