feat(tiller): add .Release.IsInstall

parent de7c5e5a
......@@ -7,12 +7,13 @@ Objects can be simple, and have just one value. Or they can contain other object
In the previous section, we use `{{.Release.Name}}` to insert the name of a release into a template. `Release` is one of four top-level objects that you can access in your templates.
- `Release`: This object describes the release itself. It has several objects inside of it:
- `Release.Name`: The release name
- `Release.Time`: The time of the release
- `Release.Namespace`: The namespace to be released into (if the manifest doesn't override)
- `Release.Service`: The name of the releasing service (always `Tiller`).
- `Release.Name`: The release name
- `Release.Time`: The time of the release
- `Release.Namespace`: The namespace to be released into (if the manifest doesn't override)
- `Release.Service`: The name of the releasing service (always `Tiller`).
- `Release.Revision`: The revision number of this release. It begins at 1 and is incremented for each `helm upgrade`.
- `Release.IsUpgrade`: This is set to `true` if the current operation is an upgrade.
- `Release.IsUpgrade`: This is set to `true` if the current operation is an upgrade or rollback.
- `Release.IsInstall`: This is set to `true` if the current operation is an install.
- `Values`: Values passed into the template from the `values.yaml` file and from user-supplied files. By default, `Values` is empty.
- `Chart`: The contents of the `Chart.yaml` file. Any data in `Chart.yaml` will be accessible here. For example `{{.Chart.Name}}-{{.Chart.Version}}` will print out the `mychart-0.1.0`.
- The available fields are listed in the [Charts Guide](charts.md)
......
......@@ -292,8 +292,9 @@ sensitive_.
- `Release.Namespace`: The namespace the chart was released to.
- `Release.Service`: The service that conducted the release. Usually
this is `Tiller`.
- `Release.IsUpgrade`: This is set to true if the current operation is an upgrade.
It is false for install.
- `Release.IsUpgrade`: This is set to true if the current operation is an upgrade or rollback.
- `Release.IsInstall`: This is set to true if the current operation is an
install.
- `Release.Revision`: The revision number. It begins at 1, and increments with
each `helm upgrade`.
- `Chart`: The contents of the `Chart.yaml`. Thus, the chart version is
......
......@@ -305,6 +305,7 @@ type ReleaseOptions struct {
Time *timestamp.Timestamp
Namespace string
IsUpgrade bool
IsInstall bool
Revision int
}
......@@ -317,6 +318,7 @@ func ToRenderValues(chrt *chart.Chart, chrtVals *chart.Config, options ReleaseOp
"Time": options.Time,
"Namespace": options.Namespace,
"IsUpgrade": options.IsUpgrade,
"IsInstall": options.IsInstall,
"Revision": options.Revision,
"Service": "Tiller",
},
......
......@@ -104,6 +104,7 @@ where:
Name: "Seven Voyages",
Time: timeconv.Now(),
Namespace: "al Basrah",
IsInstall: true,
Revision: 5,
}
......@@ -126,6 +127,9 @@ where:
if relmap["IsUpgrade"].(bool) {
t.Errorf("Expected upgrade to be false.")
}
if !relmap["IsInstall"].(bool) {
t.Errorf("Expected install to be true.")
}
if data := res["Files"].(Files)["scheherazade/shahryar.txt"]; string(data) != "1,001 Nights" {
t.Errorf("Expected file '1,001 Nights', got %q", string(data))
}
......
......@@ -659,6 +659,7 @@ func (s *ReleaseServer) prepareRelease(req *services.InstallReleaseRequest) (*re
Time: ts,
Namespace: req.Namespace,
Revision: revision,
IsInstall: true,
}
valuesToRender, err := chartutil.ToRenderValues(req.Chart, req.Values, options)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment