Commit Graph

44 Commits (df28e73bfca19c78dd817b977b630587463e15ff)

Author SHA1 Message Date
Arvind Iyengar b09c01410f
Bump scripts version to v0.3.1 2022-01-05 17:14:18 -08:00
Arvind Iyengar b78f0c2784
make template 2022-01-04 13:30:33 -08:00
Arvind Iyengar e7259e7127
Bump charts-build-scripts version to v0.3.0 2022-01-03 16:07:33 -08:00
Arvind Iyengar 7b3d868ac7
Delete old README.mds and old scripts 2022-01-03 16:06:32 -08:00
Arvind Iyengar e8d80d248c
Regenerate template based on v0.2.0 release
```bash
make template
```
2021-05-17 15:54:09 -07:00
Arvind Iyengar b58090455d
Update pull-scripts and version
(cherry picked from commit 81d438ab55)
2021-05-17 15:53:08 -07:00
Arvind Iyengar d0a006101b
Point to dev-v2.6 and run make docs 2021-03-30 16:35:01 -07:00
Arvind Iyengar 740f7c76fe
Bump version to v0.0.4 2021-02-08 13:36:36 -08:00
Arvind Iyengar d96f2ea01d
Bump scripts version to v0.0.3 2021-02-01 13:16:59 -08:00
Arvind Iyengar 8873620b68
Use rancher/charts-build-scripts 2021-01-22 08:58:20 -08:00
Arvind Iyengar 43eddc361b
Bump scripts to v0.0.2 2021-01-22 08:52:17 -08:00
Arvind Iyengar 5d7c4c2acd
Migrate to the new docs and scripts
This commit just adds new files for the new scripts and modifies the README.md.

Signed-off-by: Arvind Iyengar <arvind.iyengar@rancher.com>
2021-01-14 22:58:53 -08:00
Caleb Bron 2087de28b5 clean up main 2020-09-30 16:45:24 -07:00
Arvind Iyengar d52f614415 Add securityContext to assumeOwnership CRD charts 2020-09-20 16:38:26 -07:00
Arvind Iyengar b36f8abacf Allow trailing slashes in dependency repos
Related Issue: https://github.com/rancher/rancher/issues/28981
2020-09-17 18:32:04 -07:00
Arvind Iyengar 8dabbb441c Validate that CRDs exist only on a helm install
This commit introduces a slight change to the CRD chart templates in order to only run the check for whether CRDs exist in the cluster when a user uses `helm install`. On a `helm template`, no error will ever be thrown and on a `helm install --dry-run`, an error will only be thrown if the CRD is required as part of the chart installation (which is the default behavior of --dry-run either way).

