ref(*): remove protobuf any type

pull/3945/head
Adam Reese 6 years ago
parent 91a6ebfed5
commit 36536d77ba
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -22,10 +22,10 @@ import (
"strings"
"github.com/ghodss/yaml"
"github.com/golang/protobuf/ptypes/any"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/hapi/chart"
)
const inspectDesc = `
@ -248,15 +248,15 @@ func (i *inspectCmd) run() error {
if readme == nil {
return nil
}
fmt.Fprintln(i.out, string(readme.Value))
fmt.Fprintln(i.out, string(readme.Data))
}
return nil
}
func findReadme(files []*any.Any) (file *any.Any) {
func findReadme(files []*chart.File) (file *chart.File) {
for _, file := range files {
for _, n := range readmeFileNames {
if strings.EqualFold(file.TypeUrl, n) {
if strings.EqualFold(file.Name, n) {
return file
}
}

@ -482,7 +482,7 @@ func defaultNamespace() string {
func checkDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error {
missing := []string{}
deps := ch.GetDependencies()
deps := ch.Dependencies
for _, r := range reqs.Dependencies {
found := false
for _, d := range deps {

4
glide.lock generated

@ -1,5 +1,5 @@
hash: b78f3d1f316474c2afd90074058cb5b1b4eda432b7bc270e4b76141199387d37
updated: 2018-04-16T23:16:59.971946077Z
hash: f61bc9a14aff4543b59b89891e4ad0ae787a0ce0e6d775d02b8964e857d41aad
updated: 2018-04-18T23:27:56.45176431Z
imports:
- name: cloud.google.com/go
version: 3b1ae45394a234c385be014e9a488f2bb6eef821

@ -15,12 +15,6 @@ import:
- package: github.com/Masterminds/semver
version: ~1.3.1
- package: github.com/technosophos/moniker
- package: github.com/golang/protobuf
version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9
subpackages:
- proto
- ptypes/any
- ptypes/timestamp
- package: github.com/gosuri/uitable
- package: github.com/asaskevich/govalidator
version: ^4.0.0

@ -299,11 +299,11 @@ func CreateFrom(chartfile *chart.Metadata, dest string, src string) error {
schart.Metadata = chartfile
var updatedTemplates []*chart.Template
var updatedTemplates []*chart.File
for _, template := range schart.Templates {
newData := Transform(string(template.Data), "<CHARTNAME>", schart.Metadata.Name)
updatedTemplates = append(updatedTemplates, &chart.Template{Name: template.Name, Data: newData})
updatedTemplates = append(updatedTemplates, &chart.File{Name: template.Name, Data: newData})
}
schart.Templates = updatedTemplates

@ -22,11 +22,11 @@ import (
"path"
"strings"
"github.com/ghodss/yaml"
"github.com/BurntSushi/toml"
"github.com/ghodss/yaml"
"github.com/gobwas/glob"
"github.com/golang/protobuf/ptypes/any"
"k8s.io/helm/pkg/hapi/chart"
)
// Files is a map of files in a chart that can be accessed from a template.
@ -34,12 +34,10 @@ type Files map[string][]byte
// NewFiles creates a new Files from chart files.
// Given an []*any.Any (the format for files in a chart.Chart), extract a map of files.
func NewFiles(from []*any.Any) Files {
func NewFiles(from []*chart.File) Files {
files := map[string][]byte{}
if from != nil {
for _, f := range from {
files[f.TypeUrl] = f.Value
}
for _, f := range from {
files[f.Name] = f.Data
}
return files
}

@ -18,7 +18,6 @@ package chartutil
import (
"testing"
"github.com/golang/protobuf/ptypes/any"
"github.com/stretchr/testify/assert"
)
@ -32,16 +31,16 @@ var cases = []struct {
{"multiline/test.txt", "bar\nfoo"},
}
func getTestFiles() []*any.Any {
a := []*any.Any{}
func getTestFiles() Files {
a := make(Files, len(cases))
for _, c := range cases {
a = append(a, &any.Any{TypeUrl: c.path, Value: []byte(c.data)})
a[c.path] = []byte(c.data)
}
return a
}
func TestNewFiles(t *testing.T) {
files := NewFiles(getTestFiles())
files := getTestFiles()
if len(files) != len(cases) {
t.Errorf("Expected len() = %d, got %d", len(cases), len(files))
}
@ -59,7 +58,7 @@ func TestNewFiles(t *testing.T) {
func TestFileGlob(t *testing.T) {
as := assert.New(t)
f := NewFiles(getTestFiles())
f := getTestFiles()
matched := f.Glob("story/**")
@ -70,7 +69,7 @@ func TestFileGlob(t *testing.T) {
func TestToConfig(t *testing.T) {
as := assert.New(t)
f := NewFiles(getTestFiles())
f := getTestFiles()
out := f.Glob("**/captain.txt").AsConfig()
as.Equal("captain.txt: The Captain", out)
@ -81,7 +80,7 @@ func TestToConfig(t *testing.T) {
func TestToSecret(t *testing.T) {
as := assert.New(t)
f := NewFiles(getTestFiles())
f := getTestFiles()
out := f.Glob("ship/**").AsSecrets()
as.Equal("captain.txt: VGhlIENhcHRhaW4=\nstowaway.txt: TGVnYXR0", out)
@ -90,7 +89,7 @@ func TestToSecret(t *testing.T) {
func TestLines(t *testing.T) {
as := assert.New(t)
f := NewFiles(getTestFiles())
f := getTestFiles()
out := f.Lines("multiline/test.txt")
as.Len(out, 2)

@ -28,8 +28,6 @@ import (
"path/filepath"
"strings"
"github.com/golang/protobuf/ptypes/any"
"k8s.io/helm/pkg/hapi/chart"
"k8s.io/helm/pkg/ignore"
"k8s.io/helm/pkg/sympath"
@ -136,10 +134,10 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) {
} else if f.Name == "values.yaml" {
c.Values = &chart.Config{Raw: string(f.Data)}
} else if strings.HasPrefix(f.Name, "templates/") {
c.Templates = append(c.Templates, &chart.Template{Name: f.Name, Data: f.Data})
c.Templates = append(c.Templates, &chart.File{Name: f.Name, Data: f.Data})
} else if strings.HasPrefix(f.Name, "charts/") {
if filepath.Ext(f.Name) == ".prov" {
c.Files = append(c.Files, &any.Any{TypeUrl: f.Name, Value: f.Data})
c.Files = append(c.Files, &chart.File{Name: f.Name, Data: f.Data})
continue
}
cname := strings.TrimPrefix(f.Name, "charts/")
@ -151,7 +149,7 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) {
scname := parts[0]
subcharts[scname] = append(subcharts[scname], &BufferedFile{Name: cname, Data: f.Data})
} else {
c.Files = append(c.Files, &any.Any{TypeUrl: f.Name, Value: f.Data})
c.Files = append(c.Files, &chart.File{Name: f.Name, Data: f.Data})
}
}

@ -97,27 +97,13 @@ icon: https://example.com/64x64.png
t.Errorf("Expected number of templates == 2, got %d", len(c.Templates))
}
c, err = LoadFiles([]*BufferedFile{})
_, err = LoadFiles([]*BufferedFile{})
if err == nil {
t.Fatal("Expected err to be non-nil")
}
if err.Error() != "chart metadata (Chart.yaml) missing" {
t.Errorf("Expected chart metadata missing error, got '%s'", err.Error())
}
// legacy check
c, err = LoadFiles([]*BufferedFile{
{
Name: "values.toml",
Data: []byte{},
},
})
if err == nil {
t.Fatal("Expected err to be non-nil")
}
if err.Error() != "values.toml is illegal as of 2.0.0-alpha.2" {
t.Errorf("Expected values.toml to be illegal, got '%s'", err.Error())
}
}
// Packaging the chart on a Windows machine will produce an
@ -145,7 +131,7 @@ func verifyChart(t *testing.T, c *chart.Chart) {
if len(c.Files) != numfiles {
t.Errorf("Expected %d extra files, got %d", numfiles, len(c.Files))
for _, n := range c.Files {
t.Logf("\t%s", n.TypeUrl)
t.Logf("\t%s", n.Name)
}
}

@ -98,8 +98,8 @@ type RequirementsLock struct {
func LoadRequirements(c *chart.Chart) (*Requirements, error) {
var data []byte
for _, f := range c.Files {
if f.TypeUrl == requirementsName {
data = f.Value
if f.Name == requirementsName {
data = f.Data
}
}
if len(data) == 0 {
@ -113,8 +113,8 @@ func LoadRequirements(c *chart.Chart) (*Requirements, error) {
func LoadRequirementsLock(c *chart.Chart) (*RequirementsLock, error) {
var data []byte
for _, f := range c.Files {
if f.TypeUrl == lockfileName {
data = f.Value
if f.Name == lockfileName {
data = f.Data
}
}
if len(data) == 0 {
@ -392,7 +392,7 @@ func processImportValues(c *chart.Chart) error {
if err != nil {
return err
}
b := make(map[string]interface{}, 0)
b := make(map[string]interface{})
// import values from each dependency if specified in import-values
for _, r := range reqs.Dependencies {
if len(r.ImportValues) > 0 {

@ -287,7 +287,7 @@ func verifyRequirementsImportValues(t *testing.T, c *chart.Chart, v *chart.Confi
if err != nil {
t.Errorf("Error processing import values requirements %v", err)
}
cv := c.GetValues()
cv := c.Values
cc, err := ReadValues([]byte(cv.Raw))
if err != nil {
t.Errorf("Error reading import values %v", err)

@ -69,14 +69,14 @@ func SaveDir(c *chart.Chart, dest string) error {
// Save files
for _, f := range c.Files {
n := filepath.Join(outdir, f.TypeUrl)
n := filepath.Join(outdir, f.Name)
d := filepath.Dir(n)
if err := os.MkdirAll(d, 0755); err != nil {
return err
}
if err := ioutil.WriteFile(n, f.Value, 0755); err != nil {
if err := ioutil.WriteFile(n, f.Data, 0755); err != nil {
return err
}
}
@ -186,8 +186,8 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error {
// Save files
for _, f := range c.Files {
n := filepath.Join(base, f.TypeUrl)
if err := writeToTar(out, n, f.Value); err != nil {
n := filepath.Join(base, f.Name)
if err := writeToTar(out, n, f.Data); err != nil {
return err
}
}

@ -22,8 +22,6 @@ import (
"strings"
"testing"
"github.com/golang/protobuf/ptypes/any"
"k8s.io/helm/pkg/hapi/chart"
)
@ -42,8 +40,8 @@ func TestSave(t *testing.T) {
Values: &chart.Config{
Raw: "ship: Pequod",
},
Files: []*any.Any{
{TypeUrl: "scheherazade/shahryar.txt", Value: []byte("1,001 Nights")},
Files: []*chart.File{
{Name: "scheherazade/shahryar.txt", Data: []byte("1,001 Nights")},
},
}
@ -69,7 +67,7 @@ func TestSave(t *testing.T) {
if c2.Values.Raw != c.Values.Raw {
t.Fatal("Values data did not match")
}
if len(c2.Files) != 1 || c2.Files[0].TypeUrl != "scheherazade/shahryar.txt" {
if len(c2.Files) != 1 || c2.Files[0].Name != "scheherazade/shahryar.txt" {
t.Fatal("Files data did not match")
}
}
@ -89,8 +87,8 @@ func TestSaveDir(t *testing.T) {
Values: &chart.Config{
Raw: "ship: Pequod",
},
Files: []*any.Any{
{TypeUrl: "scheherazade/shahryar.txt", Value: []byte("1,001 Nights")},
Files: []*chart.File{
{Name: "scheherazade/shahryar.txt", Data: []byte("1,001 Nights")},
},
}
@ -109,7 +107,7 @@ func TestSaveDir(t *testing.T) {
if c2.Values.Raw != c.Values.Raw {
t.Fatal("Values data did not match")
}
if len(c2.Files) != 1 || c2.Files[0].TypeUrl != "scheherazade/shahryar.txt" {
if len(c2.Files) != 1 || c2.Files[0].Name != "scheherazade/shahryar.txt" {
t.Fatal("Files data did not match")
}
}

@ -417,8 +417,7 @@ func (v Values) PathValue(ypath string) (interface{}, error) {
table := yps[:ypsLen-1]
st := strings.Join(table, ".")
// get the last element as a string key
key := yps[ypsLen-1:]
sk := string(key[0])
sk := yps[ypsLen-1:][0]
// get our table for table path
t, err := v.Table(st)
if err != nil {

@ -24,8 +24,6 @@ import (
"text/template"
"time"
"github.com/golang/protobuf/ptypes/any"
kversion "k8s.io/apimachinery/pkg/version"
"k8s.io/helm/pkg/hapi/chart"
@ -90,7 +88,7 @@ where:
c := &chart.Chart{
Metadata: &chart.Metadata{Name: "test"},
Templates: []*chart.Template{},
Templates: []*chart.File{},
Values: &chart.Config{Raw: chartValues},
Dependencies: []*chart.Chart{
{
@ -98,8 +96,8 @@ where:
Values: &chart.Config{Raw: ""},
},
},
Files: []*any.Any{
{TypeUrl: "scheherazade/shahryar.txt", Value: []byte("1,001 Nights")},
Files: []*chart.File{
{Name: "scheherazade/shahryar.txt", Data: []byte("1,001 Nights")},
},
}
v := &chart.Config{Raw: overideValues}
@ -153,9 +151,7 @@ where:
t.Error("Expected Capabilities to have a Kube version")
}
var vals Values
vals = res["Values"].(Values)
vals := res["Values"].(Values)
if vals["name"] != "Haroun" {
t.Errorf("Expected 'Haroun', got %q (%v)", vals["name"], vals)
}

@ -23,8 +23,6 @@ import (
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/hapi/chart"
"github.com/golang/protobuf/ptypes/any"
)
func TestSortTemplates(t *testing.T) {
@ -94,7 +92,7 @@ func TestRender(t *testing.T) {
Name: "moby",
Version: "1.2.3",
},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/test1", Data: []byte("{{.outer | title }} {{.inner | title}}")},
{Name: "templates/test2", Data: []byte("{{.global.callme | lower }}")},
{Name: "templates/test3", Data: []byte("{{.noValue}}")},
@ -203,20 +201,20 @@ func TestParallelRenderInternals(t *testing.T) {
func TestAllTemplates(t *testing.T) {
ch1 := &chart.Chart{
Metadata: &chart.Metadata{Name: "ch1"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/foo", Data: []byte("foo")},
{Name: "templates/bar", Data: []byte("bar")},
},
Dependencies: []*chart.Chart{
{
Metadata: &chart.Metadata{Name: "laboratory mice"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/pinky", Data: []byte("pinky")},
{Name: "templates/brain", Data: []byte("brain")},
},
Dependencies: []*chart.Chart{{
Metadata: &chart.Metadata{Name: "same thing we do every night"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/innermost", Data: []byte("innermost")},
}},
},
@ -237,13 +235,13 @@ func TestRenderDependency(t *testing.T) {
toptpl := `Hello {{template "myblock"}}`
ch := &chart.Chart{
Metadata: &chart.Metadata{Name: "outerchart"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/outer", Data: []byte(toptpl)},
},
Dependencies: []*chart.Chart{
{
Metadata: &chart.Metadata{Name: "innerchart"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/inner", Data: []byte(deptpl)},
},
},
@ -278,7 +276,7 @@ func TestRenderNestedValues(t *testing.T) {
deepest := &chart.Chart{
Metadata: &chart.Metadata{Name: "deepest"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: deepestpath, Data: []byte(`And this same {{.Values.what}} that smiles {{.Values.global.when}}`)},
{Name: checkrelease, Data: []byte(`Tomorrow will be {{default "happy" .Release.Name }}`)},
},
@ -287,7 +285,7 @@ func TestRenderNestedValues(t *testing.T) {
inner := &chart.Chart{
Metadata: &chart.Metadata{Name: "herrick"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: innerpath, Data: []byte(`Old {{.Values.who}} is still a-flyin'`)},
},
Values: &chart.Config{Raw: `who: "Robert"`},
@ -296,7 +294,7 @@ func TestRenderNestedValues(t *testing.T) {
outer := &chart.Chart{
Metadata: &chart.Metadata{Name: "top"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: outerpath, Data: []byte(`Gather ye {{.Values.what}} while ye may`)},
},
Values: &chart.Config{
@ -363,21 +361,21 @@ global:
func TestRenderBuiltinValues(t *testing.T) {
inner := &chart.Chart{
Metadata: &chart.Metadata{Name: "Latium"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/Lavinia", Data: []byte(`{{.Template.Name}}{{.Chart.Name}}{{.Release.Name}}`)},
{Name: "templates/From", Data: []byte(`{{.Files.author | printf "%s"}} {{.Files.Get "book/title.txt"}}`)},
},
Values: &chart.Config{Raw: ``},
Dependencies: []*chart.Chart{},
Files: []*any.Any{
{TypeUrl: "author", Value: []byte("Virgil")},
{TypeUrl: "book/title.txt", Value: []byte("Aeneid")},
Files: []*chart.File{
{Name: "author", Data: []byte("Virgil")},
{Name: "book/title.txt", Data: []byte("Aeneid")},
},
}
outer := &chart.Chart{
Metadata: &chart.Metadata{Name: "Troy"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/Aeneas", Data: []byte(`{{.Template.Name}}{{.Chart.Name}}{{.Release.Name}}`)},
},
Values: &chart.Config{Raw: ``},
@ -415,7 +413,7 @@ func TestRenderBuiltinValues(t *testing.T) {
func TestAlterFuncMap(t *testing.T) {
c := &chart.Chart{
Metadata: &chart.Metadata{Name: "conrad"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/quote", Data: []byte(`{{include "conrad/templates/_partial" . | indent 2}} dead.`)},
{Name: "templates/_partial", Data: []byte(`{{.Release.Name}} - he`)},
},
@ -443,7 +441,7 @@ func TestAlterFuncMap(t *testing.T) {
reqChart := &chart.Chart{
Metadata: &chart.Metadata{Name: "conan"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/quote", Data: []byte(`All your base are belong to {{ required "A valid 'who' is required" .Values.who }}`)},
{Name: "templates/bases", Data: []byte(`All {{ required "A valid 'bases' is required" .Values.bases }} of them!`)},
},
@ -478,7 +476,7 @@ func TestAlterFuncMap(t *testing.T) {
tplChart := &chart.Chart{
Metadata: &chart.Metadata{Name: "TplFunction"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/base", Data: []byte(`Evaluate tpl {{tpl "Value: {{ .Values.value}}" .}}`)},
},
Values: &chart.Config{Raw: ``},
@ -507,7 +505,7 @@ func TestAlterFuncMap(t *testing.T) {
tplChartWithFunction := &chart.Chart{
Metadata: &chart.Metadata{Name: "TplFunction"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/base", Data: []byte(`Evaluate tpl {{tpl "Value: {{ .Values.value | quote}}" .}}`)},
},
Values: &chart.Config{Raw: ``},
@ -536,7 +534,7 @@ func TestAlterFuncMap(t *testing.T) {
tplChartWithInclude := &chart.Chart{
Metadata: &chart.Metadata{Name: "TplFunction"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/base", Data: []byte(`{{ tpl "{{include ` + "`" + `TplFunction/templates/_partial` + "`" + ` . | quote }}" .}}`)},
{Name: "templates/_partial", Data: []byte(`{{.Template.Name}}`)},
},

@ -1,54 +1,17 @@
package chart
import google_protobuf "github.com/golang/protobuf/ptypes/any"
// Chart is a helm package that contains metadata, a default config, zero or more
// optionally parameterizable templates, and zero or more charts (dependencies).
type Chart struct {
// Contents of the Chartfile.
Metadata *Metadata `json:"metadata,omitempty"`
// Templates for this chart.
Templates []*Template `json:"templates,omitempty"`
Templates []*File `json:"templates,omitempty"`
// Charts that this chart depends on.
Dependencies []*Chart `json:"dependencies,omitempty"`
// Default config for this template.
Values *Config `json:"values,omitempty"`
// Miscellaneous files in a chart archive,
// e.g. README, LICENSE, etc.
Files []*google_protobuf.Any `json:"files,omitempty"`
}
func (m *Chart) GetMetadata() *Metadata {
if m != nil {
return m.Metadata
}
return nil
}
func (m *Chart) GetTemplates() []*Template {
if m != nil {
return m.Templates
}
return nil
}
func (m *Chart) GetDependencies() []*Chart {
if m != nil {
return m.Dependencies
}
return nil
}
func (m *Chart) GetValues() *Config {
if m != nil {
return m.Values
}
return nil
}
func (m *Chart) GetFiles() []*google_protobuf.Any {
if m != nil {
return m.Files
}
return nil
Files []*File `json:"files,omitempty"`
}

@ -1,26 +1,12 @@
package chart
// Template represents a template as a name/value pair.
// File represents a file as a name/value pair.
//
// By convention, name is a relative path within the scope of the chart's
// base directory.
type Template struct {
type File struct {
// Name is the path-like name of the template.
Name string `json:"name,omitempty"`
// Data is the template as byte data.
Data []byte `json:"data,omitempty"`
}
func (m *Template) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Template) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}

@ -211,7 +211,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release {
Name: "foo",
Version: "0.1.0-beta.1",
},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/foo.tpl", Data: []byte(MockManifest)},
},
}

@ -113,7 +113,7 @@ func Templates(linter *support.Linter, values []byte, namespace string, strict b
// NOTE: disabled for now, Refs https://github.com/kubernetes/helm/issues/1037
// linter.RunLinterRule(support.WarningSev, path, validateQuotes(string(preExecutedTemplate)))
renderedContent := renderedContentMap[filepath.Join(chart.GetMetadata().Name, fileName)]
renderedContent := renderedContentMap[filepath.Join(chart.Metadata.Name, fileName)]
var yamlStruct K8sYamlStruct
// Even though K8sYamlStruct only defines Metadata namespace, an error in any other
// key will be raised as well

@ -217,7 +217,7 @@ func chartStub() *chart.Chart {
Metadata: &chart.Metadata{
Name: "nemo",
},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithTestSuccessHook)},
},

@ -267,7 +267,7 @@ func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values
}
}
s.Log("rendering %s chart using values", ch.GetMetadata().Name)
s.Log("rendering %s chart using values", ch.Metadata.Name)
renderer := s.engine(ch)
files, err := renderer.Render(ch, values)
if err != nil {

@ -112,7 +112,7 @@ func buildChart(opts ...chartOption) *chart.Chart {
Name: "hello",
},
// This adds a basic template and hooks.
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithHook)},
},
@ -140,7 +140,7 @@ func withDependency(dependencyOpts ...chartOption) chartOption {
func withNotes(notes string) chartOption {
return func(opts *chartOptions) {
opts.Templates = append(opts.Templates, &chart.Template{
opts.Templates = append(opts.Templates, &chart.File{
Name: "templates/NOTES.txt",
Data: []byte(notes),
})
@ -149,7 +149,7 @@ func withNotes(notes string) chartOption {
func withSampleTemplates() chartOption {
return func(opts *chartOptions) {
sampleTemplates := []*chart.Template{
sampleTemplates := []*chart.File{
// This adds basic templates and partials.
{Name: "templates/goodbye", Data: []byte("goodbye: world")},
{Name: "templates/empty", Data: []byte("")},
@ -361,7 +361,7 @@ func releaseWithKeepStub(rlsName string) *release.Release {
Metadata: &chart.Metadata{
Name: "bunnychart",
},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/configmap", Data: []byte(manifestWithKeep)},
},
}

@ -36,7 +36,7 @@ func TestUpdateRelease(t *testing.T) {
Name: rel.Name,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},
@ -108,7 +108,7 @@ func TestUpdateRelease_ResetValues(t *testing.T) {
Name: rel.Name,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},
@ -133,7 +133,7 @@ func TestUpdateRelease_ComplexReuseValues(t *testing.T) {
Namespace: "spaced",
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithHook)},
},
@ -153,7 +153,7 @@ func TestUpdateRelease_ComplexReuseValues(t *testing.T) {
Name: rel.Name,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},
@ -177,7 +177,7 @@ func TestUpdateRelease_ComplexReuseValues(t *testing.T) {
Name: rel.Name,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},
@ -203,7 +203,7 @@ func TestUpdateRelease_ComplexReuseValues(t *testing.T) {
Name: rel.Name,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},
@ -233,7 +233,7 @@ func TestUpdateRelease_ReuseValues(t *testing.T) {
Name: rel.Name,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},
@ -270,7 +270,7 @@ func TestUpdateRelease_ResetReuseValues(t *testing.T) {
Name: rel.Name,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},
@ -301,7 +301,7 @@ func TestUpdateReleaseFailure(t *testing.T) {
DisableHooks: true,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/something", Data: []byte("hello: world")},
},
},
@ -343,7 +343,7 @@ func TestUpdateReleaseFailure_Force(t *testing.T) {
DisableHooks: true,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/something", Data: []byte("text: 'Did you ever hear the tragedy of Darth Plagueis the Wise? I thought not. Its not a story the Jedi would tell you. Its a Sith legend. Darth Plagueis was a Dark Lord of the Sith, so powerful and so wise he could use the Force to influence the Midichlorians to create life... He had such a knowledge of the Dark Side that he could even keep the ones he cared about from dying. The Dark Side of the Force is a pathway to many abilities some consider to be unnatural. He became so powerful... The only thing he was afraid of was losing his power, which eventually, of course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice killed him in his sleep. Ironic. He could save others from death, but not himself.'")},
},
},
@ -385,7 +385,7 @@ func TestUpdateReleaseNoHooks(t *testing.T) {
DisableHooks: true,
Chart: &chart.Chart{
Metadata: &chart.Metadata{Name: "hello"},
Templates: []*chart.Template{
Templates: []*chart.File{
{Name: "templates/hello", Data: []byte("hello: world")},
{Name: "templates/hooks", Data: []byte(manifestWithUpgradeHooks)},
},

Loading…
Cancel
Save