diff --git a/README.md b/README.md index 21a009e2c..b73eb7784 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Get started with the [Quick Start guide](https://docs.helm.sh/using_helm/#quicks ## Roadmap -The [Helm roadmap is currently located on the wiki](https://github.com/kubernetes/helm/wiki/Roadmap). +The [Helm roadmap uses Github milestones](https://github.com/kubernetes/helm/milestones) to track the progress of the project. ## Community, discussion, contribution, and support diff --git a/cmd/helm/dependency_update.go b/cmd/helm/dependency_update.go index 735f205ae..d6a998639 100644 --- a/cmd/helm/dependency_update.go +++ b/cmd/helm/dependency_update.go @@ -96,7 +96,7 @@ func (d *dependencyUpdateCmd) run() error { Getters: getter.All(settings), } if d.verify { - man.Verify = downloader.VerifyIfPossible + man.Verify = downloader.VerifyAlways } if settings.Debug { man.Debug = true diff --git a/cmd/helm/install.go b/cmd/helm/install.go index a9d308908..0c21050b1 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -46,8 +46,8 @@ import ( const installDesc = ` This command installs a chart archive. -The install argument must be either a relative path to a chart directory or the -name of a chart in the current working directory. +The install argument must be a chart reference, a path to a packaged chart, +a path to an unpacked chart directory or a URL. To override values in a chart, use either the '--values' flag and pass in a file or use the '--set' flag and pass configuration from the command line. diff --git a/cmd/helm/search/search.go b/cmd/helm/search/search.go index 828ebeeb5..a24208a4b 100644 --- a/cmd/helm/search/search.go +++ b/cmd/helm/search/search.go @@ -30,7 +30,6 @@ import ( "strings" "github.com/Masterminds/semver" - "k8s.io/helm/pkg/repo" ) @@ -147,6 +146,8 @@ func (i *Index) SearchLiteral(term string, threshold int) []*Result { term = strings.ToLower(term) buf := []*Result{} for k, v := range i.lines { + k = strings.ToLower(k) + v = strings.ToLower(v) res := strings.Index(v, term) if score := i.calcScore(res, v); res != -1 && score < threshold { parts := strings.Split(k, verSep) // Remove version, if it is there. @@ -231,5 +232,5 @@ func (s scoreSorter) Less(a, b int) bool { func indstr(name string, ref *repo.ChartVersion) string { i := ref.Name + sep + name + "/" + ref.Name + sep + ref.Description + sep + strings.Join(ref.Keywords, " ") - return strings.ToLower(i) + return i } diff --git a/cmd/helm/search/search_test.go b/cmd/helm/search/search_test.go index db1e83a74..949cf7be7 100644 --- a/cmd/helm/search/search_test.go +++ b/cmd/helm/search/search_test.go @@ -135,7 +135,7 @@ func TestAll(t *testing.T) { func TestAddRepo_Sort(t *testing.T) { i := loadTestIndex(t, true) - sr, err := i.Search("testing/santa-maria", 100, false) + sr, err := i.Search("TESTING/SANTA-MARIA", 100, false) if err != nil { t.Fatal(err) } @@ -202,6 +202,14 @@ func TestSearchByName(t *testing.T) { {Name: "ztesting/pinta"}, }, }, + { + name: "description upper search, two results", + query: "TWO", + expect: []*Result{ + {Name: "testing/pinta"}, + {Name: "ztesting/pinta"}, + }, + }, { name: "nothing found", query: "mayflower", @@ -209,7 +217,7 @@ func TestSearchByName(t *testing.T) { }, { name: "regexp, one result", - query: "th[ref]*", + query: "Th[ref]*", expect: []*Result{ {Name: "testing/santa-maria"}, }, diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 88ca92fc9..92f6ed738 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -26,6 +26,7 @@ import ( "strings" "time" + "github.com/Masterminds/semver" "github.com/spf13/cobra" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/engine" @@ -35,6 +36,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 = ` @@ -61,6 +63,7 @@ type templateCmd struct { showNotes bool releaseName string renderFiles []string + kubeVersion string } func newTemplateCmd(out io.Writer) *cobra.Command { @@ -84,6 +87,7 @@ func newTemplateCmd(out io.Writer) *cobra.Command { f.StringVar(&t.namespace, "namespace", "", "namespace to install the release into") f.StringArrayVar(&t.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringVar(&t.nameTemplate, "name-template", "", "specify template used to name the release") + f.StringVar(&t.kubeVersion, "kube-version", "", "override the Kubernetes version used as Capabilities.KubeVersion.Major/Minor (e.g. 1.7)") return cmd } @@ -171,7 +175,22 @@ 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(), + } + // If --kube-versionis set, try to parse it as SemVer, and override the + // kubernetes version + if t.kubeVersion != "" { + kv, err := semver.NewVersion(t.kubeVersion) + if err != nil { + return fmt.Errorf("could not parse a kubernetes version: %v", err) + } + caps.KubeVersion.Major = fmt.Sprint(kv.Major()) + caps.KubeVersion.Minor = fmt.Sprint(kv.Minor()) + } + vals, err := chartutil.ToRenderValuesCaps(c, config, options, caps) if err != nil { return err } diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index b1e080493..06c7edf9a 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -104,6 +104,13 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/templates/service.yaml", expectValue: "release-name: \"foobar-YWJj-baz\"", }, + { + name: "check_kube_version", + desc: "verify --kube-version overrides the kubernetes version", + args: []string{chartPath, "--kube-version", "1.6"}, + expectKey: "subchart1/templates/service.yaml", + expectValue: "kube-version/major: \"1\"\n kube-version/minor: \"6\"", + }, } var buf bytes.Buffer diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 8858f534d..a8f00e434 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -8,8 +8,8 @@ install a chart archive This command installs a chart archive. -The install argument must be either a relative path to a chart directory or the -name of a chart in the current working directory. +The install argument must be a chart reference, a path to a packaged chart, +a path to an unpacked chart directory or a URL. To override values in a chart, use either the '--values' flag and pass in a file or use the '--set' flag and pass configuration from the command line. diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index 80ecdec39..adfffa269 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -26,6 +26,7 @@ helm template [flags] CHART ``` -x, --execute stringArray only execute the given templates + --kube-version string override the Kubernetes version used as Capabilities.KubeVersion.Major/Minor (e.g. 1.7) -n, --name string release name (default "RELEASE-NAME") --name-template string specify template used to name the release --namespace string namespace to install the release into @@ -47,4 +48,4 @@ helm template [flags] CHART ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 24-Aug-2017 +###### Auto generated by spf13/cobra on 11-Sep-2017 diff --git a/docs/man/man1/helm_install.1 b/docs/man/man1/helm_install.1 index 8fe99acb3..98995d47a 100644 --- a/docs/man/man1/helm_install.1 +++ b/docs/man/man1/helm_install.1 @@ -18,8 +18,8 @@ helm\-install \- install a chart archive This command installs a chart archive. .PP -The install argument must be either a relative path to a chart directory or the -name of a chart in the current working directory. +The install argument must be a chart reference, a path to a packaged chart, +a path to an unpacked chart directory or a URL. .PP To override values in a chart, use either the '\-\-values' flag and pass in a file diff --git a/glide.lock b/glide.lock index 8651e1885..aad582e83 100644 --- a/glide.lock +++ b/glide.lock @@ -1,14 +1,14 @@ -hash: 54e64255ab9112d0183766264214969a8add57903fbe9e96034f9640b9c9cd82 -updated: 2017-07-10T10:52:19.616678852-04:00 +hash: f66b2182102bb19545353d4168a4a02fc58590eeb75b1a41dec60834aad8c29e +updated: 2017-09-26T10:27:19.202679689-04:00 imports: - name: cloud.google.com/go - version: 3b1ae45394a234c385be014e9a488f2bb6eef821 + version: c7cd507af965dbabdcd5611969432dd422f6b628 - name: github.com/aokoli/goutils - version: 9c37978a95bd5c709a15883b6242714ea6709e64 + version: 3391d3790d23d03408670993e957e8f408993c34 - name: github.com/asaskevich/govalidator version: 7664702784775e51966f0885f5cd27435916517b - name: github.com/Azure/go-autorest - version: d7c034a8af24eda120dd6460bfcd6d9ed14e43ca + version: 58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d - name: github.com/beorn7/perks version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 subpackages: @@ -18,7 +18,7 @@ imports: - name: github.com/chai2010/gettext-go version: bf70f2a70fb1b1f36d90d671a72795984eab0fcb - name: github.com/cpuguy83/go-md2man - version: 71acacd42f85e5e82f70a55327789582a5200a90 + version: 1d903dcb749992f3741d744c0f8376b4bd7eb3e1 subpackages: - md2man - name: github.com/davecgh/go-spew @@ -57,7 +57,7 @@ imports: - name: github.com/docker/go-units version: e30f1e79f3cd72542f2026ceec18d3bd67ab859c - name: github.com/docker/spdystream - version: 449fdfce4d962303d702fec724ef0ad181c92528 + version: bc6354cbbc295e925e4c611ffe90c1f287ee54db - name: github.com/emicklei/go-restful version: ff4f55a206334ef123e4f79bbf348980da81ca46 subpackages: @@ -89,7 +89,7 @@ imports: - name: github.com/go-openapi/spec version: 6aced65f8501fe1217321abf0749d354824ba2ff - name: github.com/go-openapi/strfmt - version: d65c7fdb29eca313476e529628176fe17e58c488 + version: 610b6cacdcde6852f4de68998bd20ce1dac85b22 - name: github.com/go-openapi/swag version: 1d0bd113de87027671077d3c71eb3ac5d7dbba72 - name: github.com/gobwas/glob @@ -137,26 +137,26 @@ imports: subpackages: - lru - name: github.com/golang/protobuf - version: 2bba0603135d7d7f5cb73b2125beeda19c09f4ef + version: 4bd1920723d7b7c925de087aa32e2187708897f7 subpackages: - proto - ptypes/any - ptypes/timestamp - name: github.com/google/gofuzz - version: bbcb9da2d746f8bdbd6a936686a0a6067ada0ec5 + version: 24818f796faf91cd76ec7bddd72458fbced7a6c1 - name: github.com/gosuri/uitable version: 36ee7e946282a3fb1cfecd476ddc9b35d8847e42 subpackages: - util/strutil - util/wordwrap - name: github.com/grpc-ecosystem/go-grpc-prometheus - version: 0c1b191dbfe51efdabe3c14b9f6f3b96429e0722 + version: 2500245aa6110c562d17020fb31a2c133d737799 - name: github.com/hashicorp/golang-lru - version: a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4 + version: 0a025b7e63adc15a622f29b0b2c4c3848243bbf6 - name: github.com/howeyc/gopass - version: 3ca23474a7c7203e0a0a070fd33508f6efdb9b3d + version: bf9dde6d0d2c004a008c27aaee91170c786f6db8 - name: github.com/huandu/xstrings - version: 3959339b333561bf62a38b424fd41517c2c90f40 + version: d6590c0c31d16526217fa60fbd2067f7afcd78c5 - name: github.com/imdario/mergo version: 6633656539c1639d9d78127b7d47c622b5d7b6dc - name: github.com/inconshreveable/mousetrap @@ -172,21 +172,21 @@ imports: - name: github.com/Masterminds/semver version: 517734cc7d6470c0d07130e40fd40bdeb9bcd3fd - name: github.com/Masterminds/sprig - version: 9526be0327b26ad31aa70296a7b10704883976d5 + version: 4c164950cd0a8d3724ddb78982e2c56dc7f47112 - name: github.com/Masterminds/vcs version: 3084677c2c188840777bff30054f2b553729d329 - name: github.com/mattn/go-runewidth - version: d6bea18f789704b5f83375793155289da36a3c7f + version: 97311d9f7767e3d6f422ea06661bc2c7a19e8a5d - name: github.com/matttproud/golang_protobuf_extensions version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a subpackages: - pbutil - name: github.com/mitchellh/mapstructure - version: 740c764bc6149d3f1806231418adb9f52c11bcbf + version: d0303fe809921458f417bcf828397a65db30a7e4 - name: github.com/naoina/go-stringutil version: 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b - name: github.com/pborman/uuid - version: ca53cad383cad2479bbba7f7a1a05797ec1386e4 + version: e790cca94e6cc75c7064b1332e63811d4aae1a53 - name: github.com/prometheus/client_golang version: c5b7fccd204277076155f10851dad72b76a49317 subpackages: @@ -254,9 +254,9 @@ imports: - lex/httplex - trace - name: golang.org/x/oauth2 - version: 3c3a985cb79f52a3190fbc056984415ca6763d01 + version: 13449ad91cb26cb47661c1b080790392170385fd - name: golang.org/x/sys - version: 8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9 + version: 062cd7e4e68206d8bab9b18396626e855c992658 subpackages: - unix - name: golang.org/x/text @@ -298,32 +298,36 @@ imports: subpackages: - bson - name: gopkg.in/yaml.v2 - version: 53feefa2559fb8dfa8d81baad31be332c97d6c77 + version: a3f3340b5840cee44f372bddb5880fcbc419b46a - name: k8s.io/api - version: 4fe9229aaa9d704f8a2a21cdcd50de2bbb6e1b57 + version: 926789af7ddda62752e08bc9b93f1d1ebbc7b2de subpackages: - admissionregistration/v1alpha1 - apps/v1beta1 + - apps/v1beta2 - authentication/v1 - authentication/v1beta1 - authorization/v1 - authorization/v1beta1 - autoscaling/v1 - - autoscaling/v2alpha1 + - autoscaling/v2beta1 - batch/v1 + - batch/v1beta1 - batch/v2alpha1 - certificates/v1beta1 - core/v1 - extensions/v1beta1 - networking/v1 - policy/v1beta1 + - rbac/v1 - rbac/v1alpha1 - rbac/v1beta1 + - scheduling/v1alpha1 - settings/v1alpha1 - storage/v1 - storage/v1beta1 - name: k8s.io/apiserver - version: 087d1a2efeb6296f04bb0f54e7af9890052aa6d7 + version: 19667a1afc13cc13930c40a20f2c12bbdcaaa246 subpackages: - pkg/admission - pkg/apis/apiserver @@ -338,7 +342,7 @@ imports: - pkg/util/feature - pkg/util/flag - name: k8s.io/kubernetes - version: d3ada0119e776222f11ec7945e6d860061339aad + version: 4bc5e7f9a6c25dc4c03d4d656f2cefd21540e28c subpackages: - cmd/kubeadm/app/apis/kubeadm - federation/apis/federation @@ -530,13 +534,15 @@ imports: - plugin/pkg/scheduler/schedulercache - plugin/pkg/scheduler/util - name: k8s.io/metrics - version: 8efbc8e22d00b9c600afec5f1c14073fd2412fce + version: 4faa73f37a1635813affc8fbc36ba49a15e81a24 subpackages: - pkg/apis/metrics - pkg/apis/metrics/v1alpha1 + - pkg/apis/metrics/v1beta1 - pkg/client/clientset_generated/clientset - pkg/client/clientset_generated/clientset/scheme - pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1 + - pkg/client/clientset_generated/clientset/typed/metrics/v1beta1 - name: vbom.ml/util version: db5cfe13f5cc80a4990d98e2e1b0707a4d1a5394 repo: https://github.com/fvbommel/util.git diff --git a/glide.yaml b/glide.yaml index 922c4ff05..fb3e8d48c 100644 --- a/glide.yaml +++ b/glide.yaml @@ -14,13 +14,13 @@ import: - package: github.com/imdario/mergo version: 6633656539c1639d9d78127b7d47c622b5d7b6dc - package: github.com/Masterminds/sprig - version: ^2.12 + version: ^2.13 - package: github.com/ghodss/yaml - package: github.com/Masterminds/semver version: ~1.3.1 - package: github.com/technosophos/moniker - package: github.com/golang/protobuf - version: 2bba0603135d7d7f5cb73b2125beeda19c09f4ef + version: 4bd1920723d7b7c925de087aa32e2187708897f7 subpackages: - proto - ptypes/any @@ -56,7 +56,7 @@ import: # hacks for kubernetes v1.7 - package: cloud.google.com/go - package: github.com/Azure/go-autorest - version: d7c034a8af24eda120dd6460bfcd6d9ed14e43ca + version: v8.0.0 - package: github.com/dgrijalva/jwt-go - package: github.com/docker/spdystream - package: github.com/go-openapi/analysis diff --git a/pkg/chartutil/capabilities.go b/pkg/chartutil/capabilities.go index 82e5e0c0e..e415306d4 100644 --- a/pkg/chartutil/capabilities.go +++ b/pkg/chartutil/capabilities.go @@ -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 { diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml index bf7672e12..8b6bbaee7 100644 --- a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml @@ -6,6 +6,8 @@ metadata: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" namespace: "{{ .Release.Namespace }}" release-name: "{{ .Release.Name }}" + kube-version/major: "{{ .Capabilities.KubeVersion.Major }}" + kube-version/minor: "{{ .Capabilities.KubeVersion.Minor }}" spec: type: {{ .Values.service.type }} ports: diff --git a/pkg/kube/client.go b/pkg/kube/client.go index c0a9a42bb..a642ebc05 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -157,6 +157,9 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { if err != nil { return "", err } + + var objPods = make(map[string][]api.Pod) + missing := []string{} err = perform(infos, func(info *resource.Info) error { c.Log("Doing get for %s: %q", info.Mapping.GroupVersionKind.Kind, info.Name) @@ -171,12 +174,26 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { gvk := info.ResourceMapping().GroupVersionKind vk := gvk.Version + "/" + gvk.Kind objs[vk] = append(objs[vk], info.Object) + + //Get the relation pods + objPods, err = c.getSelectRelationPod(info, objPods) + if err != nil { + c.Log("Warning: get the relation pod is failed, err:%s", err.Error()) + } + return nil }) if err != nil { return "", err } + //here, we will add the objPods to the objs + for key, podItems := range objPods { + for i := range podItems { + objs[key+"(related)"] = append(objs[key+"(related)"], &podItems[i]) + } + } + // Ok, now we have all the objects grouped by types (say, by v1/Pod, v1/Service, etc.), so // spin through them and print them. Printer is cool since it prints the header only when // an object type changes, so we can just rely on that. Problem is it doesn't seem to keep @@ -628,3 +645,67 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf return err } + +//get an kubernetes resources's relation pods +// kubernetes resource used select labels to relate pods +func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]api.Pod) (map[string][]api.Pod, error) { + if info == nil { + return objPods, nil + } + + c.Log("get relation pod of object: %s/%s/%s", info.Namespace, info.Mapping.GroupVersionKind.Kind, info.Name) + + versioned, err := c.AsVersionedObject(info.Object) + if runtime.IsNotRegisteredError(err) { + return objPods, nil + } + if err != nil { + return objPods, err + } + + // We can ignore this error because it will only error if it isn't a type that doesn't + // have pods. In that case, we don't care + selector, _ := getSelectorFromObject(versioned) + + selectorString := labels.Set(selector).AsSelector().String() + + // If we have an empty selector, this likely is a service or config map, so bail out now + if selectorString == "" { + return objPods, nil + } + + client, _ := c.ClientSet() + + pods, err := client.Core().Pods(info.Namespace).List(metav1.ListOptions{ + FieldSelector: fields.Everything().String(), + LabelSelector: labels.Set(selector).AsSelector().String(), + }) + if err != nil { + return objPods, err + } + + for _, pod := range pods.Items { + if pod.APIVersion == "" { + pod.APIVersion = "v1" + } + + if pod.Kind == "" { + pod.Kind = "Pod" + } + vk := pod.GroupVersionKind().Version + "/" + pod.GroupVersionKind().Kind + + if !isFoundPod(objPods[vk], pod) { + objPods[vk] = append(objPods[vk], pod) + } + } + return objPods, nil +} + +func isFoundPod(podItem []api.Pod, pod api.Pod) bool { + for _, value := range podItem { + if (value.Namespace == pod.Namespace) && (value.Name == pod.Name) { + return true + } + } + return false +} diff --git a/pkg/kube/wait.go b/pkg/kube/wait.go index 30173167e..99a9bb15e 100644 --- a/pkg/kube/wait.go +++ b/pkg/kube/wait.go @@ -122,22 +122,22 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { services = append(services, *svc) } } - isReady := podsReady(pods) && servicesReady(services) && volumesReady(pvc) && deploymentsReady(deployments) - c.Log("resources ready: %v", isReady) + isReady := c.podsReady(pods) && c.servicesReady(services) && c.volumesReady(pvc) && c.deploymentsReady(deployments) return isReady, nil }) } -func podsReady(pods []v1.Pod) bool { +func (c *Client) podsReady(pods []v1.Pod) bool { for _, pod := range pods { if !podutil.IsPodReady(&pod) { + c.Log("Pod is not ready: %s/%s", pod.GetNamespace(), pod.GetName()) return false } } return true } -func servicesReady(svc []v1.Service) bool { +func (c *Client) servicesReady(svc []v1.Service) bool { for _, s := range svc { // ExternalName Services are external to cluster so helm shouldn't be checking to see if they're 'ready' (i.e. have an IP Set) if s.Spec.Type == v1.ServiceTypeExternalName { @@ -146,28 +146,32 @@ func servicesReady(svc []v1.Service) bool { // Make sure the service is not explicitly set to "None" before checking the IP if s.Spec.ClusterIP != v1.ClusterIPNone && !helper.IsServiceIPSet(&s) { + c.Log("Service is not ready: %s/%s", s.GetNamespace(), s.GetName()) return false } // This checks if the service has a LoadBalancer and that balancer has an Ingress defined if s.Spec.Type == v1.ServiceTypeLoadBalancer && s.Status.LoadBalancer.Ingress == nil { + c.Log("Service is not ready: %s/%s", s.GetNamespace(), s.GetName()) return false } } return true } -func volumesReady(vols []v1.PersistentVolumeClaim) bool { +func (c *Client) volumesReady(vols []v1.PersistentVolumeClaim) bool { for _, v := range vols { if v.Status.Phase != v1.ClaimBound { + c.Log("PersistentVolumeClaim is not ready: %s/%s", v.GetNamespace(), v.GetName()) return false } } return true } -func deploymentsReady(deployments []deployment) bool { +func (c *Client) deploymentsReady(deployments []deployment) bool { for _, v := range deployments { if !(v.replicaSets.Status.ReadyReplicas >= *v.deployment.Spec.Replicas-deploymentutil.MaxUnavailable(*v.deployment)) { + c.Log("Deployment is not ready: %s/%s", v.deployment.GetNamespace(), v.deployment.GetName()) return false } } diff --git a/pkg/lint/lint_test.go b/pkg/lint/lint_test.go index 1162ee972..02040f079 100644 --- a/pkg/lint/lint_test.go +++ b/pkg/lint/lint_test.go @@ -68,7 +68,7 @@ func TestBadChart(t *testing.T) { func TestInvalidYaml(t *testing.T) { m := All(badYamlFileDir).Messages if len(m) != 1 { - t.Errorf("All didn't fail with expected errors, got %#v", m) + t.Fatalf("All didn't fail with expected errors, got %#v", m) } if !strings.Contains(m[0].Err.Error(), "deliberateSyntaxError") { t.Errorf("All didn't have the error for deliberateSyntaxError") @@ -78,7 +78,7 @@ func TestInvalidYaml(t *testing.T) { func TestBadValues(t *testing.T) { m := All(badValuesFileDir).Messages if len(m) != 1 { - t.Errorf("All didn't fail with expected errors, got %#v", m) + t.Fatalf("All didn't fail with expected errors, got %#v", m) } if !strings.Contains(m[0].Err.Error(), "cannot unmarshal") { t.Errorf("All didn't have the error for invalid key format: %s", m[0].Err) diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index 3ccd9acdb..9343a3a84 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -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) diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index f2447143b..f29e61485 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -32,6 +32,7 @@ var InstallOrder SortOrder = []string{ "LimitRange", "Secret", "ConfigMap", + "StorageClass", "PersistentVolume", "PersistentVolumeClaim", "ServiceAccount", @@ -74,6 +75,7 @@ var UninstallOrder SortOrder = []string{ "ServiceAccount", "PersistentVolumeClaim", "PersistentVolume", + "StorageClass", "ConfigMap", "Secret", "LimitRange",