|
| 1 | +--- |
| 2 | +template: main.html |
| 3 | +--- |
| 4 | + |
| 5 | +# `gitops/helmex-update` |
| 6 | +The `github/helmex-update` task can be used to update Helm values file in a GitHub repo. This task requires the Helm values file to conform to the [Helmex schema](../helmex-schema.md). This task is intended to be included in the finish action of an experiment. |
| 7 | + |
| 8 | +## Example |
| 9 | +The following is an experiment snippet with a `gitops/helmex-update` task. |
| 10 | + |
| 11 | +```yaml |
| 12 | +... |
| 13 | +spec: |
| 14 | + strategy: |
| 15 | + actions: |
| 16 | + finish: |
| 17 | + - task: gitops/helmex-update |
| 18 | + with: |
| 19 | + # GitHub repo containing the values.yaml file |
| 20 | + gitRepo: "https://github.com/ghuser/iter8.git" |
| 21 | + # Path to values.yaml file |
| 22 | + filePath: "samples/second-exp/values.yaml" |
| 23 | + # GitHub username |
| 24 | + username: "ghuser" |
| 25 | + # Branch modified by this task |
| 26 | + branch: "gitops-test" |
| 27 | + # Secret containing the personal access token needed for git push |
| 28 | + secretName: "my-secret" |
| 29 | + # Namespace containing the above secret |
| 30 | + secretNamespace: "default" |
| 31 | +``` |
| 32 | +
|
| 33 | +## Inputs |
| 34 | +| Field name | Field type | Description | Required | |
| 35 | +| ----- | ------------ | ----------- | -------- | |
| 36 | +| gitRepo | string | GitHub repo containing the `values.yaml` file. The repo needs to begin with the prefix `https://`. | Yes | |
| 37 | +| filePath | string | Path to the Helm values file, relative to the root of this repo. | Yes | |
| 38 | +| username | string | GitHub username. For organization account, this can also be an org name. | Yes | |
| 39 | +| branch | string | Branch to be updated by this task. Default value is `main`. | No | |
| 40 | +| secretName | string | This task requires [a personal access token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) in order to modify the GitHub repo. `secretName` is the name of the Kubernetes secret which contains this token. Default value is `ghtoken`. | No | |
| 41 | +| secretNamespace | string | Namespace where the above secret is located. Default value is the namespace of the experiment. | No | |
| 42 | + |
| 43 | +**Note:** The task above expects to find a key named `token` within the secret's `Data` section; i.e., `secret.Data["token"]` needs to be the GitHub personal access token. In addition, the `iter8-handler` service account in the `iter8-system` namespace needs to be given read permissions using RBAC rules for this secret. |
| 44 | + |
| 45 | +## Result |
| 46 | +The [version recommended for promotion](../../concepts/buildingblocks.md#version-promotion) by Iter8 will be promoted as the new baseline in the `values.yaml` file. Suppose the `values.yaml` file in the GitHub repo is the same as the one in [this example](../helmex-schema.md#example). |
| 47 | + |
| 48 | +=== "Baseline is promoted" |
| 49 | + Assuming baseline is recommended for promotion by Iter8, the new `values.file` in the GitHub repo after this task executes, will look as follows. Notice how the `dynamic` field differs between the two scenarios. |
| 50 | + |
| 51 | + ```yaml |
| 52 | + common: |
| 53 | + application: hello |
| 54 | + repo: "gcr.io/google-samples/hello-app" |
| 55 | + serviceType: ClusterIP |
| 56 | + servicePortInfo: |
| 57 | + port: 8080 |
| 58 | + regularLabels: |
| 59 | + app.kubernetes.io/managed-by: Iter8 |
| 60 | + selectorLabels: |
| 61 | + app.kubernetes.io/name: hello |
| 62 | +
|
| 63 | + baseline: |
| 64 | + name: hello |
| 65 | + selectorLabels: |
| 66 | + app.kubernetes.io/track: baseline |
| 67 | + dynamic: |
| 68 | + id: "mn82l82" |
| 69 | + tag: "1.0" |
| 70 | +
|
| 71 | + # even though there is an experiment section below, there will be |
| 72 | + # no Iter8 experiment in the cluster, since there is no candidate version |
| 73 | + experiment: |
| 74 | + time: 5s |
| 75 | + QPS: 8.0 |
| 76 | + limitMeanLatency: 500.0 |
| 77 | + limitErrorRate: 0.01 |
| 78 | + limit95thPercentileLatency: 1000.0 |
| 79 | + ``` |
| 80 | + |
| 81 | +=== "Candidate is promoted" |
| 82 | + Assuming candidate is recommended for promotion by Iter8, the new `values.file` in the GitHub repo after this task executes, will look as follows. Notice how the `dynamic` field differs between the two scenarios. |
| 83 | + |
| 84 | + ```yaml |
| 85 | + common: |
| 86 | + application: hello |
| 87 | + repo: "gcr.io/google-samples/hello-app" |
| 88 | + serviceType: ClusterIP |
| 89 | + servicePortInfo: |
| 90 | + port: 8080 |
| 91 | + regularLabels: |
| 92 | + app.kubernetes.io/managed-by: Iter8 |
| 93 | + selectorLabels: |
| 94 | + app.kubernetes.io/name: hello |
| 95 | +
|
| 96 | + baseline: |
| 97 | + name: hello |
| 98 | + selectorLabels: |
| 99 | + app.kubernetes.io/track: baseline |
| 100 | + dynamic: |
| 101 | + id: "8s72oa" |
| 102 | + tag: "2.0" |
| 103 | +
|
| 104 | + # even though there is an experiment section below, there will be |
| 105 | + # no Iter8 experiment in the cluster, since there is no candidate version |
| 106 | + experiment: |
| 107 | + time: 5s |
| 108 | + QPS: 8.0 |
| 109 | + limitMeanLatency: 500.0 |
| 110 | + limitErrorRate: 0.01 |
| 111 | + limit95thPercentileLatency: 1000.0 |
| 112 | + ``` |
0 commit comments