feat(charts): add 'dependencies:' to Chart.yaml

This feature adds a dependencies section to a chart file. It is a
prerequisite for adding automated chart management tooling as described
in #874.
pull/1150/head
Matt Butcher 8 years ago
parent 60b4188867
commit 34577d1ebc

@ -27,6 +27,19 @@ message Maintainer {
string email = 2;
}
// Dependency describes this chart's dependency on another chart.
message Dependency {
// Name is the name of the dependency, e.g. 'nginx'
string name = 1;
// Repository is the repository URL. Appending '/index.yaml' to this should
// return the repo index.
string repository = 2;
// Version is a SemVer 2 version.
string version = 3;
}
// Metadata for a Chart file. This models the structure of a Chart.yaml file.
//
// Spec: https://k8s.io/helm/blob/master/docs/design/chart_format.md#the-chart-file
@ -61,4 +74,6 @@ message Metadata {
// The URL to an icon file.
string icon = 9;
repeated Dependency dependencies = 10;
}

@ -90,4 +90,25 @@ func verifyChartfile(t *testing.T, f *chart.Metadata) {
}
}
if len(f.Dependencies) != 2 {
t.Fatalf("Expected 2 dependencies, got %d", len(f.Dependencies))
}
deps := []*chart.Dependency{
{Name: "alpine", Version: "0.1.0", Repository: "https://example.com/charts"},
{Name: "mariner", Version: "4.3.2", Repository: "https://example.com/charts"},
}
for i, tt := range deps {
c := f.Dependencies[i]
if c.Name != tt.Name {
t.Errorf("Expected name %q, got %q", tt.Name, c.Name)
}
if c.Version != tt.Version {
t.Errorf("Expected version %q, got %q", tt.Version, c.Version)
}
if c.Repository != tt.Repository {
t.Errorf("Expected repository %q, got %q", tt.Repository, c.Repository)
}
}
}

@ -14,3 +14,10 @@ sources:
- https://example.com/foo/bar
home: http://example.com
icon: https://example.com/64x64.png
dependencies:
- name: alpine
version: "0.1.0"
repository: https://example.com/charts
- name: mariner
version: "4.3.2"
repository: https://example.com/charts

Binary file not shown.

@ -14,3 +14,10 @@ sources:
- https://example.com/foo/bar
home: http://example.com
icon: https://example.com/64x64.png
dependencies:
- name: alpine
version: "0.1.0"
repository: https://example.com/charts
- name: mariner
version: "4.3.2"
repository: https://example.com/charts

@ -16,6 +16,7 @@ It has these top-level messages:
Config
Value
Maintainer
Dependency
Metadata
Template
*/

