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 (
util "k8s.io/helm/pkg/releaseutil"
"k8s.io/helm/pkg/tiller"
"k8s.io/helm/pkg/timeconv"
tversion "k8s.io/helm/pkg/version"
)
const templateDesc = `
......@@ -171,7 +172,12 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
// Set up engine.
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 {
return err
}
......
......@@ -16,12 +16,26 @@ limitations under the License.
package chartutil
import (
"fmt"
"runtime"
"k8s.io/apimachinery/pkg/version"
tversion "k8s.io/helm/pkg/proto/hapi/version"
)
// DefaultVersionSet is the default version set, which includes only Core V1 ("v1").
var DefaultVersionSet = NewVersionSet("v1")
var (
// 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.
type Capabilities struct {
......
......@@ -21,10 +21,8 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"github.com/ghodss/yaml"
"k8s.io/apimachinery/pkg/version"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/engine"
"k8s.io/helm/pkg/lint/support"
......@@ -55,14 +53,8 @@ func Templates(linter *support.Linter) {
options := chartutil.ReleaseOptions{Name: "testRelease", Time: timeconv.Now(), Namespace: "testNamespace"}
caps := &chartutil.Capabilities{
APIVersions: chartutil.DefaultVersionSet,
KubeVersion: &version.Info{
Major: "1",
Minor: "7",
GoVersion: runtime.Version(),
Compiler: runtime.Compiler,
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
},
APIVersions: chartutil.DefaultVersionSet,
KubeVersion: chartutil.DefaultKubeVersion,
TillerVersion: tversion.GetVersionProto(),
}
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