ref(*): replace TillerVersion with HelmVersion

pull/3945/head
Adam Reese 8 years ago
parent 4c95185164
commit 29e772f631
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -194,9 +194,9 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
renderer := engine.New() renderer := engine.New()
caps := &chartutil.Capabilities{ caps := &chartutil.Capabilities{
APIVersions: chartutil.DefaultVersionSet, APIVersions: chartutil.DefaultVersionSet,
KubeVersion: chartutil.DefaultKubeVersion, KubeVersion: chartutil.DefaultKubeVersion,
TillerVersion: tversion.GetVersionProto(), HelmVersion: tversion.GetVersionProto(),
} }
// kubernetes version // kubernetes version

@ -42,12 +42,12 @@ When in doubt, use _Helm_ (with an uppercase 'H').
## Restricting Tiller by Version ## Restricting Tiller by Version
A `Chart.yaml` file can specify a `tillerVersion` SemVer constraint: A `Chart.yaml` file can specify a `helmVersion` SemVer constraint:
```yaml ```yaml
name: mychart name: mychart
version: 0.2.0 version: 0.2.0
tillerVersion: ">=2.4.0" helmVersion: ">=2.4.0"
``` ```
This constraint should be set when templates use a new feature that was not This constraint should be set when templates use a new feature that was not

@ -24,7 +24,7 @@ In the previous section, we use `{{.Release.Name}}` to insert the name of a rele
- `Capabilities.APIVersions` is a set of versions. - `Capabilities.APIVersions` is a set of versions.
- `Capabilities.APIVersions.Has $version` indicates whether a version (`batch/v1`) is enabled on the cluster. - `Capabilities.APIVersions.Has $version` indicates whether a version (`batch/v1`) is enabled on the cluster.
- `Capabilities.KubeVersion` provides a way to look up the Kubernetes version. It has the following values: `Major`, `Minor`, `GitVersion`, `GitCommit`, `GitTreeState`, `BuildDate`, `GoVersion`, `Compiler`, and `Platform`. - `Capabilities.KubeVersion` provides a way to look up the Kubernetes version. It has the following values: `Major`, `Minor`, `GitVersion`, `GitCommit`, `GitTreeState`, `BuildDate`, `GoVersion`, `Compiler`, and `Platform`.
- `Capabilities.TillerVersion` provides a way to look up the Tiller version. It has the following values: `SemVer`, `GitCommit`, and `GitTreeState`. - `Capabilities.helmVersion` provides a way to look up the Tiller version. It has the following values: `SemVer`, `GitCommit`, and `GitTreeState`.
- `Template`: Contains information about the current template that is being executed - `Template`: Contains information about the current template that is being executed
- `Name`: A namespaced filepath to the current template (e.g. `mychart/templates/mytemplate.yaml`) - `Name`: A namespaced filepath to the current template (e.g. `mychart/templates/mytemplate.yaml`)
- `BasePath`: The namespaced path to the templates directory of the current chart (e.g. `mychart/templates`). - `BasePath`: The namespaced path to the templates directory of the current chart (e.g. `mychart/templates`).