@ -32,7 +32,7 @@ var Metadata_Engine_value = map[string]int32{
func (x Metadata_Engine) String() string {
return proto.EnumName(Metadata_Engine_name, int32(x))
}
func (Metadata_Engine) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{1, 0} }
func (Metadata_Engine) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{2, 0} }
// Maintainer describes a Chart maintainer.
type Maintainer struct {
@ -47,6 +47,29 @@ func (m *Maintainer) String() string { return proto.CompactTextString
func (*Maintainer) ProtoMessage() {}
func (*Maintainer) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
// Dependency describes this chart's dependency on another chart.
type Dependency struct {
// Name is the name of the dependency, e.g. 'nginx'
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
// Repository is the repository URL. Appending '/index.yaml' to this should
// return the repo index.
Repository string `protobuf:"bytes,2,opt,name=repository" json:"repository,omitempty"`
// Version is a SemVer 2 version range.
// This can be an exact version or any of the version range operators
// described here: https://github.com/Masterminds/semver/blob/master/README.md
Version string `protobuf:"bytes,3,opt,name=version" json:"version,omitempty"`
// FetchedVersion is a computed field that indicates exactly which version
// was fetched by tooling. It is an exact version (not a range).
//
// This plays the roll of a "lock" for this dependency.
FetchedVersion string `protobuf:"bytes,4,opt,name=fetchedVersion" json:"fetchedVersion,omitempty"`
}
func (m *Dependency) Reset() { *m = Dependency{} }
func (m *Dependency) String() string { return proto.CompactTextString(m) }
func (*Dependency) ProtoMessage() {}
func (*Dependency) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
// Metadata for a Chart file. This models the structure of a Chart.yaml file.
//
// Spec: https://k8s.io/helm/blob/master/docs/design/chart_format.md#the-chart-file
@ -68,13 +91,14 @@ type Metadata struct {
// The name of the template engine to use. Defaults to 'gotpl'.
Engine string `protobuf:"bytes,8,opt,name=engine" json:"engine,omitempty"`
// The URL to an icon file.
Icon string `protobuf:"bytes,9,opt,name=icon" json:"icon,omitempty"`
Icon string `protobuf:"bytes,9,opt,name=icon" json:"icon,omitempty"`
Dependencies []*Dependency `protobuf:"bytes,10,rep,name=dependencies" json:"dependencies,omitempty"`
}
func (m *Metadata) Reset() { *m = Metadata{} }
func (m *Metadata) String() string { return proto.CompactTextString(m) }
func (*Metadata) ProtoMessage() {}
func (*Metadata) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
func (*Metadata) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} }
func (m *Metadata) GetMaintainers() []*Maintainer {
if m != nil {
@ -83,30 +107,42 @@ func (m *Metadata) GetMaintainers() []*Maintainer {
return nil
}
func (m *Metadata) GetDependencies() []*Dependency {
if m != nil {
return m.Dependencies
}
return nil
}
func init() {
proto.RegisterType((*Maintainer)(nil), "hapi.chart.Maintainer")
proto.RegisterType((*Dependency)(nil), "hapi.chart.Dependency")
proto.RegisterType((*Metadata)(nil), "hapi.chart.Metadata")
proto.RegisterEnum("hapi.chart.Metadata_Engine", Metadata_Engine_name, Metadata_Engine_value)
}
var fileDescriptor2 = []byte{
// 275 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x91, 0x4b, 0x4b, 0xc4, 0x30,
0x14, 0x85, 0x9d, 0x47, 0x5f, 0xb7, 0x9b, 0xe1, 0x22, 0x43, 0x74, 0x55, 0xba, 0x72, 0xd5, 0x01,
0x05, 0x71, 0x2d, 0x88, 0x0b, 0x9d, 0x8e, 0x0c, 0x8a, 0xe0, 0x2e, 0xb6, 0xc1, 0x06, 0x6d, 0x53,
0x92, 0xa8, 0xf8, 0x9f, 0xfc, 0x91, 0x26, 0xb7, 0xf3, 0x5a, 0xb8, 0x28, 0x9c, 0x73, 0xbe, 0xde,
0xdc, 0x9e, 0x06, 0x4e, 0x1a, 0xde, 0xcb, 0x45, 0xd5, 0x70, 0x6d, 0x17, 0xad, 0xb0, 0xbc, 0xe6,
0x96,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, 0xff, 0x72, 0xdf, 0x74, 0xb5, 0x9f,
0x01, 0x00, 0x00,
// 346 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x52, 0x4f, 0x4b, 0xfb, 0x40,
0x10, 0xfd, 0xa5, 0x6d, 0x92, 0x76, 0xf2, 0x43, 0xca, 0x22, 0x65, 0xf5, 0x20, 0x25, 0x07, 0xf1,
0x94, 0x82, 0x82, 0x88, 0x47, 0x51, 0x3c, 0x68, 0x5b, 0x29, 0xfe, 0x01, 0x6f, 0x6b, 0x32, 0x9a,
0x45, 0x93, 0x0d, 0xbb, 0xab, 0xd2, 0xab, 0x9f, 0xd6, 0x8f, 0xe1, 0x66, 0x93, 0xb6, 0xa9, 0xf6,
0x10, 0x98, 0xf7, 0xde, 0xcc, 0xbc, 0x99, 0xcc, 0xc2, 0x4e, 0xca, 0x0a, 0x3e, 0x8a, 0x53, 0x26,
0xf5, 0x28, 0x43, 0xcd, 0x12, 0xa6, 0x59, 0x54, 0x48, 0xa1, 0x05, 0x81, 0x52, 0x8a, 0xac, 0x14,
0x1e, 0x03, 0x8c, 0x19, 0xcf, 0xb5, 0xf9, 0x50, 0x12, 0x02, 0x9d, 0x9c, 0x65, 0x48, 0x9d, 0xa1,
0x73, 0xd0, 0x9b, 0xd9, 0x98, 0x6c, 0x83, 0x8b, 0x19, 0xe3, 0x6f, 0xb4, 0x65, 0xc9, 0x0a, 0x84,
0x5f, 0x0e, 0xc0, 0x39, 0x16, 0x98, 0x27, 0x98, 0xc7, 0xf3, 0x8d, 0x85, 0x7b, 0x00, 0x12, 0x0b,
0xa1, 0xb8, 0x16, 0x72, 0x5e, 0x57, 0x37, 0x18, 0x42, 0xc1, 0xff, 0x40, 0xa9, 0xb8, 0xc8, 0x69,
0xdb, 0x8a, 0x0b, 0x48, 0xf6, 0x61, 0xeb, 0x19, 0x75, 0x9c, 0x62, 0x72, 0x5f, 0x27, 0x74, 0x6c,
0xc2, 0x2f, 0x36, 0xfc, 0x6e, 0x41, 0x77, 0x5c, 0xef, 0xb6, 0x71, 0x04, 0xc3, 0xa5, 0xc2, 0x70,
0x95, 0xb9, 0x8d, 0x4b, 0x5b, 0x25, 0xde, 0x65, 0x8c, 0xca, 0xd8, 0xb6, 0x4b, 0xdb, 0x1a, 0x36,
0x07, 0xea, 0xac, 0x0f, 0x34, 0x84, 0x20, 0x41, 0x15, 0x4b, 0x5e, 0xe8, 0x52, 0x75, 0xad, 0xda,
0xa4, 0xc8, 0x2e, 0x74, 0x5f, 0x71, 0xfe, 0x29, 0x64, 0xa2, 0xa8, 0x67, 0xdb, 0x2e, 0x31, 0x39,
0x81, 0x20, 0x5b, 0xfe, 0x63, 0x45, 0x7d, 0x23, 0x07, 0x87, 0x83, 0x68, 0x75, 0x85, 0x68, 0x75,
0x82, 0x59, 0x33, 0x95, 0x0c, 0xc0, 0xc3, 0xfc, 0xc5, 0xc4, 0xb4, 0x6b, 0x2d, 0x6b, 0x54, 0xee,
0xc5, 0x63, 0x33, 0x48, 0xaf, 0xda, 0xab, 0x8c, 0xc9, 0x29, 0xfc, 0x4f, 0x16, 0x07, 0xe1, 0x66,
0x39, 0xf8, 0x6b, 0xb3, 0x3a, 0xd8, 0x6c, 0x2d, 0x37, 0x1c, 0x82, 0x77, 0x51, 0x75, 0x0e, 0xc0,
0xbf, 0x9b, 0x5c, 0x4d, 0xa6, 0x0f, 0x93, 0xfe, 0x3f, 0xd2, 0x03, 0xf7, 0x72, 0x7a, 0x7b, 0x73,
0xdd, 0x77, 0xce, 0xfc, 0x47, 0xd7, 0xf6, 0x78, 0xf2, 0xec, 0x1b, 0x3a, 0xfa, 0x09, 0x00, 0x00,
0xff, 0xff, 0x6a, 0xfb, 0xe7, 0x86, 0x60, 0x02, 0x00, 0x00,
}

Loading…
Cancel
Save