The way it accomplishes this is by using the Helm lookup function; based on the [Helm 3 docs](https://helm.sh/docs/chart_template_guide/functions_and_pipelines/), the lookup function never gets called on a `helm install --dry-run` or a `helm template`, so the output of the lookup function will always be nil for those requests (i.e. the number of ClusterRoles returned will always be 0).

However, Kubernetes clusters have default ClusterRoles, so this ensures that CRDs are installed if at least one ClusterRole is returned (i.e. the most common setup).
2020-09-16 10:32:12 -07:00
Caleb Bron 68a1dfa588
Revert "Generate asset on different branch" 2020-09-10 15:12:51 -07:00
Daishan Peng 65b9bc61c1
Merge pull request #605 from StrongMonkey/branch-asset
Generate asset on different branch
2020-09-10 12:22:29 -07:00
Daishan 15924a6862 Generate assets on ${branch}-assets branch 2020-09-10 10:50:00 -07:00
aiyengar2 7d32212d2c
Merge pull request #595 from aiyengar2/change_crd_ownership
Add generateCRDChart.assumeOwnershipOfCRDs flag
2020-09-09 16:08:08 -07:00
Arvind Iyengar 9b28515507 Add generateCRDChart.assumeOwnershipOfCRDs flag
This commit adds a new flag to the experimental feature of generating a CRD chart for charts that need to be able to assume the ownership of any existing CRDs within a cluster. It also modifies the existing `prepare-crd` script to use template files stored in the `./scripts/chart-templates/` directory instead of utilizing numerous `cat` commands in order to achieve the same result.

Feature charts with this flag enabled will differ from the normal CRD chart in the following ways:
- Instead of having CRDs from `crd/` in `templates/`, they will be relocated to `crd-manifest/`.
- On render, the CRDs in `crd-manifest` are placed into a ConfigMap that will be deployed on the cluster.
- On install / upgrade / rollback, a pre-install / pre-upgrade / pre-rollback hook Job that does a `kubectl apply -f` on the manifest within the crd-manifest ConfigMap (with appropriate RBAC credentials via a ServiceAccount, CRB, and ClusterRole) will install the CRDs onto the cluster.
- On uninstall, a delete hook Job does a `kubectl delete -f` on the manifest within the crd-manifest ConfigMap (with the same RBAC credentials) to remove the CRDs from the cluster.

At the moment, this will only be used by the `rancher-monitoring` chart.

Related Issue: https://github.com/rancher/rancher/issues/28326
2020-09-09 15:25:13 -07:00
Arvind Iyengar 746bac1d78 Add clean to end of validate script 2020-09-09 15:05:46 -07:00
Arvind Iyengar b3f18ae356 Fix url check when package.yaml does not exist 2020-09-09 12:27:17 -07:00
Arvind Iyengar fb3fe857d4 Update validate and clean script to use clean-crds
By utilizing the `clean-crds` script, both `validate` and `clean` can cleanly deal with issues related to annotations added and files overlaid as part of the CRD chart process.
2020-09-09 12:26:01 -07:00
Arvind Iyengar a84d714801 Deprecate providesGVR flag
This commit deprecates the providesGVR flag used by charts in favor of charts adding this annotation directly to the patch of their chart (or their Chart.yaml).
2020-09-09 12:25:16 -07:00
Arvind Iyengar e7b2a3934b Move revert_crd_changes into a new script
Before, the logic for reverting a CRD chart was located in `generate-patch` since it was the only script that required these changes. Now that the same logic is required on a `make clean` in order to support reverting just the generateCRDChart changes from local charts, this commit moves that logic out to its own script `clean-crds`.

Based on discussion in https://github.com/rancher/charts/pull/607#discussion_r483288658.
2020-09-09 12:05:15 -07:00
Caleb Bron 92211af12a update how we manage dependency annotations 2020-09-04 20:46:44 -07:00
Brenda Rearden b395206a27 Add url check for package.yaml file, add to cleanup 2020-09-04 10:30:14 -07:00
Arvind Iyengar 804f97853c Allow patches on remote deps with fixed versions
This commit adds the ability to add patches on subcharts in `rancher/charts` that meet the following constraints:
- Must be a remote chart (i.e. the repo url cannot point to a `file://<path>`)
- Must have a fixed version number (since we need a consistent base to apply the patch on)

The following changes have been made to the scripts to faciliate this feature:

**prepare**

Only run the patch after preparing the subchart

**prepare-subcharts:**

Inital checks:
1. We only prepare the subcharts if the chart has a `requirements.yaml`.
2. Extract the patches that would be applied to the requirements.yaml and only apply that

Note: in the future, we need to add support for dependencies outlined in the Chart.yaml directory, which is currently the recommended approach for Helm 3 charts that use `apiVersion: v2`, but since none of our charts currently use that it is assumed that they will encode their dependencies in a `requirements.yaml` at the moment.

Generate special dependencies (overlay, package.yaml):
1. For dependencies that are mirrored (i.e. rancher-kiali-server, where the dependency itself is stored as a `package.yaml`) that have not generated a `charts/` directory yet, we recursively run the `prepare` script for them in order to generate the directories so that `helm dependency update` can pull them in. The assumption here is that there will be no circular dependencies, although there is no explicit check for this.
2. For dependencies that are overlaid, we perform the overlay so that `helm dependency update` operates as expected.

Pull in latest subcharts and update files:
1. Perform `helm dependency update` to update the `requirements.yaml` and `requirements.lock` with the latest subchart versions

Cleanup (overlay, package.yaml, patched requirements)
1. Remove overlaid dependencies since they won't be tracked in the patch
2. Run the `clean` script on the mirrored dependencies
3. Revert the patch on the requirements.yaml

Apply logic to enable / disable patching:
1. If a subchart is a local chart, leave it as a tgz so it will be ignored on patch
2. If a subchart does not have a fixed version number, leave it as a tgz so it will be ignored on patch
3. If neither of these are true, unarchive the tgz for the subchart and delete the tgz so it will be tracked by the patch

NOTE: since the dependency still exists as either a tgz or a directory, `generate-charts` will not break from this change.

**generate-patch:**

Loop through the local `charts/requirements.yaml` to update the `charts-original/charts` directory:
1. If a subchart is not a local chart, remove it as we don't need to check for patches against it
2. If a subchart does not have a fixed version number,  remove it as we don't need to check for patches against it
3. If neither of these are true, pull in the version number specified from the remote helm repo to track patches against it.

**Why does the version number need to be fixed?**:

In general, Helm chart owners can use wildcards within a `requirements.yaml` to specify the version of a subchart when a specific patch version does not necessarily need to be fixed. This is usually a great feature since that means that parent charts do not need to be updated in order for a `helm dependency update` to automatically pull in the latest versions of a dependency that do not break the parent chart; however, this causes an issue with patching subcharts since the base that the patch is applied on is not fixed.

Therefore, this commit only allows users to apply patches on subcharts that have a fixed subchart version specified in their `requirements.yaml`.

**Why can't we track local charts?**

If the chart is local to this repo, the assumption is that you should directly be making the changes to the chart.
2020-09-03 12:05:44 -07:00
Arvind Iyengar 013b9e0405 Split and reorder prepare for prepare-subcharts
This commit splits the subchart logic from the `prepare` script into a separate `prepare-subcharts` script and slightly modifies the prepare logic to generate CRD charts only after preparing subcharts and applying the patch file.
2020-09-03 12:05:44 -07:00
Arvind Iyengar d041c0d5c1 Fix remove_timestamp_from_diff in generate-patch
This commit resolves two issues that are found when working with charts:
- On a failed sed command for removing the timestamp, the patch also
fails to regenerate the CRD package. Since removing the timestamps on the patch
before or after generating the CRD package makes no difference, we can just
move the `remove_timestamp_from_diff` command to the end of the for loop.

- The sed command would fail depending on what type of sed you were using.
The easiest fix is to provide a backup file extension name like `.bak` and just
delete the file after generating it to have it work with both types of sed.

Related comment for second issue: https://github.com/rancher/dev-charts/pull/38#discussion_r458442691
2020-08-18 11:02:39 -07:00
Arvind Iyengar 45c2539d2a Revert "Fix remove_timestamp_from_diff in generate-patch"
This reverts commit ce3d7e2b86.
2020-08-18 10:56:01 -07:00
Arvind Iyengar ce3d7e2b86 Fix remove_timestamp_from_diff in generate-patch
This commit resolves two issues that are found when working with charts:
- On a failed sed command for removing the timestamp, the patch also
fails to regenerate the CRD package. Since removing the timestamps on the patch
before or after generating the CRD package makes no difference, we can just
move the `remove_timestamp_from_diff` command to the end of the for loop.
- The sed command would fail depending on what type of sed you were using.
The easiest fix is to provide a backup file extension name like `.bak` and just
delete the file after generating it to have it work with both types of sed.

Related comment for second issue: https://github.com/rancher/dev-charts/pull/38#discussion_r458442691
2020-08-18 10:46:00 -07:00
Caleb Bron cb3b2acebd Remove helm vendored dependencies from charts 2020-08-13 12:22:39 -07:00
Caleb Bron 943d41ec5b Run helm dependency on every chart 2020-08-11 16:30:13 -07:00
Caleb Bron c1ede43dc1 fix duplicate crd version add 2020-08-11 09:26:09 -07:00
Caleb Bron f6f0c3ddbe helm depency update on non package charts 2020-08-11 09:19:35 -07:00
Caleb Bron ef8a72e077 rancher-kiali-server init 2020-08-10 14:38:49 -07:00
Steven Crespo c973e986cd Update patch for mac compatibility 2020-08-06 13:14:29 -07:00
Arvind Iyengar b2eb4171f7 Move generated crd charts from docs/ to assets/ 2020-08-05 10:23:04 -07:00
Arvind Iyengar fcc8528186 Enable splitting CRDs to separate package
This commit adds script changes to automatically allow packages to split
the CRD components located in a crd/ directory into a separate package.

It also automatically adds in a validation yaml helper to the main package
to prevent a user from installing the base package without installing the crd
install package first.

Any package can enable the creation of a separate crd package by just adding
`splitCRDsIntoSeparatePackage: true` into the package.yaml, as shown in the
rancher-monitoring chart.
2020-08-04 10:40:45 -07:00
Arvind Iyengar 2343ccc9c5 Add flag to delete empty files on patch 2020-08-03 12:02:30 -07:00
Daishan cbf706c0bf Move fetch after cd command 2020-08-03 09:54:00 -07:00
Denise Schannon 44e16849c3 Initial commit 2020-07-29 15:59:02 -07:00