|
1 | 1 | # Codefresh Helm Plugin |
2 | 2 |
|
3 | | -Use Codefresh [Helm](https://helm.sh) plugin to deploy a Helm chart into specified (by context) Kubernetes cluster. |
| 3 | +Use Codefresh [Helm](https://helm.sh) plugin to deploy a Helm chart into specified Kubernetes cluster. |
4 | 4 |
|
5 | 5 | ## Usage |
6 | 6 |
|
7 | | -Set required and optional environment variable and add the following step to your Codefresh pipeline: |
| 7 | +Set required and optional environment variable and add the following step to your Codefresh pipeline like so: |
8 | 8 |
|
9 | | -Example Variables: |
| 9 | +```yaml |
| 10 | +Helm Upgrade: |
| 11 | + image: 'codefresh/plugin-helm:2.8.0' |
| 12 | +``` |
| 13 | +
|
| 14 | +## Environment Variables |
| 15 | +
|
| 16 | +Name|Required|Description |
| 17 | +---|---|--- |
| 18 | +KUBE_CONTEXT|required|Kubernetes context to use (the name of the cluster as configured in Codefresh) |
| 19 | +CHART_NAME|required|Helm chart name to release (path to chart folder, or name of packaged chart) |
| 20 | +RELEASE_NAME|required|Helm release name |
| 21 | +NAMESPACE|required|target Kubernetes namespace |
| 22 | +TILLER_NAMESPACE|required|Kubernetes namespace where tiller is at |
| 23 | +CHART_VERSION|required|application chart version to install |
| 24 | +CHART_REPO_URL|required|Helm chart repository URL (overriden by injected Helm repository context) |
| 25 | +CUSTOMFILE_|optional|Values file to provide to Helm (as --file). see usage information below. |
| 26 | +CUSTOM_|optional|Value to provide to Helm (as --set). see usage information below. |
| 27 | +
|
| 28 | +## Helm Values |
| 29 | +
|
| 30 | +To supply value file, add an environment variable with the name prefix of `CUSTOMFILE_` (case *in*sensitive), and the value should point to an existing values file. |
| 31 | +To override specific values, add an environment variable with the name prefix of `CUSTOM_` (case *in*sensitive), and replace any `.` characters in the name with `_`. The value should be the value for the variable. |
| 32 | + |
| 33 | +Examples: |
| 34 | +```text |
| 35 | +CUSTOM_myimage_pullPolicy=Always |
| 36 | +# Codefresh Helm plugin will add option below to the 'helm update --install' command |
| 37 | +--set myimage.pullPolicy=Always |
| 38 | +
|
| 39 | +CUSTOMFILE_prod='values-prod.yaml' |
| 40 | +# Codefresh Helm plugin will add option below to the 'helm update --install' command |
| 41 | +--values values-prod.yaml |
| 42 | +``` |
| 43 | + |
| 44 | +If a variable contains a `_`, replace the `_` character with `__`. |
| 45 | + |
| 46 | +```text |
| 47 | +custom_env_open_STORAGE__AMAZON__BUCKET=my-s3-bucket |
| 48 | +# translates to ... |
| 49 | +--set env.open.STORAGE_AMAZON_BUCKET=my-s3-bucket |
| 50 | +``` |
| 51 | + |
| 52 | +## Kubernetes Configuration |
| 53 | + |
| 54 | +Add Kubernetes integration to Codefresh: `> Account Settings > Integration > Kubernetes`. From now on, you can use added Kubernetes cluster in Codefresh pipeline, addressing its context by the name you see in `Clusters` menu. |
| 55 | + |
| 56 | +## Example |
10 | 57 |
|
11 | 58 | The example below will run `helm upgrade` using Helm chart with the name `mychart` located in `https://helmrepo.codefresh.io/codefresh/helm` Helm chart repository using the `myrelease` Helm release name against `mycluster` Kubernetes cluster in the `mynamespace` Kubernetes Namespace. |
12 | 59 |
|
@@ -40,48 +87,3 @@ steps: |
40 | 87 | ... |
41 | 88 |
|
42 | 89 | ``` |
43 | | - |
44 | | -## Environment Variables |
45 | | - |
46 | | -| Variables | Required | Default | Description | |
47 | | -|----------------|----------|---------|-----------------------------------------------------------------------------------------| |
48 | | -| CHART_NAME | YES | | Helm chart name | |
49 | | -| RELEASE_NAME | YES | | Helm release name | |
50 | | -| KUBE_CONTEXT | YES | | Kubernetes context to use (Custom Cluster Name in Codefresh) | |
51 | | -| NAMESPACE | NO | | Target Kubernetes namespace | |
52 | | -| CHART_VERSION | NO | | Helm chart version to install | |
53 | | -| CHART_REPO_URL | NO | | Helm chart repository URL (Required unless code repository contains Helm chart) | |
54 | | -| DRY_RUN | NO | | Do a "dry run" installation (do not install anything, useful for Debug) | |
55 | | -| DEBUG | NO | | Print verbose install output | |
56 | | -| WAIT | NO | | Block step execution till installation completed and all Kubernetes resources are ready | |
57 | | -| TIMEOUT | NO | 5 Min | Wait Timeout | |
58 | | - |
59 | | -### Overriding Helm Variables |
60 | | - |
61 | | -Codefresh Helm plugin supports overriding Helm variables. |
62 | | - |
63 | | -To supply value file, add an environment variable with the name prefix of `CUSTOMFILE_` (case *in*sensitive), and the value should point to an existing values file. |
64 | | -To override specific values, add an environment variable with the name prefix of `CUSTOM_` (case *in*sensitive), and replace any `.` characters in the name with `_`. The value should be the value for the variable. |
65 | | - |
66 | | -Examples: |
67 | | -```text |
68 | | -CUSTOM_myimage_pullPolicy=Always |
69 | | -# Codefresh Helm plugin will add option below to the 'helm update --install' command |
70 | | ---set myimage.pullPolicy=Always |
71 | | -
|
72 | | -CUSTOMFILE_prod='values-prod.yaml' |
73 | | -# Codefresh Helm plugin will add option below to the 'helm update --install' command |
74 | | ---values values-prod.yaml |
75 | | -``` |
76 | | - |
77 | | -If a variable contains a `_`, replace the `_` character with `__`. |
78 | | - |
79 | | -```text |
80 | | -custom_env_open_STORAGE__AMAZON__BUCKET=my-s3-bucket |
81 | | -# translates to ... |
82 | | ---set env.open.STORAGE_AMAZON_BUCKET=my-s3-bucket |
83 | | -``` |
84 | | - |
85 | | -## Kubernetes Configuration |
86 | | - |
87 | | -Add Kubernetes integration to Codefresh: `> Account Settings > Integration > Kubernetes`. From now on, you can use added Kubernetes cluster in Codefresh pipeline, addressing its context by the name you see in `Clusters` menu. |
|
0 commit comments