@ -58,7 +58,7 @@ engine: gotpl # The name of the template engine (optional, defaults to gotpl)
icon: A URL to an SVG or PNG image to be used as an icon (optional). icon: A URL to an SVG or PNG image to be used as an icon (optional).
appVersion: The version of the app that this contains (optional). This needn't be SemVer. appVersion: The version of the app that this contains (optional). This needn't be SemVer.
deprecated: Whether this chart is deprecated (optional, boolean) deprecated: Whether this chart is deprecated (optional, boolean)
tillerVersion: The version of Tiller that this chart requires. This should be expressed as a SemVer range: ">2.0.0" (optional) helmVersion: The version of Tiller that this chart requires. This should be expressed as a SemVer range: ">2.0.0" (optional)
``` ```
If you are familiar with the `Chart.yaml` file format for Helm Classic, you will If you are familiar with the `Chart.yaml` file format for Helm Classic, you will
@ -595,7 +595,7 @@ sensitive_.
as `[]byte` using `{{.Files.GetBytes}}` as `[]byte` using `{{.Files.GetBytes}}`
- `Capabilities`: A map-like object that contains information about the versions - `Capabilities`: A map-like object that contains information about the versions
of Kubernetes (`{{.Capabilities.KubeVersion}}`, Tiller of Kubernetes (`{{.Capabilities.KubeVersion}}`, Tiller
(`{{.Capabilities.TillerVersion}}`, and the supported Kubernetes API versions (`{{.Capabilities.HelmVersion}}`, and the supported Kubernetes API versions
(`{{.Capabilities.APIVersions.Has "batch/v1"`) (`{{.Capabilities.APIVersions.Has "batch/v1"`)
**NOTE:** Any unknown Chart.yaml fields will be dropped. They will not **NOTE:** Any unknown Chart.yaml fields will be dropped. They will not

@ -45,10 +45,10 @@ type Capabilities struct {
APIVersions VersionSet APIVersions VersionSet
// KubeVerison is the Kubernetes version // KubeVerison is the Kubernetes version
KubeVersion *version.Info KubeVersion *version.Info
// TillerVersion is the Tiller version // HelmVersion is the Helm version
// //
// This always comes from pkg/version.GetVersionProto(). // This always comes from pkg/version.GetVersionProto().
TillerVersion *tversion.Version HelmVersion *tversion.Version
} }
// VersionSet is a set of Kubernetes API versions. // VersionSet is a set of Kubernetes API versions.

@ -111,9 +111,9 @@ where:
} }
caps := &Capabilities{ caps := &Capabilities{
APIVersions: DefaultVersionSet, APIVersions: DefaultVersionSet,
TillerVersion: version.GetVersionProto(), HelmVersion: version.GetVersionProto(),
KubeVersion: &kversion.Info{Major: "1"}, KubeVersion: &kversion.Info{Major: "1"},
} }
res, err := ToRenderValuesCaps(c, v, o, caps) res, err := ToRenderValuesCaps(c, v, o, caps)
@ -144,7 +144,7 @@ where:
if !res["Capabilities"].(*Capabilities).APIVersions.Has("v1") { if !res["Capabilities"].(*Capabilities).APIVersions.Has("v1") {
t.Error("Expected Capabilities to have v1 as an API") t.Error("Expected Capabilities to have v1 as an API")
} }
if res["Capabilities"].(*Capabilities).TillerVersion.SemVer == "" { if res["Capabilities"].(*Capabilities).HelmVersion.SemVer == "" {
t.Error("Expected Capabilities to have a Tiller version") t.Error("Expected Capabilities to have a Tiller version")
} }
if res["Capabilities"].(*Capabilities).KubeVersion.Major != "1" { if res["Capabilities"].(*Capabilities).KubeVersion.Major != "1" {

@ -42,9 +42,9 @@ type Metadata struct {
AppVersion string `json:"appVersion,omitempty"` AppVersion string `json:"appVersion,omitempty"`
// Whether or not this chart is deprecated // Whether or not this chart is deprecated
Deprecated bool `json:"deprecated,omitempty"` Deprecated bool `json:"deprecated,omitempty"`
// TillerVersion is a SemVer constraints on what version of Tiller is required. // HelmVersion is a SemVer constraints on what version of Tiller is required.
// See SemVer ranges here: https://github.com/Masterminds/semver#basic-comparisons // See SemVer ranges here: https://github.com/Masterminds/semver#basic-comparisons
TillerVersion string `json:"tillerVersion,omitempty"` HelmVersion string `json:"helmVersion,omitempty"`
// Annotations are additional mappings uninterpreted by Tiller, // Annotations are additional mappings uninterpreted by Tiller,
// made available for inspection by other applications. // made available for inspection by other applications.
Annotations map[string]string `json:"annotations,omitempty"` Annotations map[string]string `json:"annotations,omitempty"`

@ -54,9 +54,9 @@ func Templates(linter *support.Linter, values []byte, namespace string, strict b
options := chartutil.ReleaseOptions{Name: "testRelease", Time: time.Now(), Namespace: namespace} options := chartutil.ReleaseOptions{Name: "testRelease", Time: time.Now(), Namespace: namespace}
caps := &chartutil.Capabilities{ caps := &chartutil.Capabilities{
APIVersions: chartutil.DefaultVersionSet, APIVersions: chartutil.DefaultVersionSet,
KubeVersion: chartutil.DefaultKubeVersion, KubeVersion: chartutil.DefaultKubeVersion,
TillerVersion: tversion.GetVersionProto(), HelmVersion: tversion.GetVersionProto(),
} }
cvals, err := chartutil.CoalesceValues(chart, values) cvals, err := chartutil.CoalesceValues(chart, values)
if err != nil { if err != nil {

@ -9,7 +9,7 @@ metadata:
release: {{ .Release.Name | quote }} release: {{ .Release.Name | quote }}
chart: "{{.Chart.Name}}-{{.Chart.Version}}" chart: "{{.Chart.Name}}-{{.Chart.Version}}"
kubeVersion: {{ .Capabilities.KubeVersion.Major }} kubeVersion: {{ .Capabilities.KubeVersion.Major }}
tillerVersion: {{ .Capabilities.TillerVersion }} helmVersion: {{ .Capabilities.HelmVersion }}
spec: spec:
ports: ports:
- port: {{default 80 .Values.httpPort | quote}} - port: {{default 80 .Values.httpPort | quote}}

@ -225,9 +225,9 @@ func capabilities(disc discovery.DiscoveryInterface) (*chartutil.Capabilities, e
return nil, fmt.Errorf("Could not get apiVersions from Kubernetes: %s", err) return nil, fmt.Errorf("Could not get apiVersions from Kubernetes: %s", err)
} }
return &chartutil.Capabilities{ return &chartutil.Capabilities{
APIVersions: vs, APIVersions: vs,
KubeVersion: sv, KubeVersion: sv,
TillerVersion: version.GetVersionProto(), HelmVersion: version.GetVersionProto(),
}, nil }, nil
} }
@ -253,8 +253,8 @@ func GetVersionSet(client discovery.ServerGroupsInterface) (chartutil.VersionSet
func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values, vs chartutil.VersionSet) ([]*release.Hook, *bytes.Buffer, string, error) { func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values, vs chartutil.VersionSet) ([]*release.Hook, *bytes.Buffer, string, error) {
// Guard to make sure Tiller is at the right version to handle this chart. // Guard to make sure Tiller is at the right version to handle this chart.
sver := version.GetVersion() sver := version.GetVersion()
if ch.Metadata.TillerVersion != "" && if ch.Metadata.HelmVersion != "" &&
!version.IsCompatibleRange(ch.Metadata.TillerVersion, sver) { !version.IsCompatibleRange(ch.Metadata.HelmVersion, sver) {
return nil, nil, "", fmt.Errorf("Chart incompatible with Tiller %s", sver) return nil, nil, "", fmt.Errorf("Chart incompatible with Tiller %s", sver)
} }

Loading…
Cancel
Save