Skip to content

Commit 43713e6

Browse files
committed
chore: replace layer with resource-group
Signed-off-by: Evans Mungai <[email protected]>
1 parent 707dd26 commit 43713e6

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

hips/hip-00xx-sequencing.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,63 +34,66 @@ This design was chosen due to simplicity and clarity of how it works for both th
3434

3535
At a high level, allow Chart Developers to assign named dependencies to both their Helm templated resources and Helm chart dependencies that Helm then uses to generate a deployment sequence at installation time.
3636

37-
For Helm CLI, the `--wait=ordered` flag will enable sequencing where resources are applied in groups of layers. SDK users will also be able to enable sequencing by setting a `Wait` boolean flag. Without this flag being enabled, resources will all be applied all at once which is the same behaviour in Chart v2.
37+
For Helm CLI, the `--wait=ordered` flag will enable sequencing where resources are applied in groups. SDK users will also be able to enable sequencing by setting a `WaitStrategy` field. By default, resources are all applied at once which is the same behaviour in Chart v2.
3838

3939
Each release will store information of whether sequencing was used or not. This information is used when performing uninstalls and rollbacks.
4040

4141
The following annotations would be added to enable this.
4242

4343
*Additions to templates*
44-
- `helm.sh/layer`: Annotation to declare a layer that a given resource belongs to. Any number of resources can belong to a layer. A resource can only belong to one layer.
45-
- `helm.sh/depends-on/layers`: Annotation to declare layers that must exist and in a ready state before this resource can be deployed. Order of the layers has no significance
44+
- `helm.sh/resource-group`: Annotation to declare a resource-group that a given resource belongs to. Any number of resources can belong to a group. A resource can only belong to one group.
45+
- `helm.sh/depends-on/resource-groups`: Annotation to declare resource-groups that must exist and in a ready state before this resource can be deployed. Order of the resource-groups has no significance
4646

4747
*Additions to Chart.yaml*
4848
- `helm.sh/depends-on/subcharts`: Annotation added to `Chart.yaml` to declare chart dependencies, by name or tags, that must be deployed fully and in a ready state before the chart can be deployed. For the dependency or subchart chart to be declared ready, all of its resources, with their sequencing order taken into consideration, would need to be deployed and declared ready. Order of the charts has no significance.
4949
- `depends-on`: A new field added to `Chart.yaml` `dependencies` fields that is meant to declare a list of subcharts, by name or tag, that need to be ready before the subchart in questions get installed. This will be used to create a dependency graph for subcharts.
5050

51-
The installation process would group resources in the same layer and send them to the K8s API Server in one bundle, and once all resources are "ready", the next layer would be installed. A layer would not be considered "ready" and the next layer installed until all resources in that layer are considered "ready". Readiness is described in a later section. A similar process would apply for upgrades. Uninstalls would function on the same layer order, but backwards, where a layer is not uninstalled until all layers that depend on it are first uninstalled. Upgrades would follow the same order as installation.
51+
The installation process would group resources in the same group and send them to the K8s API Server in one bundle, and once all resources are "ready", the next group would be installed. A resource-group would not be considered "ready" and the next group installed until all resources in that group are considered "ready". Readiness is described in a later section. A similar process would apply for upgrades. Uninstalls would function on the same resource-group order, but in reverse, where a resource-group is not uninstalled until all resource-groups that depend on it are first uninstalled. Upgrades would follow the same order as installation.
5252

53-
`helm.sh/layer` and `helm.sh/depends-on/layers` ordering annotations are only used when ordering resources in the same chart. When it comes to resources across charts one needs to declare `helm.sh/depends-on/subcharts` or `depends-on` in Chart.yaml to allow Helm to reason how to order install/upgrade/uninstall subcharts.
53+
The `helm.sh/resource-group` and `helm.sh/depends-on/resource-groups` annotations are used exclusively to control the ordering of resources **within a single chart**. These annotations have no effect across chart boundaries and cannot be used to influence the order of resources in other charts or subcharts.
5454

5555
#### Template examples:
5656
```yaml
5757
# resource 1
5858
metadata:
5959
name: db-service
6060
annotations:
61-
helm.sh/layer: database
61+
helm.sh/resource-group: database
6262
---
6363
# resource 2
6464
metadata:
6565
name: my-app
6666
annotations:
67-
helm.sh/layer: app
68-
helm.sh/depends-on/layers: ["database, queue"]
67+
helm.sh/resource-group: app
68+
helm.sh/depends-on/resource-groups: ["database", "queue"]
6969
---
7070
# resource 3
7171
metadata:
7272
name: queue-processor
7373
annotations:
74-
helm.sh/layer: queue
75-
helm.sh/depends-on/layers: ["another-layer"]
74+
helm.sh/resource-group: queue
75+
helm.sh/depends-on/resource-groups: ["another-group"]
76+
7677
```
77-
In this example, Helm would be responsible for resolving the annotations on these three resources and deploy all resources in the following order. Resources in `database` and `queue` layers would be deployed at the same time. They would need to be ready before attempting to deploy `app` layer resources:
78+
In this example, Helm would be responsible for resolving the annotations on these three resources and deploy all resources in the following order. Resources in `database` and `queue` resource-groups would be deployed at the same time. They would need to be ready before attempting to deploy `app` resource-group:
7879

7980
```
80-
"database" layer: [db-service]
81+
"database" group: [db-service]
8182
||
82-
"queue" layer: || [queue-processor]
83+
"queue" group: || [queue-processor]
8384
|| ||
8485
|| ||
8586
\/ \/
8687
\\ //
8788
\\ //
8889
\/ \/
89-
"app" layer: [my-app]
90+
"app" group: [my-app]
9091
```
9192

9293
#### Chart dependencies example
9394

95+
To control the order in which subcharts are installed, upgraded, or uninstalled, chart authors must use the `helm.sh/depends-on/subcharts` annotation or the `depends-on` field in the `Chart.yaml`. These declarations enable Helm to determine the correct sequencing of subchart operations, as illustrated below.
96+
9497
```yaml
9598
name: foo
9699
annotations:
@@ -177,31 +180,31 @@ Resources with sequencing annotations in a chart would be deployed first followe
177180
- Installs: Helm will install resources in the order defined by the DAG. If any of the readiness checks fail or timeout, the entire install would fail and the release marked as failed. If `--atomic`, or its SDK equivalent is used, a rollback to the last successful install would take place.
178181
- Uninstalls: Helm would uninstall resources in the reverse order they were installed, as per the sequencing order. The logic to delete each resource will not change.
179182
- Rollbacks: Helm will check from the release object whether the revision being rolled back to, was installed in a sequenced manner. If it was, Helm will respect and enforce this order when installing resources from that revision. When deleting unneeded resources of the revision being rolled back from, the reverse order is followed just like uninstalls.
180-
- `helm template` would print all resources in the order they would be deployed. Groups of resources in a layer would be delimited using a `## START layer: <chart> <layer-name>` comment indicating the beginning of each layer and `END layer: <chart> <layer-name>`.
183+
- `helm template` would print all resources in the order they would be deployed. Groups of resources in a resource-group would be delimited using a `## START resource-group: <chart>/<subchart> <group-name>` comment indicating the beginning of each resource-group and `END resource-group: <chart>/<subchart> <group-name>`.
181184

182185
```yaml
183-
## START layer: foo layer1
186+
## START resource-group: foo group1
184187
# resource 1
185188
metadata:
186189
name: foo
187190
annotations:
188-
helm.sh/layer: layer1
191+
helm.sh/resource-group: group1
189192
---
190193
# resource 2
191194
metadata:
192195
name: bar
193196
annotations:
194-
helm.sh/layer: layer1
195-
## END layer: foo layer1
197+
helm.sh/resource-group: group1
198+
## END resource-group: foo group1
196199
---
197-
## START layer: bar layer1
200+
## START resource-group: foo/bar group2
198201
# resource 3
199202
metadata:
200203
name: fizz
201204
annotations:
202-
helm.sh/layer: layer2
203-
helm.sh/depends-on/layers: "layer1"
204-
## END layer: bar layer2
205+
helm.sh/resource-group: group2
206+
helm.sh/depends-on/resource-groups: ["group1"]
207+
## END resource-group: foo/bar group2
205208
```
206209

207210
## Backwards compatibility

0 commit comments

Comments
 (0)