github.com/appscode/helm@v3.0.0-alpha.1+incompatible/pkg/chart/metadata.go (about) 1 /* 2 Copyright The Helm Authors. 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 */ 15 16 package chart 17 18 import "errors" 19 20 // Maintainer describes a Chart maintainer. 21 type Maintainer struct { 22 // Name is a user name or organization name 23 Name string `json:"name,omitempty"` 24 // Email is an optional email address to contact the named maintainer 25 Email string `json:"email,omitempty"` 26 // URL is an optional URL to an address for the named maintainer 27 URL string `json:"url,omitempty"` 28 } 29 30 // Metadata for a Chart file. This models the structure of a Chart.yaml file. 31 // 32 // Spec: https://helm.sh/helm/blob/master/docs/design/chart_format.md#the-chart-file 33 type Metadata struct { 34 // The name of the chart 35 Name string `json:"name,omitempty"` 36 // The URL to a relevant project page, git repo, or contact person 37 Home string `json:"home,omitempty"` 38 // Source is the URL to the source code of this chart 39 Sources []string `json:"sources,omitempty"` 40 // A SemVer 2 conformant version string of the chart 41 Version string `json:"version,omitempty"` 42 // A one-sentence description of the chart 43 Description string `json:"description,omitempty"` 44 // A list of string keywords 45 Keywords []string `json:"keywords,omitempty"` 46 // A list of name and URL/email address combinations for the maintainer(s) 47 Maintainers []*Maintainer `json:"maintainers,omitempty"` 48 // The URL to an icon file. 49 Icon string `json:"icon,omitempty"` 50 // The API Version of this chart. 51 APIVersion string `json:"apiVersion,omitempty"` 52 // The condition to check to enable chart 53 Condition string `json:"condition,omitempty"` 54 // The tags to check to enable chart 55 Tags string `json:"tags,omitempty"` 56 // The version of the application enclosed inside of this chart. 57 AppVersion string `json:"appVersion,omitempty"` 58 // Whether or not this chart is deprecated 59 Deprecated bool `json:"deprecated,omitempty"` 60 // Annotations are additional mappings uninterpreted by Helm, 61 // made available for inspection by other applications. 62 Annotations map[string]string `json:"annotations,omitempty"` 63 // KubeVersion is a SemVer constraint specifying the version of Kubernetes required. 64 KubeVersion string `json:"kubeVersion,omitempty"` 65 // Dependencies are a list of dependencies for a chart. 66 Dependencies []*Dependency `json:"dependencies,omitempty"` 67 // Specifies the chart type: application or library 68 Type string `json:"type,omitempty"` 69 } 70 71 func (md *Metadata) Validate() error { 72 if md == nil { 73 return errors.New("metadata is required") 74 } 75 if md.APIVersion == "" { 76 return errors.New("metadata apiVersion is required") 77 } 78 if md.Name == "" { 79 return errors.New("metadata name is required") 80 } 81 if md.Version == "" { 82 return errors.New("metadata version is required") 83 } 84 // TODO validate valid semver here? 85 return nil 86 }