mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
ref(*): replace TillerVersion with HelmVersion
This commit is contained in:
parent
4c95185164
commit
29e772f631
11 changed files with 25 additions and 25 deletions
|
|
@ -194,9 +194,9 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
|
|||
renderer := engine.New()
|
||||
|
||||
caps := &chartutil.Capabilities{
|
||||
APIVersions: chartutil.DefaultVersionSet,
|
||||
KubeVersion: chartutil.DefaultKubeVersion,
|
||||
TillerVersion: tversion.GetVersionProto(),
|
||||
APIVersions: chartutil.DefaultVersionSet,
|
||||
KubeVersion: chartutil.DefaultKubeVersion,
|
||||
HelmVersion: tversion.GetVersionProto(),
|
||||
}
|
||||
|
||||
// kubernetes version
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ When in doubt, use _Helm_ (with an uppercase 'H').
|
|||
|
||||
## 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
|
||||
name: mychart
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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.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.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
|
||||
- `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`).
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
appVersion: The version of the app that this contains (optional). This needn't be SemVer.
|
||||
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
|
||||
|
|
@ -595,7 +595,7 @@ sensitive_.
|
|||
as `[]byte` using `{{.Files.GetBytes}}`
|
||||
- `Capabilities`: A map-like object that contains information about the versions
|
||||
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"`)
|
||||
|
||||
**NOTE:** Any unknown Chart.yaml fields will be dropped. They will not
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ type Capabilities struct {
|
|||
APIVersions VersionSet
|
||||
// KubeVerison is the Kubernetes version
|
||||
KubeVersion *version.Info
|
||||
// TillerVersion is the Tiller version
|
||||
// HelmVersion is the Helm version
|
||||
//
|
||||
// This always comes from pkg/version.GetVersionProto().
|
||||
TillerVersion *tversion.Version
|
||||
HelmVersion *tversion.Version
|
||||
}
|
||||
|
||||
// VersionSet is a set of Kubernetes API versions.
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ where:
|
|||
}
|
||||
|
||||
caps := &Capabilities{
|
||||
APIVersions: DefaultVersionSet,
|
||||
TillerVersion: version.GetVersionProto(),
|
||||
KubeVersion: &kversion.Info{Major: "1"},
|
||||
APIVersions: DefaultVersionSet,
|
||||
HelmVersion: version.GetVersionProto(),
|
||||
KubeVersion: &kversion.Info{Major: "1"},
|
||||
}
|
||||
|
||||
res, err := ToRenderValuesCaps(c, v, o, caps)
|
||||
|
|
@ -144,7 +144,7 @@ where:
|
|||
if !res["Capabilities"].(*Capabilities).APIVersions.Has("v1") {
|
||||
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")
|
||||
}
|
||||
if res["Capabilities"].(*Capabilities).KubeVersion.Major != "1" {
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ type Metadata struct {
|
|||
AppVersion string `json:"appVersion,omitempty"`
|
||||
// Whether or not this chart is deprecated
|
||||
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
|
||||
TillerVersion string `json:"tillerVersion,omitempty"`
|
||||
HelmVersion string `json:"helmVersion,omitempty"`
|
||||
// Annotations are additional mappings uninterpreted by Tiller,
|
||||
// made available for inspection by other applications.
|
||||
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}
|
||||
caps := &chartutil.Capabilities{
|
||||
APIVersions: chartutil.DefaultVersionSet,
|
||||
KubeVersion: chartutil.DefaultKubeVersion,
|
||||
TillerVersion: tversion.GetVersionProto(),
|
||||
APIVersions: chartutil.DefaultVersionSet,
|
||||
KubeVersion: chartutil.DefaultKubeVersion,
|
||||
HelmVersion: tversion.GetVersionProto(),
|
||||
}
|
||||
cvals, err := chartutil.CoalesceValues(chart, values)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ metadata:
|
|||
release: {{ .Release.Name | quote }}
|
||||
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||
kubeVersion: {{ .Capabilities.KubeVersion.Major }}
|
||||
tillerVersion: {{ .Capabilities.TillerVersion }}
|
||||
helmVersion: {{ .Capabilities.HelmVersion }}
|
||||
spec:
|
||||
ports:
|
||||
- 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 &chartutil.Capabilities{
|
||||
APIVersions: vs,
|
||||
KubeVersion: sv,
|
||||
TillerVersion: version.GetVersionProto(),
|
||||
APIVersions: vs,
|
||||
KubeVersion: sv,
|
||||
HelmVersion: version.GetVersionProto(),
|
||||
}, 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) {
|
||||
// Guard to make sure Tiller is at the right version to handle this chart.
|
||||
sver := version.GetVersion()
|
||||
if ch.Metadata.TillerVersion != "" &&
|
||||
!version.IsCompatibleRange(ch.Metadata.TillerVersion, sver) {
|
||||
if ch.Metadata.HelmVersion != "" &&
|
||||
!version.IsCompatibleRange(ch.Metadata.HelmVersion, sver) {
|
||||
return nil, nil, "", fmt.Errorf("Chart incompatible with Tiller %s", sver)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue