Commit 3508cebb authored by Kazuki Suda's avatar Kazuki Suda

Use the same defaults as done in helm lint for Capabilities

parent e742aa8d
...@@ -35,6 +35,7 @@ import ( ...@@ -35,6 +35,7 @@ import (
util "k8s.io/helm/pkg/releaseutil" util "k8s.io/helm/pkg/releaseutil"
"k8s.io/helm/pkg/tiller" "k8s.io/helm/pkg/tiller"
"k8s.io/helm/pkg/timeconv" "k8s.io/helm/pkg/timeconv"
tversion "k8s.io/helm/pkg/version"
) )
const templateDesc = ` const templateDesc = `
...@@ -171,7 +172,12 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { ...@@ -171,7 +172,12 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
// Set up engine. // Set up engine.
renderer := engine.New() renderer := engine.New()
vals, err := chartutil.ToRenderValues(c, config, options) caps := &chartutil.Capabilities{
APIVersions: chartutil.DefaultVersionSet,
KubeVersion: chartutil.DefaultKubeVersion,
TillerVersion: tversion.GetVersionProto(),
}
vals, err := chartutil.ToRenderValuesCaps(c, config, options, caps)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -16,12 +16,26 @@ limitations under the License. ...@@ -16,12 +16,26 @@ limitations under the License.
package chartutil package chartutil
import ( import (
"fmt"
"runtime"
"k8s.io/apimachinery/pkg/version" "k8s.io/apimachinery/pkg/version"
tversion "k8s.io/helm/pkg/proto/hapi/version" tversion "k8s.io/helm/pkg/proto/hapi/version"
) )
// DefaultVersionSet is the default version set, which includes only Core V1 ("v1"). var (
var DefaultVersionSet = NewVersionSet("v1") // DefaultVersionSet is the default version set, which includes only Core V1 ("v1").
DefaultVersionSet = NewVersionSet("v1")
// DefaultKubeVersion is the default kubernetes version
DefaultKubeVersion = &version.Info{
Major: "1",
Minor: "7",
GoVersion: runtime.Version(),
Compiler: runtime.Compiler,
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
}
)
// Capabilities describes the capabilities of the Kubernetes cluster that Tiller is attached to. // Capabilities describes the capabilities of the Kubernetes cluster that Tiller is attached to.
type Capabilities struct { type Capabilities struct {
......
...@@ -21,10 +21,8 @@ import ( ...@@ -21,10 +21,8 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
"k8s.io/apimachinery/pkg/version"
"k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/engine" "k8s.io/helm/pkg/engine"
"k8s.io/helm/pkg/lint/support" "k8s.io/helm/pkg/lint/support"
...@@ -56,13 +54,7 @@ func Templates(linter *support.Linter) { ...@@ -56,13 +54,7 @@ func Templates(linter *support.Linter) {
options := chartutil.ReleaseOptions{Name: "testRelease", Time: timeconv.Now(), Namespace: "testNamespace"} options := chartutil.ReleaseOptions{Name: "testRelease", Time: timeconv.Now(), Namespace: "testNamespace"}
caps := &chartutil.Capabilities{ caps := &chartutil.Capabilities{
APIVersions: chartutil.DefaultVersionSet, APIVersions: chartutil.DefaultVersionSet,
KubeVersion: &version.Info{ KubeVersion: chartutil.DefaultKubeVersion,
Major: "1",
Minor: "7",
GoVersion: runtime.Version(),
Compiler: runtime.Compiler,
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
},
TillerVersion: tversion.GetVersionProto(), TillerVersion: tversion.GetVersionProto(),
} }
valuesToRender, err := chartutil.ToRenderValuesCaps(chart, chart.Values, options, caps) valuesToRender, err := chartutil.ToRenderValuesCaps(chart, chart.Values, options, caps)
......
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