diff --git a/.circleci/bootstrap.sh b/.circleci/bootstrap.sh index 978464efe..30dc0b316 100755 --- a/.circleci/bootstrap.sh +++ b/.circleci/bootstrap.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.circleci/config.yml b/.circleci/config.yml index df9786d82..96f53ee40 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: working_directory: /go/src/k8s.io/helm parallelism: 3 docker: - - image: golang:1.10 + - image: golang:1.11 environment: PROJECT_NAME: "kubernetes-helm" steps: diff --git a/.circleci/deploy.sh b/.circleci/deploy.sh index 6ad91109d..08adad568 100755 --- a/.circleci/deploy.sh +++ b/.circleci/deploy.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.circleci/test.sh b/.circleci/test.sh index e0faf9c18..a6acd8f6a 100755 --- a/.circleci/test.sh +++ b/.circleci/test.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.gitignore b/.gitignore index b94f87b26..7fdfdcf2a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ _dist/ _proto/*.pb.go bin/ +rootfs/helm rootfs/tiller rootfs/rudder vendor/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 34b4f8b16..7958a9adb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,33 +5,89 @@ The Kubernetes Helm project accepts contributions via GitHub pull requests. This ## Reporting a Security Issue Most of the time, when you find a bug in Helm, it should be reported -using [GitHub issues](https://github.com/kubernetes/helm/issues). However, if +using [GitHub issues](https://github.com/helm/helm/issues). However, if you are reporting a _security vulnerability_, please email a report to -[helm-security@deis.com](mailto:helm-security@deis.com). This will give +[cncf-kubernetes-helm-security@lists.cncf.io](mailto:cncf-kubernetes-helm-security@lists.cncf.io). This will give us a chance to try to fix the issue before it is exploited in the wild. -## Contributor License Agreements +## Sign Your Work -We'd love to accept your patches! Before we can take them, we have to jump a -couple of legal hurdles. +The sign-off is a simple line at the end of the explanation for a commit. All +commits needs to be signed. Your signature certifies that you wrote the patch or +otherwise have the right to contribute the material. The rules are pretty simple, +if you can certify the below (from [developercertificate.org](http://developercertificate.org/)): -The Cloud Native Computing Foundation (CNCF) CLA [must be signed](https://github.com/kubernetes/community/blob/master/CLA.md) by all contributors. -Please fill out either the individual or corporate Contributor License -Agreement (CLA). +``` +Developer Certificate of Origin +Version 1.1 -Once you are CLA'ed, we'll be able to accept your pull requests. For any issues that you face during this process, -please add a comment [here](https://github.com/kubernetes/kubernetes/issues/27796) explaining the issue and we will help get it sorted out. +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 -***NOTE***: Only original source code from you and other people that have -signed the CLA can be accepted into the repository. This policy does not -apply to [third_party](third_party/) and [vendor](vendor/). +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` + +Then you just add a line to every git commit message: + + Signed-off-by: Joe Smith + +Use your real name (sorry, no pseudonyms or anonymous contributions.) + +If you set your `user.name` and `user.email` git configs, you can sign your +commit automatically with `git commit -s`. + +Note: If your git config information is set properly then viewing the + `git log` information for your commit will look something like this: + +``` +Author: Joe Smith +Date: Thu Feb 2 11:41:15 2018 -0800 + + Update README + + Signed-off-by: Joe Smith +``` + +Notice the `Author` and `Signed-off-by` lines match. If they don't +your PR will be rejected by the automated DCO check. ## Support Channels Whether you are a user or contributor, official support channels include: -- GitHub [issues](https://github.com/kubernetes/helm/issues/new) -- Slack: #Helm room in the [Kubernetes Slack](http://slack.kubernetes.io/) +- GitHub [issues](https://github.com/helm/helm/issues/new) +- Slack [Kubernetes Slack](http://slack.kubernetes.io/): + - User: #helm-users + - Contributor: #helm-dev Before opening a new issue or submitting a new pull request, it's helpful to search the project - it's likely that another user has already reported the issue you're facing, or it's a known issue that we're already aware of. @@ -40,20 +96,20 @@ Before opening a new issue or submitting a new pull request, it's helpful to sea We use milestones to track progress of releases. There are also 2 special milestones used for helping us keep work organized: `Upcoming - Minor` and `Upcoming - Major` -`Upcoming - Minor` is used for keeping track of issues that aren't assigned to a specific +`Upcoming - Minor` is used for keeping track of issues that aren't assigned to a specific release but could easily be addressed in a minor release. `Upcoming - Major` keeps track -of issues that will need to be addressed in a major release. For example, if the current -version is `2.2.0` an issue/PR could fall in to one of 4 different active milestones: -`2.2.1`, `2.3.0`, `Upcoming - Minor`, or `Upcoming - Major`. If an issue pertains to a -specific upcoming bug or minor release, it would go into `2.2.1` or `2.3.0`. If the issue/PR -does not have a specific milestone yet, but it is likely that it will land in a `2.X` release, -it should go into `Upcoming - Minor`. If the issue/PR is a large functionality add or change -and/or it breaks compatibility, then it should be added to the `Upcoming - Major` milestone. +of issues that will need to be addressed in a major release. For example, if the current +version is `2.2.0` an issue/PR could fall in to one of 4 different active milestones: +`2.2.1`, `2.3.0`, `Upcoming - Minor`, or `Upcoming - Major`. If an issue pertains to a +specific upcoming bug or minor release, it would go into `2.2.1` or `2.3.0`. If the issue/PR +does not have a specific milestone yet, but it is likely that it will land in a `2.X` release, +it should go into `Upcoming - Minor`. If the issue/PR is a large functionality add or change +and/or it breaks compatibility, then it should be added to the `Upcoming - Major` milestone. An issue that we are not sure we will be doing will not be added to any milestone. A milestone (and hence release) is considered done when all outstanding issues/PRs have been closed or moved to another milestone. -## Semver +## Semantic Versioning Helm maintains a strong commitment to backward compatibility. All of our changes to protocols and formats are backward compatible from Helm 2.0 until Helm 3.0. No features, flags, or commands are removed or substantially modified (other than bug fixes). @@ -75,53 +131,54 @@ Issues are used as the primary method for tracking anything to do with the Helm ### Issue Types There are 4 types of issues (each with their own corresponding [label](#labels)): -- Question: These are support or functionality inquiries that we want to have a record of for -future reference. Generally these are questions that are too complex or large to store in the -Slack channel or have particular interest to the community as a whole. Depending on the discussion, +- Question: These are support or functionality inquiries that we want to have a record of for +future reference. Generally these are questions that are too complex or large to store in the +Slack channel or have particular interest to the community as a whole. Depending on the discussion, these can turn into "Feature" or "Bug" issues. -- Proposal: Used for items (like this one) that propose a new ideas or functionality that require -a larger community discussion. This allows for feedback from others in the community before a -feature is actually developed. This is not needed for small additions. Final word on whether or -not a feature needs a proposal is up to the core maintainers. All issues that are proposals should -both have a label and an issue title of "Proposal: [the rest of the title]." A proposal can become +- Proposal: Used for items (like this one) that propose a new ideas or functionality that require +a larger community discussion. This allows for feedback from others in the community before a +feature is actually developed. This is not needed for small additions. Final word on whether or +not a feature needs a proposal is up to the core maintainers. All issues that are proposals should +both have a label and an issue title of "Proposal: [the rest of the title]." A proposal can become a "Feature" and does not require a milestone. -- Features: These track specific feature requests and ideas until they are complete. They can evolve +- Features: These track specific feature requests and ideas until they are complete. They can evolve from a "Proposal" or can be submitted individually depending on the size. - Bugs: These track bugs with the code or problems with the documentation (i.e. missing or incomplete) ### Issue Lifecycle -The issue lifecycle is mainly driven by the core maintainers, but is good information for those +The issue lifecycle is mainly driven by the core maintainers, but is good information for those contributing to Helm. All issue types follow the same general lifecycle. Differences are noted below. 1. Issue creation 2. Triage - - The maintainer in charge of triaging will apply the proper labels for the issue. This - includes labels for priority, type, and metadata (such as "starter"). The only issue - priority we will be tracking is whether or not the issue is "critical." If additional + - The maintainer in charge of triaging will apply the proper labels for the issue. This + includes labels for priority, type, and metadata (such as "starter"). The only issue + priority we will be tracking is whether or not the issue is "critical." If additional levels are needed in the future, we will add them. - - (If needed) Clean up the title to succinctly and clearly state the issue. Also ensure + - (If needed) Clean up the title to succinctly and clearly state the issue. Also ensure that proposals are prefaced with "Proposal". - - Add the issue to the correct milestone. If any questions come up, don't worry about + - Add the issue to the correct milestone. If any questions come up, don't worry about adding the issue to a milestone until the questions are answered. - We attempt to do this process at least once per work day. 3. Discussion - - "Feature" and "Bug" issues should be connected to the PR that resolves it. - - Whoever is working on a "Feature" or "Bug" issue (whether a maintainer or someone from - the community), should either assign the issue to them self or make a comment in the issue + - "Feature" and "Bug" issues should be connected to the PR that resolves it. + - Whoever is working on a "Feature" or "Bug" issue (whether a maintainer or someone from + the community), should either assign the issue to them self or make a comment in the issue saying that they are taking it. - - "Proposal" and "Question" issues should stay open until resolved or if they have not been - active for more than 30 days. This will help keep the issue queue to a manageable size and + - "Proposal" and "Question" issues should stay open until resolved or if they have not been + active for more than 30 days. This will help keep the issue queue to a manageable size and reduce noise. Should the issue need to stay open, the `keep open` label can be added. 4. Issue closure ## How to Contribute a Patch -1. If you haven't already done so, sign a Contributor License Agreement (see details above). -2. Fork the desired repo, develop and test your code changes. -3. Submit a pull request. +1. Fork the repo, develop and test your code changes. +1. Use sign-off when making each of your commits (see [above](#sign-your-work)). + If you forgot to sign some commits that are part of the contribution, you can ask [git to rewrite your commit history](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History). +1. Submit a pull request. Coding conventions and standards are explained in the official developer docs: -https://github.com/kubernetes/helm/blob/master/docs/developers.md +https://github.com/helm/helm/blob/master/docs/developers.md The next section contains more information on the workflow followed for PRs @@ -133,36 +190,36 @@ Like any good open source project, we use Pull Requests to track code changes 1. PR creation - We more than welcome PRs that are currently in progress. They are a great way to keep track of - important work that is in-flight, but useful for others to see. If a PR is a work in progress, + important work that is in-flight, but useful for others to see. If a PR is a work in progress, it **must** be prefaced with "WIP: [title]". Once the PR is ready for review, remove "WIP" from the title. - It is preferred, but not required, to have a PR tied to a specific issue. 2. Triage - - The maintainer in charge of triaging will apply the proper labels for the issue. This should - include at least a size label, `bug` or `feature`, and `awaiting review` once all labels are applied. + - The maintainer in charge of triaging will apply the proper labels for the issue. This should + include at least a size label, `bug` or `feature`, and `awaiting review` once all labels are applied. See the [Labels section](#labels) for full details on the definitions of labels - Add the PR to the correct milestone. This should be the same as the issue the PR closes. 3. Assigning reviews - - Once a review has the `awaiting review` label, maintainers will review them as schedule permits. + - Once a review has the `awaiting review` label, maintainers will review them as schedule permits. The maintainer who takes the issue should self-request a review. - - Reviews from others in the community, especially those who have encountered a bug or have - requested a feature, are highly encouraged, but not required. Maintainer reviews **are** required + - Reviews from others in the community, especially those who have encountered a bug or have + requested a feature, are highly encouraged, but not required. Maintainer reviews **are** required before any merge - - Any PR with the `size/large` label requires 2 review approvals from maintainers before it can be + - Any PR with the `size/large` label requires 2 review approvals from maintainers before it can be merged. Those with `size/medium` are per the judgement of the maintainers 4. Reviewing/Discussion - - Once a maintainer begins reviewing a PR, they will remove the `awaiting review` label and add - the `in progress` label so the person submitting knows that it is being worked on. This is + - Once a maintainer begins reviewing a PR, they will remove the `awaiting review` label and add + the `in progress` label so the person submitting knows that it is being worked on. This is especially helpful when the review may take awhile. - All reviews will be completed using Github review tool. - - A "Comment" review should be used when there are questions about the code that should be + - A "Comment" review should be used when there are questions about the code that should be answered, but that don't involve code changes. This type of review does not count as approval. - A "Changes Requested" review indicates that changes to the code need to be made before they will be merged. - Reviewers should update labels as needed (such as `needs rebase`) 5. Address comments by answering questions or changing code 6. Merge or close - - PRs should stay open until merged or if they have not been active for more than 30 days. - This will help keep the PR queue to a manageable size and reduce noise. Should the PR need + - PRs should stay open until merged or if they have not been active for more than 30 days. + This will help keep the PR queue to a manageable size and reduce noise. Should the PR need to stay open (like in the case of a WIP), the `keep open` label can be added. - If the owner of the PR is listed in `OWNERS`, that user **must** merge their own PRs or explicitly request another OWNER do that for them. @@ -171,14 +228,14 @@ Like any good open source project, we use Pull Requests to track code changes #### Documentation PRs -Documentation PRs will follow the same lifecycle as other PRs. They will also be labeled with the -`docs` label. For documentation, special attention will be paid to spelling, grammar, and clarity +Documentation PRs will follow the same lifecycle as other PRs. They will also be labeled with the +`docs` label. For documentation, special attention will be paid to spelling, grammar, and clarity (whereas those things don't matter *as* much for comments in code). ## The Triager -Each week, one of the core maintainers will serve as the designated "triager" starting after the -public standup meetings on Thursday. This person will be in charge triaging new PRs and issues +Each week, one of the core maintainers will serve as the designated "triager" starting after the +public standup meetings on Thursday. This person will be in charge triaging new PRs and issues throughout the work week. ## Labels @@ -213,8 +270,6 @@ The following tables define all label types used for Helm. It is split up by cat | ----- | ----------- | | `awaiting review` | The PR has been triaged and is ready for someone to review | | `breaking` | The PR has breaking changes (such as API changes) | -| `cncf-cla: no` | The PR submitter has **not** signed the project CLA. | -| `cncf-cla: yes` | The PR submitter has signed the project CLA. This is required to merge. | | `in progress` | Indicates that a maintainer is looking at the PR, even if no review has been posted yet | | `needs pick` | Indicates that the PR needs to be picked into a feature branch (generally bugfix branches). Once it has been, the `picked` label should be applied and this one removed | | `needs rebase` | A helper label used to indicate that the PR needs to be rebased before it can be merged. Used for easy filtering | @@ -222,11 +277,11 @@ The following tables define all label types used for Helm. It is split up by cat #### Size labels -Size labels are used to indicate how "dangerous" a PR is. The guidelines below are used to assign the -labels, but ultimately this can be changed by the maintainers. For example, even if a PR only makes -30 lines of changes in 1 file, but it changes key functionality, it will likely be labeled as `size/large` -because it requires sign off from multiple people. Conversely, a PR that adds a small feature, but requires -another 150 lines of tests to cover all cases, could be labeled as `size/small` even though the number +Size labels are used to indicate how "dangerous" a PR is. The guidelines below are used to assign the +labels, but ultimately this can be changed by the maintainers. For example, even if a PR only makes +30 lines of changes in 1 file, but it changes key functionality, it will likely be labeled as `size/large` +because it requires sign off from multiple people. Conversely, a PR that adds a small feature, but requires +another 150 lines of tests to cover all cases, could be labeled as `size/small` even though the number lines is greater than defined below. | Label | Description | diff --git a/LICENSE b/LICENSE index 21c57fae2..393b7a33b 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2016 The Kubernetes Authors All Rights Reserved + Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Makefile b/Makefile index a8f778377..0677cafe4 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ DOCKER_REGISTRY ?= gcr.io IMAGE_PREFIX ?= kubernetes-helm +DEV_IMAGE ?= golang:1.11 SHORT_NAME ?= tiller SHORT_NAME_RUDDER ?= rudder -TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64 +TARGETS ?= darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le linux/s390x windows/amd64 DIST_DIRS = find * -type d -exec -APP = helm # go option GO ?= go @@ -18,7 +18,7 @@ BINDIR := $(CURDIR)/bin BINARIES := helm tiller # Required for globs to work correctly -SHELL=/bin/bash +SHELL=/usr/bin/env bash .PHONY: all all: build @@ -27,11 +27,12 @@ all: build build: GOBIN=$(BINDIR) $(GO) install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/... -# usage: make clean build-cross dist APP=helm|tiller VERSION=v2.0.0-alpha.3 +# usage: make clean build-cross dist VERSION=v2.0.0-alpha.3 .PHONY: build-cross build-cross: LDFLAGS += -extldflags "-static" build-cross: - CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/$(APP) + CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/helm + CGO_ENABLED=0 gox -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch='$(TARGETS)' $(GOFLAGS) $(if $(TAGS),-tags '$(TAGS)',) -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/tiller .PHONY: dist dist: @@ -60,6 +61,7 @@ check-docker: docker-binary: BINDIR = ./rootfs docker-binary: GOFLAGS += -a -installsuffix cgo docker-binary: + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/helm $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/helm GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -o $(BINDIR)/tiller $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' k8s.io/helm/cmd/tiller .PHONY: docker-build @@ -86,17 +88,39 @@ test: TESTFLAGS += -race -v test: test-style test: test-unit +.PHONY: docker-test +docker-test: docker-binary +docker-test: TESTFLAGS += -race -v +docker-test: docker-test-style +docker-test: docker-test-unit + .PHONY: test-unit test-unit: @echo @echo "==> Running unit tests <==" HELM_HOME=/no/such/dir $(GO) test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS) +.PHONY: docker-test-unit +docker-test-unit: check-docker + docker run \ + -v $(shell pwd):/go/src/k8s.io/helm \ + -w /go/src/k8s.io/helm \ + $(DEV_IMAGE) \ + bash -c "HELM_HOME=/no/such/dir go test $(GOFLAGS) -run $(TESTS) $(PKG) $(TESTFLAGS)" + .PHONY: test-style test-style: @scripts/validate-go.sh @scripts/validate-license.sh +.PHONY: docker-test-style +docker-test-style: check-docker + docker run \ + -v $(CURDIR):/go/src/k8s.io/helm \ + -w /go/src/k8s.io/helm \ + $(DEV_IMAGE) \ + bash -c "scripts/validate-go.sh && scripts/validate-license.sh" + .PHONY: protoc protoc: $(MAKE) -C _proto/ all diff --git a/OWNERS b/OWNERS index 32b26efa2..39f8c8448 100644 --- a/OWNERS +++ b/OWNERS @@ -28,3 +28,4 @@ emeritus: - migmartri - seh - vaikas-google + - rimusz diff --git a/README.md b/README.md index fc091056e..7e68df5c3 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# Kubernetes Helm +# Helm -[![CircleCI](https://circleci.com/gh/kubernetes/helm.svg?style=svg)](https://circleci.com/gh/kubernetes/helm) -[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes/helm)](https://goreportcard.com/report/github.com/kubernetes/helm) -[![GoDoc](https://godoc.org/github.com/kubernetes/helm?status.svg)](https://godoc.org/github.com/kubernetes/helm) +[![CircleCI](https://circleci.com/gh/helm/helm.svg?style=shield)](https://circleci.com/gh/helm/helm) +[![Go Report Card](https://goreportcard.com/badge/github.com/helm/helm)](https://goreportcard.com/report/github.com/helm/helm) +[![GoDoc](https://godoc.org/k8s.io/helm?status.svg)](https://godoc.org/k8s.io/helm) Helm is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources. Use Helm to: -- Find and use [popular software packaged as Kubernetes charts](https://github.com/kubernetes/charts) -- Share your own applications as Kubernetes charts +- Find and use [popular software packaged as Helm charts](https://github.com/helm/charts) to run in Kubernetes +- Share your own applications as Helm charts - Create reproducible builds of your Kubernetes applications - Intelligently manage your Kubernetes manifest files - Manage releases of Helm packages @@ -32,14 +32,16 @@ Think of it like apt/yum/homebrew for Kubernetes. ## Install -Binary downloads of the Helm client can be found on [the latest Releases page](https://github.com/kubernetes/helm/releases/latest). + +Binary downloads of the Helm client can be found on [the Releases page](https://github.com/helm/helm/releases/latest). Unpack the `helm` binary and add it to your PATH and you are good to go! If you want to use a package manager: -- macOS/[homebrew](https://brew.sh/) users can use `brew install kubernetes-helm`. -- Windows/[chocolatey](https://chocolatey.org/) users can use `choco install kubernetes-helm`. +- [Homebrew](https://brew.sh/) users can use `brew install kubernetes-helm`. +- [Chocolatey](https://chocolatey.org/) users can use `choco install kubernetes-helm`. +- [GoFish](https://gofi.sh/) users can use `gofish install helm`. To rapidly get Helm up and running, start with the [Quick Start Guide](https://docs.helm.sh/using_helm/#quickstart-guide). @@ -52,21 +54,20 @@ Get started with the [Quick Start guide](https://docs.helm.sh/using_helm/#quicks ## Roadmap -The [Helm roadmap uses Github milestones](https://github.com/kubernetes/helm/milestones) to track the progress of the project. +The [Helm roadmap uses Github milestones](https://github.com/helm/helm/milestones) to track the progress of the project. ## Community, discussion, contribution, and support You can reach the Helm community and developers via the following channels: -- [Kubernetes Slack](http://slack.k8s.io): - - #helm-users - - #helm-dev - - #charts -- Mailing Lists: - - [Helm Mailing List](https://lists.cncf.io/g/cncf-kubernetes-helm) - - [Kubernetes SIG Apps Mailing List](https://groups.google.com/forum/#!forum/kubernetes-sig-apps) -- Developer Call: Thursdays at 9:30-10:00 Pacific. [https://zoom.us/j/4526666954](https://zoom.us/j/4526666954) +- [Kubernetes Slack](https://kubernetes.slack.com): + - [#helm-users](https://kubernetes.slack.com/messages/helm-users) + - [#helm-dev](https://kubernetes.slack.com/messages/helm-dev) + - [#charts](https://kubernetes.slack.com/messages/charts) +- Mailing List: + - [Helm Mailing List](https://lists.cncf.io/g/cncf-helm) +- Developer Call: Thursdays at 9:30-10:00 Pacific. [https://zoom.us/j/696660622](https://zoom.us/j/696660622) ### Code of conduct -Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md). +Participation in the Helm community is governed by the [Code of Conduct](code-of-conduct.md). diff --git a/SECURITY_CONTACTS b/SECURITY_CONTACTS new file mode 100644 index 000000000..28569205d --- /dev/null +++ b/SECURITY_CONTACTS @@ -0,0 +1,20 @@ +# Defined below are the security contacts for this repo. +# +# They are the contact point for the Product Security Team to reach out +# to for triaging and handling of incoming issues. +# +# The below names agree to abide by the +# [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) +# and will be removed and replaced if they violate that agreement. +# +# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE +# INSTRUCTIONS AT https://github.com/helm/helm/blob/master/CONTRIBUTING.md#reporting-a-security-issue + +adamreese +bacongobbler +mattfarina +michelleN +prydonius +SlickNik +technosophos +thomastaylor312 diff --git a/_proto/hapi/chart/chart.proto b/_proto/hapi/chart/chart.proto index 9b838fd1a..68aea8f05 100644 --- a/_proto/hapi/chart/chart.proto +++ b/_proto/hapi/chart/chart.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/chart/config.proto b/_proto/hapi/chart/config.proto index a1404476b..a851d212f 100644 --- a/_proto/hapi/chart/config.proto +++ b/_proto/hapi/chart/config.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/chart/metadata.proto b/_proto/hapi/chart/metadata.proto index 49d6a217a..0ac695ce2 100644 --- a/_proto/hapi/chart/metadata.proto +++ b/_proto/hapi/chart/metadata.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/chart/template.proto b/_proto/hapi/chart/template.proto index d13543ea9..879d2071a 100644 --- a/_proto/hapi/chart/template.proto +++ b/_proto/hapi/chart/template.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/hook.proto b/_proto/hapi/release/hook.proto index 0d96dd9ae..cf7e25bf6 100644 --- a/_proto/hapi/release/hook.proto +++ b/_proto/hapi/release/hook.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/info.proto b/_proto/hapi/release/info.proto index e23175d3d..ee03056c7 100644 --- a/_proto/hapi/release/info.proto +++ b/_proto/hapi/release/info.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/release.proto b/_proto/hapi/release/release.proto index 4a6afa0fe..ce9208e29 100644 --- a/_proto/hapi/release/release.proto +++ b/_proto/hapi/release/release.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/status.proto b/_proto/hapi/release/status.proto index ef28a233c..aa90760b3 100644 --- a/_proto/hapi/release/status.proto +++ b/_proto/hapi/release/status.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/test_run.proto b/_proto/hapi/release/test_run.proto index 60734ae03..7c281669f 100644 --- a/_proto/hapi/release/test_run.proto +++ b/_proto/hapi/release/test_run.proto @@ -1,5 +1,5 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/release/test_suite.proto b/_proto/hapi/release/test_suite.proto index 2f6feb08c..9ac6583b2 100644 --- a/_proto/hapi/release/test_suite.proto +++ b/_proto/hapi/release/test_suite.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/rudder/rudder.proto b/_proto/hapi/rudder/rudder.proto index 3a37c9e99..188491512 100644 --- a/_proto/hapi/rudder/rudder.proto +++ b/_proto/hapi/rudder/rudder.proto @@ -1,4 +1,4 @@ -// Copyright 2017 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index e54f60581..add468c73 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -89,7 +89,7 @@ service ReleaseService { // // Releases can be retrieved in chunks by setting limit and offset. // -// Releases can be sorted according to a few pre-determined sort stategies. +// Releases can be sorted according to a few pre-determined sort strategies. message ListReleasesRequest { // Limit is the maximum number of releases to be returned. int64 limit = 1; @@ -124,6 +124,7 @@ message ListSort{ UNKNOWN = 0; NAME = 1; LAST_RELEASED = 2; + CHART_NAME = 3; } // SortOrder defines sort orders to augment sorting operations. @@ -209,8 +210,10 @@ message UpdateReleaseRequest { bool reuse_values = 10; // Force resource update through delete/recreate if needed. bool force = 11; - // Render subchart notes if enabled - bool subNotes = 12; + // Description, if set, will set the description for the updated release + string description = 12; + // Render subchart notes if enabled + bool subNotes = 13; } // UpdateReleaseResponse is the response to an update request. @@ -236,6 +239,8 @@ message RollbackReleaseRequest { bool wait = 7; // Force resource update through delete/recreate if needed. bool force = 8; + // Description, if set, will set the description for the rollback + string description = 9; } // RollbackReleaseResponse is the response to an update request. @@ -262,10 +267,10 @@ message InstallReleaseRequest { // DisableHooks causes the server to skip running any hooks for the install. bool disable_hooks = 5; - // Namepace is the kubernetes namespace of the release. + // Namespace is the kubernetes namespace of the release. string namespace = 6; - // ReuseName requests that Tiller re-uses a name, instead of erroring out. + // Reuse_name requests that Tiller re-uses a name, instead of erroring out. bool reuse_name = 7; // timeout specifies the max amount of time any kubernetes client command can run. @@ -276,7 +281,11 @@ message InstallReleaseRequest { bool disable_crd_hook = 10; - bool subNotes = 11; + // Description, if set, will set the description for the installed release + string description = 11; + + bool subNotes = 12; + } // InstallReleaseResponse is the response from a release installation. @@ -294,6 +303,8 @@ message UninstallReleaseRequest { bool purge = 3; // timeout specifies the max amount of time any kubernetes client command can run. int64 timeout = 4; + // Description, if set, will set the description for the uninnstalled release + string description = 5; } // UninstallReleaseResponse represents a successful response to an uninstall request. diff --git a/_proto/hapi/version/version.proto b/_proto/hapi/version/version.proto index 0ae0985b7..5c50e852f 100644 --- a/_proto/hapi/version/version.proto +++ b/_proto/hapi/version/version.proto @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index b1cd04140..2181e723c 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -81,7 +81,8 @@ func runCompletionBash(out io.Writer, cmd *cobra.Command) error { } func runCompletionZsh(out io.Writer, cmd *cobra.Command) error { - zshInitialization := ` + zshInitialization := `#compdef helm + __helm_bash_source() { alias shopt=':' alias _expand=_bash_expand diff --git a/cmd/helm/create.go b/cmd/helm/create.go index 556ff171d..7f0f99af8 100644 --- a/cmd/helm/create.go +++ b/cmd/helm/create.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,15 +38,17 @@ something like this: foo/ | - |- .helmignore # Contains patterns to ignore when packaging Helm charts. + |- .helmignore # Contains patterns to ignore when packaging Helm charts. | - |- Chart.yaml # Information about your chart + |- Chart.yaml # Information about your chart | - |- values.yaml # The default values for your templates + |- values.yaml # The default values for your templates | - |- charts/ # Charts that this chart depends on + |- charts/ # Charts that this chart depends on | - |- templates/ # The template files + |- templates/ # The template files + | + |- templates/tests/ # The test files 'helm create' takes a path for an argument. If directories in the given path do not exist, Helm will attempt to create them as it goes. If the given @@ -84,7 +86,6 @@ func newCreateCmd(out io.Writer) *cobra.Command { func (c *createCmd) run() error { fmt.Fprintf(c.out, "Creating %s\n", c.name) - chartname := filepath.Base(c.name) cfile := &chart.Metadata{ Name: chartname, diff --git a/cmd/helm/create_test.go b/cmd/helm/create_test.go index 84ccebece..3cdf5ebf8 100644 --- a/cmd/helm/create_test.go +++ b/cmd/helm/create_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -143,8 +143,8 @@ func TestCreateStarterCmd(t *testing.T) { t.Errorf("Wrong API version: %q", c.Metadata.ApiVersion) } - if l := len(c.Templates); l != 6 { - t.Errorf("Expected 5 templates, got %d", l) + if l := len(c.Templates); l != 7 { + t.Errorf("Expected 6 templates, got %d", l) } found := false diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index e0ac8c4f6..4f52ffdd9 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ type deleteCmd struct { disableHooks bool purge bool timeout int64 + description string out io.Writer client helm.Interface @@ -77,10 +78,15 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVar(&del.dryRun, "dry-run", false, "simulate a delete") f.BoolVar(&del.disableHooks, "no-hooks", false, "prevent hooks from running during deletion") f.BoolVar(&del.purge, "purge", false, "remove the release from the store and make its name free for later use") f.Int64Var(&del.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") + f.StringVar(&del.description, "description", "", "specify a description for the release") + + // set defaults from environment + settings.InitTLS(f) return cmd } @@ -91,6 +97,7 @@ func (d *deleteCmd) run() error { helm.DeleteDisableHooks(d.disableHooks), helm.DeletePurge(d.purge), helm.DeleteTimeout(d.timeout), + helm.DeleteDescription(d.description), } res, err := d.client.DeleteRelease(d.name, opts...) if res != nil && res.Info != "" { diff --git a/cmd/helm/delete_test.go b/cmd/helm/delete_test.go index 829d17906..b71860e67 100644 --- a/cmd/helm/delete_test.go +++ b/cmd/helm/delete_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -61,6 +61,14 @@ func TestDelete(t *testing.T) { resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, }, + { + name: "delete with description", + args: []string{"aeneas"}, + flags: []string{"--description", "foo"}, + expected: "", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, + }, { name: "delete without release", args: []string{}, diff --git a/cmd/helm/dependency.go b/cmd/helm/dependency.go index 231659691..1e3079ded 100644 --- a/cmd/helm/dependency.go +++ b/cmd/helm/dependency.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -141,7 +141,7 @@ func (l *dependencyListCmd) run() error { r, err := chartutil.LoadRequirements(c) if err != nil { if err == chartutil.ErrRequirementsNotFound { - fmt.Fprintf(l.out, "WARNING: no requirements at %s/charts\n", l.chartpath) + fmt.Fprintf(l.out, "WARNING: no requirements at %s\n", filepath.Join(l.chartpath, "charts")) return nil } return err diff --git a/cmd/helm/dependency_build.go b/cmd/helm/dependency_build.go index ec5fd14b7..3af3c1243 100644 --- a/cmd/helm/dependency_build.go +++ b/cmd/helm/dependency_build.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_build_test.go b/cmd/helm/dependency_build_test.go index 2d7c88654..207313bf5 100644 --- a/cmd/helm/dependency_build_test.go +++ b/cmd/helm/dependency_build_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_test.go b/cmd/helm/dependency_test.go index cc4519147..e98f436ec 100644 --- a/cmd/helm/dependency_test.go +++ b/cmd/helm/dependency_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_update.go b/cmd/helm/dependency_update.go index d6a998639..a8e54137b 100644 --- a/cmd/helm/dependency_update.go +++ b/cmd/helm/dependency_update.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/dependency_update_test.go b/cmd/helm/dependency_update_test.go index e29cb35de..f7ef84e6f 100644 --- a/cmd/helm/dependency_update_test.go +++ b/cmd/helm/dependency_update_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/docs.go b/cmd/helm/docs.go index e5b9f7521..56e3beaf5 100644 --- a/cmd/helm/docs.go +++ b/cmd/helm/docs.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/fetch.go b/cmd/helm/fetch.go index 069f57eff..d6f622bb6 100644 --- a/cmd/helm/fetch.go +++ b/cmd/helm/fetch.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/fetch_test.go b/cmd/helm/fetch_test.go index 13247ee99..3fba37dd6 100644 --- a/cmd/helm/fetch_test.go +++ b/cmd/helm/fetch_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get.go b/cmd/helm/get.go index a2eb1d137..20a4c042f 100644 --- a/cmd/helm/get.go +++ b/cmd/helm/get.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -70,11 +70,17 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the named release with revision") - cmd.AddCommand(addFlagsTLS(newGetValuesCmd(nil, out))) - cmd.AddCommand(addFlagsTLS(newGetManifestCmd(nil, out))) - cmd.AddCommand(addFlagsTLS(newGetHooksCmd(nil, out))) + cmd.AddCommand(newGetValuesCmd(nil, out)) + cmd.AddCommand(newGetManifestCmd(nil, out)) + cmd.AddCommand(newGetHooksCmd(nil, out)) + cmd.AddCommand(newGetNotesCmd(nil, out)) + + // set defaults from environment + settings.InitTLS(f) return cmd } diff --git a/cmd/helm/get_hooks.go b/cmd/helm/get_hooks.go index 1b6f2f8fe..310b2ec73 100644 --- a/cmd/helm/get_hooks.go +++ b/cmd/helm/get_hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,7 +57,13 @@ func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command { return ghc.run() }, } - cmd.Flags().Int32Var(&ghc.version, "revision", 0, "get the named release with revision") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&ghc.version, "revision", 0, "get the named release with revision") + + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/get_hooks_test.go b/cmd/helm/get_hooks_test.go index e578c2533..fe9133feb 100644 --- a/cmd/helm/get_hooks_test.go +++ b/cmd/helm/get_hooks_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_manifest.go b/cmd/helm/get_manifest.go index c01febfb4..1cc7e3543 100644 --- a/cmd/helm/get_manifest.go +++ b/cmd/helm/get_manifest.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -60,7 +60,13 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the named release with revision") + + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/get_manifest_test.go b/cmd/helm/get_manifest_test.go index 286b5628a..c95a1f265 100644 --- a/cmd/helm/get_manifest_test.go +++ b/cmd/helm/get_manifest_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_notes.go b/cmd/helm/get_notes.go new file mode 100644 index 000000000..c7c3d7797 --- /dev/null +++ b/cmd/helm/get_notes.go @@ -0,0 +1,82 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "fmt" + "io" + + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" +) + +var getNotesHelp = ` +This command shows notes provided by the chart of a named release. +` + +type getNotesCmd struct { + release string + out io.Writer + client helm.Interface + version int32 +} + +func newGetNotesCmd(client helm.Interface, out io.Writer) *cobra.Command { + get := &getNotesCmd{ + out: out, + client: client, + } + + cmd := &cobra.Command{ + Use: "notes [flags] RELEASE_NAME", + Short: "displays the notes of the named release", + Long: getNotesHelp, + PreRunE: func(_ *cobra.Command, _ []string) error { return setupConnection() }, + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + return errReleaseRequired + } + get.release = args[0] + if get.client == nil { + get.client = newClient() + } + return get.run() + }, + } + + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the notes of the named release with revision") + + // set defaults from environment + settings.InitTLS(f) + + return cmd +} + +func (n *getNotesCmd) run() error { + res, err := n.client.ReleaseStatus(n.release, helm.StatusReleaseVersion(n.version)) + if err != nil { + return prettyError(err) + } + + if len(res.Info.Status.Notes) > 0 { + fmt.Fprintf(n.out, "NOTES:\n%s\n", res.Info.Status.Notes) + } + return nil +} diff --git a/cmd/helm/get_notes_test.go b/cmd/helm/get_notes_test.go new file mode 100644 index 000000000..de655fef3 --- /dev/null +++ b/cmd/helm/get_notes_test.go @@ -0,0 +1,52 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "io" + "testing" + + "github.com/spf13/cobra" + + "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/proto/hapi/release" +) + +func TestGetNotesCmd(t *testing.T) { + tests := []releaseCase{ + { + name: "get notes of a deployed release", + args: []string{"flummoxed-chickadee"}, + expected: "NOTES:\nrelease notes\n", + rels: []*release.Release{ + releaseMockWithStatus(&release.Status{ + Code: release.Status_DEPLOYED, + Notes: "release notes", + }), + }, + }, + { + name: "get notes requires release name arg", + err: true, + }, + } + + runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { + return newGetNotesCmd(c, out) + }) + +} diff --git a/cmd/helm/get_test.go b/cmd/helm/get_test.go index a6e72987a..cb230a8a5 100644 --- a/cmd/helm/get_test.go +++ b/cmd/helm/get_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/get_values.go b/cmd/helm/get_values.go index b6ce648e5..7cdfa636f 100644 --- a/cmd/helm/get_values.go +++ b/cmd/helm/get_values.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "encoding/json" "fmt" "io" @@ -36,6 +37,7 @@ type getValuesCmd struct { out io.Writer client helm.Interface version int32 + output string } func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { @@ -58,8 +60,15 @@ func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision") - cmd.Flags().BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&get.version, "revision", 0, "get the named release with revision") + f.BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values") + f.StringVar(&get.output, "output", "yaml", "output the specified format (json or yaml)") + + // set defaults from environment + settings.InitTLS(f) + return cmd } @@ -70,20 +79,42 @@ func (g *getValuesCmd) run() error { return prettyError(err) } + values, err := chartutil.ReadValues([]byte(res.Release.Config.Raw)) + if err != nil { + return err + } + // If the user wants all values, compute the values and return. if g.allValues { - cfg, err := chartutil.CoalesceValues(res.Release.Chart, res.Release.Config) + values, err = chartutil.CoalesceValues(res.Release.Chart, res.Release.Config) if err != nil { return err } - cfgStr, err := cfg.YAML() - if err != nil { - return err - } - fmt.Fprintln(g.out, cfgStr) - return nil } - fmt.Fprintln(g.out, res.Release.Config.Raw) + result, err := formatValues(g.output, values) + if err != nil { + return err + } + fmt.Fprintln(g.out, result) return nil } + +func formatValues(format string, values chartutil.Values) (string, error) { + switch format { + case "", "yaml": + out, err := values.YAML() + if err != nil { + return "", err + } + return out, nil + case "json": + out, err := json.Marshal(values) + if err != nil { + return "", fmt.Errorf("Failed to Marshal JSON output: %s", err) + } + return string(out), nil + default: + return "", fmt.Errorf("Unknown output format %q", format) + } +} diff --git a/cmd/helm/get_values_test.go b/cmd/helm/get_values_test.go index 30b2ba4b8..aec5ce0c2 100644 --- a/cmd/helm/get_values_test.go +++ b/cmd/helm/get_values_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,22 +23,53 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" ) func TestGetValuesCmd(t *testing.T) { + releaseWithValues := helm.ReleaseMock(&helm.MockReleaseOptions{ + Name: "thomas-guide", + Chart: &chart.Chart{Values: &chart.Config{Raw: `foo2: "bar2"`}}, + Config: &chart.Config{Raw: `foo: "bar"`}, + }) + tests := []releaseCase{ { name: "get values with a release", resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), args: []string{"thomas-guide"}, - expected: "name: \"value\"", + expected: "name: value", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"})}, }, + { + name: "get values with json format", + resp: releaseWithValues, + args: []string{"thomas-guide"}, + flags: []string{"--output", "json"}, + expected: "{\"foo\":\"bar\"}", + rels: []*release.Release{releaseWithValues}, + }, + { + name: "get all values with json format", + resp: releaseWithValues, + args: []string{"thomas-guide"}, + flags: []string{"--all", "--output", "json"}, + expected: "{\"foo\":\"bar\",\"foo2\":\"bar2\"}", + rels: []*release.Release{releaseWithValues}, + }, { name: "get values requires release name arg", err: true, }, + { + name: "get values with invalid output format", + resp: releaseWithValues, + args: []string{"thomas-guide"}, + flags: []string{"--output", "INVALID_FORMAT"}, + rels: []*release.Release{releaseWithValues}, + err: true, + }, } cmd := func(c *helm.FakeClient, out io.Writer) *cobra.Command { return newGetValuesCmd(c, out) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 4c7ca9290..f7628e44c 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,10 +28,10 @@ import ( "google.golang.org/grpc/status" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" // Import to initialize client auth plugins. _ "k8s.io/client-go/plugin/pkg/client/auth" + "k8s.io/helm/pkg/helm" helm_env "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/portforwarder" @@ -40,16 +40,6 @@ import ( ) var ( - tlsCaCertFile string // path to TLS CA certificate file - tlsCertFile string // path to TLS certificate file - tlsKeyFile string // path to TLS key file - tlsVerify bool // enable TLS and verify remote certificates - tlsEnable bool // enable TLS - - tlsCaCertDefault = "$HELM_HOME/ca.pem" - tlsCertDefault = "$HELM_HOME/cert.pem" - tlsKeyDefault = "$HELM_HOME/key.pem" - tillerTunnel *kube.Tunnel settings helm_env.EnvSettings ) @@ -71,11 +61,19 @@ Common actions from this point include: - helm list: list releases of charts Environment: - $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm - $HELM_HOST set an alternative Tiller host. The format is host:port - $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. - $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") - $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm + $HELM_HOST set an alternative Tiller host. The format is host:port + $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. + $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") + $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") + $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") + $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") + $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") + $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") + $HELM_KEY_PASSPHRASE set HELM_KEY_PASSPHRASE to the passphrase of your PGP private key. If set, you will not be prompted for + the passphrase while signing helm charts + ` func newRootCmd(args []string) *cobra.Command { @@ -85,9 +83,21 @@ func newRootCmd(args []string) *cobra.Command { Long: globalUsage, SilenceUsage: true, PersistentPreRun: func(*cobra.Command, []string) { - tlsCaCertFile = os.ExpandEnv(tlsCaCertFile) - tlsCertFile = os.ExpandEnv(tlsCertFile) - tlsKeyFile = os.ExpandEnv(tlsKeyFile) + if settings.TLSCaCertFile == helm_env.DefaultTLSCaCert || settings.TLSCaCertFile == "" { + settings.TLSCaCertFile = settings.Home.TLSCaCert() + } else { + settings.TLSCaCertFile = os.ExpandEnv(settings.TLSCaCertFile) + } + if settings.TLSCertFile == helm_env.DefaultTLSCert || settings.TLSCertFile == "" { + settings.TLSCertFile = settings.Home.TLSCert() + } else { + settings.TLSCertFile = os.ExpandEnv(settings.TLSCertFile) + } + if settings.TLSKeyFile == helm_env.DefaultTLSKeyFile || settings.TLSKeyFile == "" { + settings.TLSKeyFile = settings.Home.TLSKey() + } else { + settings.TLSKeyFile = os.ExpandEnv(settings.TLSKeyFile) + } }, PersistentPostRun: func(*cobra.Command, []string) { teardown() @@ -113,18 +123,18 @@ func newRootCmd(args []string) *cobra.Command { newVerifyCmd(out), // release commands - addFlagsTLS(newDeleteCmd(nil, out)), - addFlagsTLS(newGetCmd(nil, out)), - addFlagsTLS(newHistoryCmd(nil, out)), - addFlagsTLS(newInstallCmd(nil, out)), - addFlagsTLS(newListCmd(nil, out)), - addFlagsTLS(newRollbackCmd(nil, out)), - addFlagsTLS(newStatusCmd(nil, out)), - addFlagsTLS(newUpgradeCmd(nil, out)), - - addFlagsTLS(newReleaseTestCmd(nil, out)), - addFlagsTLS(newResetCmd(nil, out)), - addFlagsTLS(newVersionCmd(nil, out)), + newDeleteCmd(nil, out), + newGetCmd(nil, out), + newHistoryCmd(nil, out), + newInstallCmd(nil, out), + newListCmd(nil, out), + newRollbackCmd(nil, out), + newStatusCmd(nil, out), + newUpgradeCmd(nil, out), + + newReleaseTestCmd(nil, out), + newResetCmd(nil, out), + newVersionCmd(nil, out), newCompletionCmd(out), newHomeCmd(out), @@ -158,7 +168,12 @@ func init() { func main() { cmd := newRootCmd(os.Args[1:]) if err := cmd.Execute(); err != nil { - os.Exit(1) + switch e := err.(type) { + case pluginError: + os.Exit(e.code) + default: + os.Exit(1) + } } } @@ -169,18 +184,18 @@ func markDeprecated(cmd *cobra.Command, notice string) *cobra.Command { func setupConnection() error { if settings.TillerHost == "" { - config, client, err := getKubeClient(settings.KubeContext) + config, client, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return err } - tunnel, err := portforwarder.New(settings.TillerNamespace, client, config) + tillerTunnel, err = portforwarder.New(settings.TillerNamespace, client, config) if err != nil { return err } - settings.TillerHost = fmt.Sprintf("127.0.0.1:%d", tunnel.Local) - debug("Created tunnel using local port: '%d'\n", tunnel.Local) + settings.TillerHost = fmt.Sprintf("127.0.0.1:%d", tillerTunnel.Local) + debug("Created tunnel using local port: '%d'\n", tillerTunnel.Local) } // Set up the gRPC config. @@ -223,8 +238,8 @@ func prettyError(err error) error { } // configForContext creates a Kubernetes REST client configuration for a given kubeconfig context. -func configForContext(context string) (*rest.Config, error) { - config, err := kube.GetConfig(context).ClientConfig() +func configForContext(context string, kubeconfig string) (*rest.Config, error) { + config, err := kube.GetConfig(context, kubeconfig).ClientConfig() if err != nil { return nil, fmt.Errorf("could not get Kubernetes config for context %q: %s", context, err) } @@ -232,8 +247,8 @@ func configForContext(context string) (*rest.Config, error) { } // getKubeClient creates a Kubernetes config and client for a given kubeconfig context. -func getKubeClient(context string) (*rest.Config, kubernetes.Interface, error) { - config, err := configForContext(context) +func getKubeClient(context string, kubeconfig string) (*rest.Config, kubernetes.Interface, error) { + config, err := configForContext(context, kubeconfig) if err != nil { return nil, nil, err } @@ -244,21 +259,6 @@ func getKubeClient(context string) (*rest.Config, kubernetes.Interface, error) { return config, client, nil } -// getInternalKubeClient creates a Kubernetes config and an "internal" client for a given kubeconfig context. -// -// Prefer the similar getKubeClient if you don't need to use such an internal client. -func getInternalKubeClient(context string) (internalclientset.Interface, error) { - config, err := configForContext(context) - if err != nil { - return nil, err - } - client, err := internalclientset.NewForConfig(config) - if err != nil { - return nil, fmt.Errorf("could not get Kubernetes client: %s", err) - } - return client, nil -} - // ensureHelmClient returns a new helm client impl. if h is not nil. func ensureHelmClient(h helm.Interface) helm.Interface { if h != nil { @@ -270,20 +270,16 @@ func ensureHelmClient(h helm.Interface) helm.Interface { func newClient() helm.Interface { options := []helm.Option{helm.Host(settings.TillerHost), helm.ConnectTimeout(settings.TillerConnectionTimeout)} - if tlsVerify || tlsEnable { - if tlsCaCertFile == "" { - tlsCaCertFile = settings.Home.TLSCaCert() - } - if tlsCertFile == "" { - tlsCertFile = settings.Home.TLSCert() - } - if tlsKeyFile == "" { - tlsKeyFile = settings.Home.TLSKey() + if settings.TLSVerify || settings.TLSEnable { + debug("Host=%q, Key=%q, Cert=%q, CA=%q\n", settings.TLSServerName, settings.TLSKeyFile, settings.TLSCertFile, settings.TLSCaCertFile) + tlsopts := tlsutil.Options{ + ServerName: settings.TLSServerName, + KeyFile: settings.TLSKeyFile, + CertFile: settings.TLSCertFile, + InsecureSkipVerify: true, } - debug("Key=%q, Cert=%q, CA=%q\n", tlsKeyFile, tlsCertFile, tlsCaCertFile) - tlsopts := tlsutil.Options{KeyFile: tlsKeyFile, CertFile: tlsCertFile, InsecureSkipVerify: true} - if tlsVerify { - tlsopts.CaCertFile = tlsCaCertFile + if settings.TLSVerify { + tlsopts.CaCertFile = settings.TLSCaCertFile tlsopts.InsecureSkipVerify = false } tlscfg, err := tlsutil.ClientConfig(tlsopts) @@ -295,16 +291,3 @@ func newClient() helm.Interface { } return helm.NewClient(options...) } - -// addFlagsTLS adds the flags for supporting client side TLS to the -// helm command (only those that invoke communicate to Tiller.) -func addFlagsTLS(cmd *cobra.Command) *cobra.Command { - - // add flags - cmd.Flags().StringVar(&tlsCaCertFile, "tls-ca-cert", tlsCaCertDefault, "path to TLS CA certificate file") - cmd.Flags().StringVar(&tlsCertFile, "tls-cert", tlsCertDefault, "path to TLS certificate file") - cmd.Flags().StringVar(&tlsKeyFile, "tls-key", tlsKeyDefault, "path to TLS key file") - cmd.Flags().BoolVar(&tlsVerify, "tls-verify", false, "enable TLS for request and verify remote") - cmd.Flags().BoolVar(&tlsEnable, "tls", false, "enable TLS for request") - return cmd -} diff --git a/cmd/helm/helm_test.go b/cmd/helm/helm_test.go index 79b8c16f2..3551eb534 100644 --- a/cmd/helm/helm_test.go +++ b/cmd/helm/helm_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import ( "github.com/spf13/cobra" "k8s.io/helm/pkg/helm" + "k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/repo" @@ -229,6 +230,315 @@ func TestRootCmd(t *testing.T) { } } +func TestTLSFlags(t *testing.T) { + cleanup := resetEnv() + defer cleanup() + + homePath := os.Getenv("HELM_HOME") + if homePath == "" { + homePath = filepath.Join(os.Getenv("HOME"), ".helm") + } + + home := helmpath.Home(homePath) + + tests := []struct { + name string + args []string + envars map[string]string + settings environment.EnvSettings + }{ + { + name: "defaults", + args: []string{"version", "-c"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls enable", + args: []string{"version", "-c", "--tls"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: true, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls verify", + args: []string{"version", "-c", "--tls-verify"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: true, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls servername", + args: []string{"version", "-c", "--tls-hostname=foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "foo", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cacert", + args: []string{"version", "-c", "--tls-ca-cert=/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: "/foo", + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cert", + args: []string{"version", "-c", "--tls-cert=/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: "/foo", + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls key", + args: []string{"version", "-c", "--tls-key=/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: "/foo", + }, + }, + { + name: "tls enable envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_ENABLE": "true"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: true, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls verify envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_VERIFY": "true"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: true, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls servername envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_HOSTNAME": "foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "foo", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cacert envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_CA_CERT": "/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: "/foo", + TLSCertFile: home.TLSCert(), + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls cert envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_CERT": "/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: "/foo", + TLSKeyFile: home.TLSKey(), + }, + }, + { + name: "tls key envvar", + args: []string{"version", "-c"}, + envars: map[string]string{"HELM_TLS_KEY": "/foo"}, + settings: environment.EnvSettings{ + TillerHost: "", + TillerConnectionTimeout: 300, + TillerNamespace: "kube-system", + Home: home, + Debug: false, + KubeContext: "", + KubeConfig: "", + TLSEnable: false, + TLSVerify: false, + TLSServerName: "", + TLSCaCertFile: home.TLSCaCert(), + TLSCertFile: home.TLSCert(), + TLSKeyFile: "/foo", + }, + }, + } + + // ensure not set locally + tlsEnvvars := []string{ + "HELM_TLS_HOSTNAME", + "HELM_TLS_CA_CERT", + "HELM_TLS_CERT", + "HELM_TLS_KEY", + "HELM_TLS_VERIFY", + "HELM_TLS_ENABLE", + } + + for i := range tlsEnvvars { + os.Unsetenv(tlsEnvvars[i]) + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + + for k, v := range tt.envars { + os.Setenv(k, v) + defer os.Unsetenv(k) + } + + cmd := newRootCmd(tt.args) + cmd.SetOutput(ioutil.Discard) + cmd.SetArgs(tt.args) + cmd.Run = func(*cobra.Command, []string) {} + if err := cmd.Execute(); err != nil { + t.Errorf("unexpected error: %s", err) + } + + if settings != tt.settings { + t.Errorf("expected settings %v, got %v", tt.settings, settings) + } + }) + } +} + func resetEnv() func() { origSettings := settings origEnv := os.Environ() diff --git a/cmd/helm/history.go b/cmd/helm/history.go index e6366d31d..365346e89 100644 --- a/cmd/helm/history.go +++ b/cmd/helm/history.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -88,10 +88,14 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.Int32Var(&his.max, "max", 256, "maximum number of revision to include in history") f.UintVar(&his.colWidth, "col-width", 60, "specifies the max column width of output") f.StringVarP(&his.outputFormat, "output", "o", "table", "prints the output in the specified format (json|table|yaml)") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/history_test.go b/cmd/helm/history_test.go index fef433742..5d5146228 100644 --- a/cmd/helm/history_test.go +++ b/cmd/helm/history_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/home.go b/cmd/helm/home.go index e96edd7a1..ca21088a7 100644 --- a/cmd/helm/home.go +++ b/cmd/helm/home.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/init.go b/cmd/helm/init.go index d368945ec..b628dc008 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -70,6 +70,12 @@ var ( // This is the IPv4 loopback, not localhost, because we have to force IPv4 // for Dockerized Helm: https://github.com/kubernetes/helm/issues/1410 localRepositoryURL = "http://127.0.0.1:8879/charts" + tlsServerName string // overrides the server name used to verify the hostname on the returned certificates from the server. + tlsCaCertFile string // path to TLS CA certificate file + tlsCertFile string // path to TLS certificate file + tlsKeyFile string // path to TLS key file + tlsVerify bool // enable TLS and verify remote certificates + tlsEnable bool // enable TLS ) type initCmd struct { @@ -121,11 +127,16 @@ func newInitCmd(out io.Writer) *cobra.Command { f.BoolVar(&i.skipRefresh, "skip-refresh", false, "do not refresh (download) the local repository cache") f.BoolVar(&i.wait, "wait", false, "block until Tiller is running and ready to receive requests") + // TODO: replace TLS flags with pkg/helm/environment.AddFlagsTLS() in Helm 3 + // + // NOTE (bacongobbler): we can't do this in Helm 2 because the flag names differ, and `helm init --tls-ca-cert` + // doesn't conform with the rest of the TLS flag names (should be --tiller-tls-ca-cert in Helm 3) f.BoolVar(&tlsEnable, "tiller-tls", false, "install Tiller with TLS enabled") f.BoolVar(&tlsVerify, "tiller-tls-verify", false, "install Tiller with TLS enabled and to verify remote certificates") f.StringVar(&tlsKeyFile, "tiller-tls-key", "", "path to TLS key file to install with Tiller") f.StringVar(&tlsCertFile, "tiller-tls-cert", "", "path to TLS certificate file to install with Tiller") f.StringVar(&tlsCaCertFile, "tls-ca-cert", "", "path to CA root certificate") + f.StringVar(&tlsServerName, "tiller-tls-hostname", settings.TillerHost, "the server name used to verify the hostname on the returned certificates from Tiller") f.StringVar(&stableRepositoryURL, "stable-repo-url", stableRepositoryURL, "URL for stable repository") f.StringVar(&localRepositoryURL, "local-repo-url", localRepositoryURL, "URL for local repository") @@ -138,6 +149,7 @@ func newInitCmd(out io.Writer) *cobra.Command { f.StringVar(&i.opts.NodeSelectors, "node-selectors", "", "labels to specify the node on which Tiller is installed (app=tiller,helm=rocks)") f.VarP(&i.opts.Output, "output", "o", "skip installation and output Tiller's manifest in specified format (json or yaml)") f.StringArrayVar(&i.opts.Values, "override", []string{}, "override values for the Tiller Deployment manifest (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.BoolVar(&i.opts.AutoMountServiceAccountToken, "automount-service-account-token", true, "auto-mount the given service account to tiller") return cmd } @@ -164,6 +176,14 @@ func (i *initCmd) tlsOptions() error { return errors.New("missing required TLS CA file") } } + + // FIXME: remove once we use pkg/helm/environment.AddFlagsTLS() in Helm 3 + settings.TLSEnable = tlsEnable + settings.TLSVerify = tlsVerify + settings.TLSServerName = tlsServerName + settings.TLSCaCertFile = tlsCaCertFile + settings.TLSCertFile = tlsCertFile + settings.TLSKeyFile = tlsKeyFile } return nil } @@ -181,95 +201,64 @@ func (i *initCmd) run() error { i.opts.MaxHistory = i.maxHistory i.opts.Replicas = i.replicas - writeYAMLManifest := func(apiVersion, kind, body string, first, last bool) error { + writeYAMLManifests := func(manifests []string) error { w := i.out - if !first { - // YAML starting document boundary marker + for _, manifest := range manifests { if _, err := fmt.Fprintln(w, "---"); err != nil { return err } + + if _, err := fmt.Fprintln(w, manifest); err != nil { + return err + } } - if _, err := fmt.Fprintln(w, "apiVersion:", apiVersion); err != nil { - return err - } - if _, err := fmt.Fprintln(w, "kind:", kind); err != nil { - return err - } - if _, err := fmt.Fprint(w, body); err != nil { - return err - } - if !last { - return nil - } + // YAML ending document boundary marker _, err := fmt.Fprintln(w, "...") return err } if len(i.opts.Output) > 0 { - var body string + var manifests []string var err error - const tm = `{"apiVersion":"extensions/v1beta1","kind":"Deployment",` - if body, err = installer.DeploymentManifest(&i.opts); err != nil { + if manifests, err = installer.TillerManifests(&i.opts); err != nil { return err } switch i.opts.Output.String() { case "json": - var out bytes.Buffer - jsonb, err := yaml.ToJSON([]byte(body)) - if err != nil { - return err - } - buf := bytes.NewBuffer(make([]byte, 0, len(tm)+len(jsonb)-1)) - buf.WriteString(tm) - // Drop the opening object delimiter ('{'). - buf.Write(jsonb[1:]) - if err := json.Indent(&out, buf.Bytes(), "", " "); err != nil { - return err - } - if _, err = i.out.Write(out.Bytes()); err != nil { - return err + for _, manifest := range manifests { + var out bytes.Buffer + jsonb, err := yaml.ToJSON([]byte(manifest)) + if err != nil { + return err + } + buf := bytes.NewBuffer(jsonb) + if err := json.Indent(&out, buf.Bytes(), "", " "); err != nil { + return err + } + if _, err = i.out.Write(out.Bytes()); err != nil { + return err + } + fmt.Fprint(i.out, "\n") } - return nil case "yaml": - if err := writeYAMLManifest("extensions/v1beta1", "Deployment", body, true, false); err != nil { - return err - } - return nil + return writeYAMLManifests(manifests) default: return fmt.Errorf("unknown output format: %q", i.opts.Output) } } if settings.Debug { - - var body string + var manifests []string var err error - // write Deployment manifest - if body, err = installer.DeploymentManifest(&i.opts); err != nil { - return err - } - if err := writeYAMLManifest("extensions/v1beta1", "Deployment", body, true, false); err != nil { + // write Tiller manifests + if manifests, err = installer.TillerManifests(&i.opts); err != nil { return err } - // write Service manifest - if body, err = installer.ServiceManifest(i.namespace); err != nil { - return err - } - if err := writeYAMLManifest("v1", "Service", body, false, !i.opts.EnableTLS); err != nil { + if err = writeYAMLManifests(manifests); err != nil { return err } - - // write Secret manifest - if i.opts.EnableTLS { - if body, err = installer.SecretManifest(&i.opts); err != nil { - return err - } - if err := writeYAMLManifest("v1", "Secret", body, false, true); err != nil { - return err - } - } } if i.dryRun { @@ -289,7 +278,7 @@ func (i *initCmd) run() error { if !i.clientOnly { if i.kubeClient == nil { - _, c, err := getKubeClient(settings.KubeContext) + _, c, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return fmt.Errorf("could not get kubernetes client: %s", err) } @@ -303,7 +292,7 @@ func (i *initCmd) run() error { if err := installer.Upgrade(i.kubeClient, &i.opts); err != nil { return fmt.Errorf("error when upgrading: %s", err) } - if err := i.ping(); err != nil { + if err := i.ping(i.opts.SelectImage()); err != nil { return err } fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been upgraded to the current version.") @@ -312,11 +301,14 @@ func (i *initCmd) run() error { "(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)") } } else { - fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.\n\n"+ - "Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.\n"+ - "For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation") + fmt.Fprintln(i.out, "\nTiller (the Helm server-side component) has been installed into your Kubernetes Cluster.") + if !tlsVerify { + fmt.Fprintln(i.out, "\nPlease note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.\n"+ + "To prevent this, run `helm init` with the --tiller-tls-verify flag.\n"+ + "For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation") + } } - if err := i.ping(); err != nil { + if err := i.ping(i.opts.SelectImage()); err != nil { return err } } else { @@ -327,13 +319,13 @@ func (i *initCmd) run() error { return nil } -func (i *initCmd) ping() error { +func (i *initCmd) ping(image string) error { if i.wait { - _, kubeClient, err := getKubeClient(settings.KubeContext) + _, kubeClient, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return err } - if !watchTillerUntilReady(settings.TillerNamespace, kubeClient, settings.TillerConnectionTimeout) { + if !watchTillerUntilReady(settings.TillerNamespace, kubeClient, settings.TillerConnectionTimeout, image) { return fmt.Errorf("tiller was not found. polling deadline exceeded") } @@ -465,7 +457,7 @@ func ensureRepoFileFormat(file string, out io.Writer) error { // want to wait before we call New(). // // Returns true if it exists. If the timeout was reached and it could not find the pod, it returns false. -func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeout int64) bool { +func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeout int64, newImage string) bool { deadlinePollingChan := time.NewTimer(time.Duration(timeout) * time.Second).C checkTillerPodTicker := time.NewTicker(500 * time.Millisecond) doneChan := make(chan bool) @@ -474,8 +466,8 @@ func watchTillerUntilReady(namespace string, client kubernetes.Interface, timeou go func() { for range checkTillerPodTicker.C { - _, err := portforwarder.GetTillerPodName(client.CoreV1(), namespace) - if err == nil { + image, err := portforwarder.GetTillerPodImage(client.CoreV1(), namespace) + if err == nil && image == newImage { doneChan <- true break } diff --git a/cmd/helm/init_test.go b/cmd/helm/init_test.go index 6a5767fca..fd6ef97c4 100644 --- a/cmd/helm/init_test.go +++ b/cmd/helm/init_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package main import ( "bytes" + "io" "io/ioutil" "os" "path/filepath" @@ -32,11 +33,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + yamlutil "k8s.io/apimachinery/pkg/util/yaml" "k8s.io/client-go/kubernetes/fake" testcore "k8s.io/client-go/testing" - "encoding/json" - "k8s.io/helm/cmd/helm/installer" "k8s.io/helm/pkg/helm/helmpath" ) @@ -306,7 +306,7 @@ func TestInitCmd_tlsOptions(t *testing.T) { } } -// TestInitCmd_output tests that init -o formats are unmarshal-able +// TestInitCmd_output tests that init -o can be decoded func TestInitCmd_output(t *testing.T) { // This is purely defensive in this case. home, err := ioutil.TempDir("", "helm_home") @@ -320,26 +320,14 @@ func TestInitCmd_output(t *testing.T) { settings.Debug = dbg }() fc := fake.NewSimpleClientset() - tests := []struct { - expectF func([]byte, interface{}) error - expectName string - }{ - { - json.Unmarshal, - "json", - }, - { - yaml.Unmarshal, - "yaml", - }, - } + tests := []string{"json", "yaml"} for _, s := range tests { var buf bytes.Buffer cmd := &initCmd{ out: &buf, home: helmpath.Home(home), kubeClient: fc, - opts: installer.Options{Output: installer.OutputFormat(s.expectName)}, + opts: installer.Options{Output: installer.OutputFormat(s)}, namespace: v1.NamespaceDefault, } if err := cmd.run(); err != nil { @@ -348,10 +336,17 @@ func TestInitCmd_output(t *testing.T) { if got := len(fc.Actions()); got != 0 { t.Errorf("expected no server calls, got %d", got) } - d := &v1beta1.Deployment{} - if err = s.expectF(buf.Bytes(), &d); err != nil { - t.Errorf("error unmarshalling init %s output %s %s", s.expectName, err, buf.String()) + + var obj interface{} + decoder := yamlutil.NewYAMLOrJSONDecoder(&buf, 4096) + for { + err := decoder.Decode(&obj) + if err != nil { + if err == io.EOF { + break + } + t.Errorf("error decoding init %s output %s %s", s, err, buf.String()) + } } } - } diff --git a/cmd/helm/init_unix.go b/cmd/helm/init_unix.go index 1117dd487..bf61f1925 100644 --- a/cmd/helm/init_unix.go +++ b/cmd/helm/init_unix.go @@ -1,7 +1,7 @@ // +build !windows /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/init_windows.go b/cmd/helm/init_windows.go index be17bccda..447044bba 100644 --- a/cmd/helm/init_windows.go +++ b/cmd/helm/init_windows.go @@ -1,7 +1,7 @@ // +build windows /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/inspect.go b/cmd/helm/inspect.go index 999856959..c1861f7c5 100644 --- a/cmd/helm/inspect.go +++ b/cmd/helm/inspect.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/inspect_test.go b/cmd/helm/inspect_test.go index 44d71fbbd..b9dbf2ab6 100644 --- a/cmd/helm/inspect_test.go +++ b/cmd/helm/inspect_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/install.go b/cmd/helm/install.go index bffb96746..04bd20d98 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -37,8 +37,8 @@ import ( "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/kube" - "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" + "k8s.io/helm/pkg/renderutil" "k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/strvals" ) @@ -50,8 +50,10 @@ 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, to force -a string value use '--set-string'. +or use the '--set' flag and pass configuration from the command line. To force string +values in '--set', use '--set-string' instead. In case a value is large and therefore +you want not to use neither '--values' nor '--set', use '--set-file' to read the +single large value from file. $ helm install -f myvalues.yaml ./redis @@ -63,6 +65,9 @@ or $ helm install --set-string long_int=1234567890 ./redis +or + $ helm install --set-file multiline_text=path/to/textfile + You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: @@ -120,6 +125,7 @@ type installCmd struct { client helm.Interface values []string stringValues []string + fileValues []string nameTemplate string version string timeout int64 @@ -130,6 +136,7 @@ type installCmd struct { devel bool depUp bool subNotes bool + description string certFile string keyFile string @@ -187,6 +194,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.VarP(&inst.valueFiles, "values", "f", "specify values in a YAML file or a URL(can specify multiple)") f.StringVarP(&inst.name, "name", "n", "", "release name. If unspecified, it will autogenerate one for you") f.StringVar(&inst.namespace, "namespace", "", "namespace to install the release into. Defaults to the current kube config namespace.") @@ -196,6 +204,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&inst.replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production") f.StringArrayVar(&inst.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringArrayVar(&inst.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&inst.fileValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") f.StringVar(&inst.nameTemplate, "name-template", "", "specify template used to name the release") f.BoolVar(&inst.verify, "verify", false, "verify the package before installing it") f.StringVar(&inst.keyring, "keyring", defaultKeyring(), "location of public keys used for verification") @@ -211,6 +220,10 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&inst.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.") f.BoolVar(&inst.depUp, "dep-up", false, "run helm dependency update before installing the chart") f.BoolVar(&inst.subNotes, "render-subchart-notes", false, "render subchart notes along with the parent") + f.StringVar(&inst.description, "description", "", "specify a description for the release") + + // set defaults from environment + settings.InitTLS(f) return cmd } @@ -222,7 +235,7 @@ func (i *installCmd) run() error { i.namespace = defaultNamespace() } - rawVals, err := vals(i.valueFiles, i.values, i.stringValues, i.certFile, i.keyFile, i.caFile) + rawVals, err := vals(i.valueFiles, i.values, i.stringValues, i.fileValues, i.certFile, i.keyFile, i.caFile) if err != nil { return err } @@ -247,7 +260,7 @@ func (i *installCmd) run() error { // If checkDependencies returns an error, we have unfulfilled dependencies. // As of Helm 2.4.0, this is treated as a stopping condition: // https://github.com/kubernetes/helm/issues/2209 - if err := checkDependencies(chartRequested, req); err != nil { + if err := renderutil.CheckDependencies(chartRequested, req); err != nil { if i.depUp { man := &downloader.Manager{ Out: i.out, @@ -260,6 +273,12 @@ func (i *installCmd) run() error { if err := man.Update(); err != nil { return prettyError(err) } + + // Update all dependencies which are present in /charts. + chartRequested, err = chartutil.Load(i.chartPath) + if err != nil { + return prettyError(err) + } } else { return prettyError(err) } @@ -280,7 +299,8 @@ func (i *installCmd) run() error { helm.InstallDisableCRDHook(i.disableCRDHook), helm.InstallSubNotes(i.subNotes), helm.InstallTimeout(i.timeout), - helm.InstallWait(i.wait)) + helm.InstallWait(i.wait), + helm.InstallDescription(i.description)) if err != nil { return prettyError(err) } @@ -337,8 +357,8 @@ func mergeValues(dest map[string]interface{}, src map[string]interface{}) map[st } // vals merges values from files specified via -f/--values and -// directly via --set or --set-string, marshaling them to YAML -func vals(valueFiles valueFiles, values []string, stringValues []string, CertFile, KeyFile, CAFile string) ([]byte, error) { +// directly via --set or --set-string or --set-file, marshaling them to YAML +func vals(valueFiles valueFiles, values []string, stringValues []string, fileValues []string, CertFile, KeyFile, CAFile string) ([]byte, error) { base := map[string]interface{}{} // User specified a values files via -f/--values @@ -378,6 +398,17 @@ func vals(valueFiles valueFiles, values []string, stringValues []string, CertFil } } + // User specified a value via --set-file + for _, value := range fileValues { + reader := func(rs []rune) (interface{}, error) { + bytes, err := readFile(string(rs), CertFile, KeyFile, CAFile) + return string(bytes), err + } + if err := strvals.ParseIntoFile(value, base, reader); err != nil { + return []byte{}, fmt.Errorf("failed parsing --set-file data: %s", err) + } + } + return yaml.Marshal(base) } @@ -485,35 +516,12 @@ func generateName(nameTemplate string) (string, error) { } func defaultNamespace() string { - if ns, _, err := kube.GetConfig(settings.KubeContext).Namespace(); err == nil { + if ns, _, err := kube.GetConfig(settings.KubeContext, settings.KubeConfig).Namespace(); err == nil { return ns } return "default" } -func checkDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error { - missing := []string{} - - deps := ch.GetDependencies() - for _, r := range reqs.Dependencies { - found := false - for _, d := range deps { - if d.Metadata.Name == r.Name { - found = true - break - } - } - if !found { - missing = append(missing, r.Name) - } - } - - if len(missing) > 0 { - return fmt.Errorf("found in requirements.yaml, but missing in charts/ directory: %s", strings.Join(missing, ", ")) - } - return nil -} - //readFile load a file from the local directory or a remote file with a url. func readFile(filePath, CertFile, KeyFile, CAFile string) ([]byte, error) { u, _ := url.Parse(filePath) diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index aa828c6ce..48d9fc8c1 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -115,6 +115,13 @@ func TestInstall(t *testing.T) { expected: "FOOBAR", resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "FOOBAR"}), }, + { + name: "install with custom description", + args: []string{"testdata/testcharts/alpine"}, + flags: []string{"--name", "virgil", "--description", "foobar"}, + expected: "virgil", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil", Description: "foobar"}), + }, // Install, perform chart verification along the way. { name: "install with verification, missing provenance", diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index becf412a1..6027fdba8 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import ( "k8s.io/api/extensions/v1beta1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/kubernetes" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" @@ -67,7 +68,7 @@ func Upgrade(client kubernetes.Interface, opts *Options) error { if semverCompare(tillerImage) == -1 && !opts.ForceUpgrade { return errors.New("current Tiller version is newer, use --force-upgrade to downgrade") } - obj.Spec.Template.Spec.Containers[0].Image = opts.selectImage() + obj.Spec.Template.Spec.Containers[0].Image = opts.SelectImage() obj.Spec.Template.Spec.Containers[0].ImagePullPolicy = opts.pullPolicy() obj.Spec.Template.Spec.ServiceAccountName = opts.ServiceAccount if _, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Update(obj); err != nil { @@ -104,7 +105,7 @@ func semverCompare(image string) int { // createDeployment creates the Tiller Deployment resource. func createDeployment(client extensionsclient.DeploymentsGetter, opts *Options) error { - obj, err := deployment(opts) + obj, err := generateDeployment(opts) if err != nil { return err } @@ -113,40 +114,68 @@ func createDeployment(client extensionsclient.DeploymentsGetter, opts *Options) } -// deployment gets the deployment object that installs Tiller. -func deployment(opts *Options) (*v1beta1.Deployment, error) { - return generateDeployment(opts) +// Deployment gets a deployment object that can be used to generate a manifest +// as a string. This object should not be submitted directly to the Kubernetes +// api +func Deployment(opts *Options) (*v1beta1.Deployment, error) { + dep, err := generateDeployment(opts) + if err != nil { + return nil, err + } + dep.TypeMeta = metav1.TypeMeta{ + Kind: "Deployment", + APIVersion: "extensions/v1beta1", + } + return dep, nil } // createService creates the Tiller service resource func createService(client corev1.ServicesGetter, namespace string) error { - obj := service(namespace) + obj := generateService(namespace) _, err := client.Services(obj.Namespace).Create(obj) return err } -// service gets the service object that installs Tiller. -func service(namespace string) *v1.Service { - return generateService(namespace) +// Service gets a service object that can be used to generate a manifest as a +// string. This object should not be submitted directly to the Kubernetes api +func Service(namespace string) *v1.Service { + svc := generateService(namespace) + svc.TypeMeta = metav1.TypeMeta{ + Kind: "Service", + APIVersion: "v1", + } + return svc } -// DeploymentManifest gets the manifest (as a string) that describes the Tiller Deployment -// resource. -func DeploymentManifest(opts *Options) (string, error) { - obj, err := deployment(opts) +// TillerManifests gets the Deployment, Service, and Secret (if tls-enabled) manifests +func TillerManifests(opts *Options) ([]string, error) { + dep, err := Deployment(opts) if err != nil { - return "", err + return []string{}, err + } + + svc := Service(opts.Namespace) + + objs := []runtime.Object{dep, svc} + + if opts.EnableTLS { + secret, err := Secret(opts) + if err != nil { + return []string{}, err + } + objs = append(objs, secret) + } + + manifests := make([]string, len(objs)) + for i, obj := range objs { + o, err := yaml.Marshal(obj) + if err != nil { + return []string{}, err + } + manifests[i] = string(o) } - buf, err := yaml.Marshal(obj) - return string(buf), err -} -// ServiceManifest gets the manifest (as a string) that describes the Tiller Service -// resource. -func ServiceManifest(namespace string) (string, error) { - obj := service(namespace) - buf, err := yaml.Marshal(obj) - return string(buf), err + return manifests, err } func generateLabels(labels map[string]string) map[string]string { @@ -189,11 +218,12 @@ func generateDeployment(opts *Options) (*v1beta1.Deployment, error) { Labels: labels, }, Spec: v1.PodSpec{ - ServiceAccountName: opts.ServiceAccount, + ServiceAccountName: opts.ServiceAccount, + AutomountServiceAccountToken: &opts.AutoMountServiceAccountToken, Containers: []v1.Container{ { Name: "tiller", - Image: opts.selectImage(), + Image: opts.SelectImage(), ImagePullPolicy: opts.pullPolicy(), Ports: []v1.ContainerPort{ {ContainerPort: 44134, Name: "tiller"}, @@ -321,14 +351,20 @@ func generateService(namespace string) *v1.Service { return s } -// SecretManifest gets the manifest (as a string) that describes the Tiller Secret resource. -func SecretManifest(opts *Options) (string, error) { - o, err := generateSecret(opts) +// Secret gets a secret object that can be used to generate a manifest as a +// string. This object should not be submitted directly to the Kubernetes api +func Secret(opts *Options) (*v1.Secret, error) { + secret, err := generateSecret(opts) if err != nil { - return "", err + return nil, err + } + + secret.TypeMeta = metav1.TypeMeta{ + Kind: "Secret", + APIVersion: "v1", } - buf, err := yaml.Marshal(o) - return string(buf), err + + return secret, nil } // createSecret creates the Tiller secret resource. diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index dbb7143e3..561b3ed6d 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ import ( "k8s.io/helm/pkg/version" ) -func TestDeploymentManifest(t *testing.T) { +func TestDeployment(t *testing.T) { tests := []struct { name string image string @@ -48,14 +48,10 @@ func TestDeploymentManifest(t *testing.T) { } for _, tt := range tests { - o, err := DeploymentManifest(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary}) + dep, err := Deployment(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary}) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var dep v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &dep); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } if got := dep.Spec.Template.Spec.Containers[0].Image; got != tt.expect { t.Errorf("%s: expected image %q, got %q", tt.name, tt.expect, got) @@ -71,7 +67,7 @@ func TestDeploymentManifest(t *testing.T) { } } -func TestDeploymentManifestForServiceAccount(t *testing.T) { +func TestDeploymentForServiceAccount(t *testing.T) { tests := []struct { name string image string @@ -84,22 +80,31 @@ func TestDeploymentManifestForServiceAccount(t *testing.T) { {"withoutSA", "", false, "gcr.io/kubernetes-helm/tiller:latest", "IfNotPresent", ""}, } for _, tt := range tests { - o, err := DeploymentManifest(&Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary, ServiceAccount: tt.serviceAccount}) + opts := &Options{Namespace: v1.NamespaceDefault, ImageSpec: tt.image, UseCanary: tt.canary, ServiceAccount: tt.serviceAccount} + d, err := Deployment(opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var d v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &d); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } if got := d.Spec.Template.Spec.ServiceAccountName; got != tt.serviceAccount { t.Errorf("%s: expected service account value %q, got %q", tt.name, tt.serviceAccount, got) } + if got := *d.Spec.Template.Spec.AutomountServiceAccountToken; got != false { + t.Errorf("%s: expected AutomountServiceAccountToken = %t, got %t", tt.name, false, got) + } + + opts.AutoMountServiceAccountToken = true + d, err = Deployment(opts) + if err != nil { + t.Fatalf("%s: error %q", tt.name, err) + } + if got := *d.Spec.Template.Spec.AutomountServiceAccountToken; got != true { + t.Errorf("%s: expected AutomountServiceAccountToken = %t, got %t", tt.name, true, got) + } } } -func TestDeploymentManifest_WithTLS(t *testing.T) { +func TestDeployment_WithTLS(t *testing.T) { tests := []struct { opts Options name string @@ -126,15 +131,11 @@ func TestDeploymentManifest_WithTLS(t *testing.T) { }, } for _, tt := range tests { - o, err := DeploymentManifest(&tt.opts) + d, err := Deployment(&tt.opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var d v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &d); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } // verify environment variable in deployment reflect the use of tls being enabled. if got := d.Spec.Template.Spec.Containers[0].Env[2].Value; got != tt.verify { t.Errorf("%s: expected tls verify env value %q, got %q", tt.name, tt.verify, got) @@ -146,14 +147,7 @@ func TestDeploymentManifest_WithTLS(t *testing.T) { } func TestServiceManifest(t *testing.T) { - o, err := ServiceManifest(v1.NamespaceDefault) - if err != nil { - t.Fatalf("error %q", err) - } - var svc v1.Service - if err := yaml.Unmarshal([]byte(o), &svc); err != nil { - t.Fatalf("error %q", err) - } + svc := Service(v1.NamespaceDefault) if got := svc.ObjectMeta.Namespace; got != v1.NamespaceDefault { t.Errorf("expected namespace %s, got %s", v1.NamespaceDefault, got) @@ -161,7 +155,7 @@ func TestServiceManifest(t *testing.T) { } func TestSecretManifest(t *testing.T) { - o, err := SecretManifest(&Options{ + obj, err := Secret(&Options{ VerifyTLS: true, EnableTLS: true, Namespace: v1.NamespaceDefault, @@ -174,11 +168,6 @@ func TestSecretManifest(t *testing.T) { t.Fatalf("error %q", err) } - var obj v1.Secret - if err := yaml.Unmarshal([]byte(o), &obj); err != nil { - t.Fatalf("error %q", err) - } - if got := obj.ObjectMeta.Namespace; got != v1.NamespaceDefault { t.Errorf("expected namespace %s, got %s", v1.NamespaceDefault, got) } @@ -362,13 +351,13 @@ func TestInstall_canary(t *testing.T) { func TestUpgrade(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v1.0.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -403,7 +392,7 @@ func TestUpgrade(t *testing.T) { func TestUpgrade_serviceNotFound(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace", UseCanary: false, @@ -446,13 +435,13 @@ func TestUpgrade_serviceNotFound(t *testing.T) { func TestUgrade_newerVersion(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v100.5.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -506,13 +495,13 @@ func TestUgrade_newerVersion(t *testing.T) { func TestUpgrade_identical(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v2.0.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -547,13 +536,13 @@ func TestUpgrade_identical(t *testing.T) { func TestUpgrade_canaryClient(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:canary" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:v1.0.0", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -588,13 +577,13 @@ func TestUpgrade_canaryClient(t *testing.T) { func TestUpgrade_canaryServer(t *testing.T) { image := "gcr.io/kubernetes-helm/tiller:v2.0.0" serviceAccount := "newServiceAccount" - existingDeployment, _ := deployment(&Options{ + existingDeployment, _ := generateDeployment(&Options{ Namespace: v1.NamespaceDefault, ImageSpec: "imageToReplace:canary", ServiceAccount: "serviceAccountToReplace", UseCanary: false, }) - existingService := service(v1.NamespaceDefault) + existingService := generateService(v1.NamespaceDefault) fc := &fake.Clientset{} fc.AddReactor("get", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { @@ -634,7 +623,8 @@ func tlsTestFile(t *testing.T, path string) string { } return path } -func TestDeploymentManifest_WithNodeSelectors(t *testing.T) { + +func TestDeployment_WithNodeSelectors(t *testing.T) { tests := []struct { opts Options name string @@ -658,15 +648,11 @@ func TestDeploymentManifest_WithNodeSelectors(t *testing.T) { }, } for _, tt := range tests { - o, err := DeploymentManifest(&tt.opts) + d, err := Deployment(&tt.opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - var d v1beta1.Deployment - if err := yaml.Unmarshal([]byte(o), &d); err != nil { - t.Fatalf("%s: error %q", tt.name, err) - } // Verify that environment variables in Deployment reflect the use of TLS being enabled. got := d.Spec.Template.Spec.NodeSelector for k, v := range tt.expect { @@ -676,7 +662,8 @@ func TestDeploymentManifest_WithNodeSelectors(t *testing.T) { } } } -func TestDeploymentManifest_WithSetValues(t *testing.T) { + +func TestDeployment_WithSetValues(t *testing.T) { tests := []struct { opts Options name string @@ -703,11 +690,17 @@ func TestDeploymentManifest_WithSetValues(t *testing.T) { }, } for _, tt := range tests { - o, err := DeploymentManifest(&tt.opts) + d, err := Deployment(&tt.opts) if err != nil { t.Fatalf("%s: error %q", tt.name, err) } - values, err := chartutil.ReadValues([]byte(o)) + + o, err := yaml.Marshal(d) + if err != nil { + t.Errorf("Error marshaling Deployment: %s", err) + } + + values, err := chartutil.ReadValues(o) if err != nil { t.Errorf("Error converting Deployment manifest to Values: %s", err) } diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index 13cf43dcc..196ad8de4 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -47,10 +47,13 @@ type Options struct { // ServiceAccount is the Kubernetes service account to add to Tiller. ServiceAccount string + // AutoMountServiceAccountToken determines whether or not the service account should be added to Tiller. + AutoMountServiceAccountToken bool + // Force allows to force upgrading tiller if deployed version is greater than current version ForceUpgrade bool - // ImageSpec indentifies the image Tiller will use when deployed. + // ImageSpec identifies the image Tiller will use when deployed. // // Valid if and only if UseCanary is false. ImageSpec string @@ -96,7 +99,8 @@ type Options struct { Values []string } -func (opts *Options) selectImage() string { +// SelectImage returns the image according to whether UseCanary is true or not +func (opts *Options) SelectImage() string { switch { case opts.UseCanary: return defaultImage + ":canary" diff --git a/cmd/helm/installer/uninstall.go b/cmd/helm/installer/uninstall.go index 818827ddb..db824ca0b 100644 --- a/cmd/helm/installer/uninstall.go +++ b/cmd/helm/installer/uninstall.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,10 +19,8 @@ package installer // import "k8s.io/helm/cmd/helm/installer" import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/apis/extensions" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" - coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" - "k8s.io/kubernetes/pkg/kubectl" + "k8s.io/client-go/kubernetes" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" ) const ( @@ -32,7 +30,7 @@ const ( ) // Uninstall uses Kubernetes client to uninstall Tiller. -func Uninstall(client internalclientset.Interface, opts *Options) error { +func Uninstall(client kubernetes.Interface, opts *Options) error { if err := deleteService(client.Core(), opts.Namespace); err != nil { return err } @@ -43,7 +41,7 @@ func Uninstall(client internalclientset.Interface, opts *Options) error { } // deleteService deletes the Tiller Service resource -func deleteService(client coreclient.ServicesGetter, namespace string) error { +func deleteService(client corev1.ServicesGetter, namespace string) error { err := client.Services(namespace).Delete(serviceName, &metav1.DeleteOptions{}) return ingoreNotFound(err) } @@ -51,14 +49,13 @@ func deleteService(client coreclient.ServicesGetter, namespace string) error { // deleteDeployment deletes the Tiller Deployment resource // We need to use the reaper instead of the kube API because GC for deployment dependents // is not yet supported at the k8s server level (<= 1.5) -func deleteDeployment(client internalclientset.Interface, namespace string) error { - reaper, _ := kubectl.ReaperFor(extensions.Kind("Deployment"), client) - err := reaper.Stop(namespace, deploymentName, 0, nil) +func deleteDeployment(client kubernetes.Interface, namespace string) error { + err := client.Extensions().Deployments(namespace).Delete(deploymentName, &metav1.DeleteOptions{}) return ingoreNotFound(err) } // deleteSecret deletes the Tiller Secret resource -func deleteSecret(client coreclient.SecretsGetter, namespace string) error { +func deleteSecret(client corev1.SecretsGetter, namespace string) error { err := client.Secrets(namespace).Delete(secretName, &metav1.DeleteOptions{}) return ingoreNotFound(err) } diff --git a/cmd/helm/installer/uninstall_test.go b/cmd/helm/installer/uninstall_test.go index 91b257d47..68bbd7c72 100644 --- a/cmd/helm/installer/uninstall_test.go +++ b/cmd/helm/installer/uninstall_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,23 +19,23 @@ package installer // import "k8s.io/helm/cmd/helm/installer" import ( "testing" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/kubernetes/fake" testcore "k8s.io/client-go/testing" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" ) func TestUninstall(t *testing.T) { fc := &fake.Clientset{} - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expected 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) } } @@ -45,44 +45,44 @@ func TestUninstall_serviceNotFound(t *testing.T) { return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "services"}, "1") }) - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expected 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) } } func TestUninstall_deploymentNotFound(t *testing.T) { fc := &fake.Clientset{} fc.AddReactor("delete", "deployments", func(action testcore.Action) (bool, runtime.Object, error) { - return true, nil, apierrors.NewNotFound(core.Resource("deployments"), "1") + return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "deployments"}, "1") }) - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expected 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expected 3 actions got %d", actions, len(actions)) } } func TestUninstall_secretNotFound(t *testing.T) { fc := &fake.Clientset{} fc.AddReactor("delete", "secrets", func(action testcore.Action) (bool, runtime.Object, error) { - return true, nil, apierrors.NewNotFound(core.Resource("secrets"), "1") + return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "secrets"}, "1") }) - opts := &Options{Namespace: core.NamespaceDefault} + opts := &Options{Namespace: v1.NamespaceDefault} if err := Uninstall(fc, opts); err != nil { t.Errorf("unexpected error: %#+v", err) } - if actions := fc.Actions(); len(actions) != 7 { - t.Errorf("unexpected actions: %v, expect 7 actions got %d", actions, len(actions)) + if actions := fc.Actions(); len(actions) != 3 { + t.Errorf("unexpected actions: %v, expect 3 actions got %d", actions, len(actions)) } } diff --git a/cmd/helm/lint.go b/cmd/helm/lint.go index 63f11c062..d0159d34b 100644 --- a/cmd/helm/lint.go +++ b/cmd/helm/lint.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ type lintCmd struct { valueFiles valueFiles values []string sValues []string + fValues []string namespace string strict bool paths []string @@ -73,7 +74,8 @@ func newLintCmd(out io.Writer) *cobra.Command { cmd.Flags().VarP(&l.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") cmd.Flags().StringArrayVar(&l.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") cmd.Flags().StringArrayVar(&l.sValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") - cmd.Flags().StringVar(&l.namespace, "namespace", "default", "namespace to install the release into (only used if --install is set)") + cmd.Flags().StringArrayVar(&l.fValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") + cmd.Flags().StringVar(&l.namespace, "namespace", "default", "namespace to put the release into") cmd.Flags().BoolVar(&l.strict, "strict", false, "fail on lint warnings") return cmd @@ -172,6 +174,12 @@ func lintChart(path string, vals []byte, namespace string, strict bool) (support return lint.All(chartPath, vals, namespace, strict), nil } +// vals merges values from files specified via -f/--values and +// directly via --set or --set-string or --set-file, marshaling them to YAML +// +// This func is implemented intentionally and separately from the `vals` func for the `install` and `upgrade` comammdsn. +// Compared to the alternative func, this func lacks the parameters for tls opts - ca key, cert, and ca cert. +// That's because this command, `lint`, is explicitly forbidden from making server connections. func (l *lintCmd) vals() ([]byte, error) { base := map[string]interface{}{} @@ -204,5 +212,16 @@ func (l *lintCmd) vals() ([]byte, error) { } } + // User specified a value via --set-file + for _, value := range l.fValues { + reader := func(rs []rune) (interface{}, error) { + bytes, err := ioutil.ReadFile(string(rs)) + return string(bytes), err + } + if err := strvals.ParseIntoFile(value, base, reader); err != nil { + return []byte{}, fmt.Errorf("failed parsing --set-file data: %s", err) + } + } + return yaml.Marshal(base) } diff --git a/cmd/helm/lint_test.go b/cmd/helm/lint_test.go index 973af9b63..67775893b 100644 --- a/cmd/helm/lint_test.go +++ b/cmd/helm/lint_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/list.go b/cmd/helm/list.go index c2633d21c..3ca3fbbfa 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,10 +17,12 @@ limitations under the License. package main import ( + "encoding/json" "fmt" "io" "strings" + "github.com/ghodss/yaml" "github.com/gosuri/uitable" "github.com/spf13/cobra" @@ -58,23 +60,40 @@ flag with the '--offset' flag allows you to page through results. ` type listCmd struct { - filter string - short bool - limit int - offset string - byDate bool - sortDesc bool - out io.Writer - all bool - deleted bool - deleting bool - deployed bool - failed bool - namespace string - superseded bool - pending bool - client helm.Interface - colWidth uint + filter string + short bool + limit int + offset string + byDate bool + sortDesc bool + out io.Writer + all bool + deleted bool + deleting bool + deployed bool + failed bool + namespace string + superseded bool + pending bool + client helm.Interface + colWidth uint + output string + byChartName bool +} + +type listResult struct { + Next string + Releases []listRelease +} + +type listRelease struct { + Name string + Revision int32 + Updated string + Status string + Chart string + AppVersion string + Namespace string } func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { @@ -101,6 +120,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVarP(&list.short, "short", "q", false, "output short (quiet) listing format") f.BoolVarP(&list.byDate, "date", "d", false, "sort by release date") f.BoolVarP(&list.sortDesc, "reverse", "r", false, "reverse the sort order") @@ -114,10 +134,15 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&list.pending, "pending", false, "show pending releases") f.StringVar(&list.namespace, "namespace", "", "show releases within a specific namespace") f.UintVar(&list.colWidth, "col-width", 60, "specifies the max column width of output") + f.StringVar(&list.output, "output", "", "output the specified format (json or yaml)") + f.BoolVarP(&list.byChartName, "chart-name", "c", false, "sort by chart name") // TODO: Do we want this as a feature of 'helm list'? //f.BoolVar(&list.superseded, "history", true, "show historical releases") + // set defaults from environment + settings.InitTLS(f) + return cmd } @@ -126,6 +151,9 @@ func (l *listCmd) run() error { if l.byDate { sortBy = services.ListSort_LAST_RELEASED } + if l.byChartName { + sortBy = services.ListSort_CHART_NAME + } sortOrder := services.ListSort_ASC if l.sortDesc { @@ -147,24 +175,21 @@ func (l *listCmd) run() error { if err != nil { return prettyError(err) } - - if len(res.GetReleases()) == 0 { + if res == nil { return nil } - if res.Next != "" && !l.short { - fmt.Fprintf(l.out, "\tnext: %s\n", res.Next) - } + rels := filterList(res.GetReleases()) - rels := filterList(res.Releases) + result := getListResult(rels, res.Next) - if l.short { - for _, r := range rels { - fmt.Fprintln(l.out, r.Name) - } - return nil + output, err := formatResult(l.output, l.short, result, l.colWidth) + + if err != nil { + return prettyError(err) } - fmt.Fprintln(l.out, formatList(rels, l.colWidth)) + + fmt.Fprintln(l.out, output) return nil } @@ -233,23 +258,98 @@ func (l *listCmd) statusCodes() []release.Status_Code { return status } -func formatList(rels []*release.Release, colWidth uint) string { - table := uitable.New() - - table.MaxColWidth = colWidth - table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "APP VERSION", "NAMESPACE") +func getListResult(rels []*release.Release, next string) listResult { + listReleases := []listRelease{} for _, r := range rels { md := r.GetChart().GetMetadata() - c := fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion()) t := "-" if tspb := r.GetInfo().GetLastDeployed(); tspb != nil { t = timeconv.String(tspb) } - s := r.GetInfo().GetStatus().GetCode().String() - v := r.GetVersion() - a := md.GetAppVersion() - n := r.GetNamespace() - table.AddRow(r.GetName(), v, t, s, c, a, n) + + lr := listRelease{ + Name: r.GetName(), + Revision: r.GetVersion(), + Updated: t, + Status: r.GetInfo().GetStatus().GetCode().String(), + Chart: fmt.Sprintf("%s-%s", md.GetName(), md.GetVersion()), + AppVersion: md.GetAppVersion(), + Namespace: r.GetNamespace(), + } + listReleases = append(listReleases, lr) } - return table.String() + + return listResult{ + Releases: listReleases, + Next: next, + } +} + +func shortenListResult(result listResult) []string { + names := []string{} + for _, r := range result.Releases { + names = append(names, r.Name) + } + + return names +} + +func formatResult(format string, short bool, result listResult, colWidth uint) (string, error) { + var output string + var err error + + var shortResult []string + var finalResult interface{} + if short { + shortResult = shortenListResult(result) + finalResult = shortResult + } else { + finalResult = result + } + + switch format { + case "": + if short { + output = formatTextShort(shortResult) + } else { + output = formatText(result, colWidth) + } + case "json": + o, e := json.Marshal(finalResult) + if e != nil { + err = fmt.Errorf("Failed to Marshal JSON output: %s", e) + } else { + output = string(o) + } + case "yaml": + o, e := yaml.Marshal(finalResult) + if e != nil { + err = fmt.Errorf("Failed to Marshal YAML output: %s", e) + } else { + output = string(o) + } + default: + err = fmt.Errorf("Unknown output format \"%s\"", format) + } + return output, err +} + +func formatText(result listResult, colWidth uint) string { + nextOutput := "" + if result.Next != "" { + nextOutput = fmt.Sprintf("\tnext: %s\n", result.Next) + } + + table := uitable.New() + table.MaxColWidth = colWidth + table.AddRow("NAME", "REVISION", "UPDATED", "STATUS", "CHART", "APP VERSION", "NAMESPACE") + for _, lr := range result.Releases { + table.AddRow(lr.Name, lr.Revision, lr.Updated, lr.Status, lr.Chart, lr.AppVersion, lr.Namespace) + } + + return fmt.Sprintf("%s%s", nextOutput, table.String()) +} + +func formatTextShort(shortResult []string) string { + return strings.Join(shortResult, "\n") } diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index e292b4b5a..934f10712 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,16 +18,18 @@ package main import ( "io" + "regexp" "testing" "github.com/spf13/cobra" "io/ioutil" + "os" + "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" - "os" ) func TestListCmd(t *testing.T) { @@ -46,6 +48,11 @@ func TestListCmd(t *testing.T) { ch, _ := chartutil.Load(chartPath) tests := []releaseCase{ + { + name: "empty", + rels: []*release.Release{}, + expected: "", + }, { name: "with a release", rels: []*release.Release{ @@ -67,6 +74,77 @@ func TestListCmd(t *testing.T) { }, expected: "NAME \tREVISION\tUPDATED \tSTATUS \tCHART \tAPP VERSION\tNAMESPACE\natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\t2.X.A \tdefault \n", }, + { + name: "with json output", + flags: []string{"--max", "1", "--output", "json"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide"}), + }, + expected: regexp.QuoteMeta(`{"Next":"atlas-guide","Releases":[{"Name":"thomas-guide","Revision":1,"Updated":"`) + `([^"]*)` + regexp.QuoteMeta(`","Status":"DEPLOYED","Chart":"foo-0.1.0-beta.1","AppVersion":"","Namespace":"default"}]} +`), + }, + { + name: "with yaml output", + flags: []string{"--max", "1", "--output", "yaml"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide"}), + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide"}), + }, + expected: regexp.QuoteMeta(`Next: atlas-guide +Releases: +- AppVersion: "" + Chart: foo-0.1.0-beta.1 + Name: thomas-guide + Namespace: default + Revision: 1 + Status: DEPLOYED + Updated: `) + `(.*)` + ` + +`, + }, + { + name: "with short json output", + flags: []string{"-q", "--output", "json"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), + }, + expected: regexp.QuoteMeta(`["atlas"] +`), + }, + { + name: "with short yaml output", + flags: []string{"-q", "--output", "yaml"}, + rels: []*release.Release{ + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas"}), + }, + expected: regexp.QuoteMeta(`- atlas + +`), + }, + { + name: "with json output without next", + flags: []string{"--output", "json"}, + rels: []*release.Release{}, + expected: regexp.QuoteMeta(`{"Next":"","Releases":[]} +`), + }, + { + name: "with yaml output without next", + flags: []string{"--output", "yaml"}, + rels: []*release.Release{}, + expected: regexp.QuoteMeta(`Next: "" +Releases: [] + +`), + }, + { + name: "with unknown output format", + flags: []string{"--output", "_unknown_"}, + rels: []*release.Release{}, + err: true, + expected: regexp.QuoteMeta(``), + }, { name: "list, one deployed, one failed", flags: []string{"-q"}, diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index f4c97bde7..158a69c88 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -22,12 +22,18 @@ import ( "os/exec" "path/filepath" "strings" + "syscall" "github.com/spf13/cobra" "k8s.io/helm/pkg/plugin" ) +type pluginError struct { + error + code int +} + // loadPlugins loads plugins into the command list. // // This follows a different pattern than the other commands because it has @@ -87,7 +93,11 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) { if err := prog.Run(); err != nil { if eerr, ok := err.(*exec.ExitError); ok { os.Stderr.Write(eerr.Stderr) - return fmt.Errorf("plugin %q exited with error", md.Name) + status := eerr.Sys().(syscall.WaitStatus) + return pluginError{ + error: fmt.Errorf("plugin %q exited with error", md.Name), + code: status.ExitStatus(), + } } return err } diff --git a/cmd/helm/package.go b/cmd/helm/package.go index ed44382c7..05fdf02f8 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import ( "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/provenance" + "k8s.io/helm/pkg/renderutil" "k8s.io/helm/pkg/repo" ) @@ -151,7 +152,7 @@ func (p *packageCmd) run() error { } if reqs, err := chartutil.LoadRequirements(ch); err == nil { - if err := checkDependencies(ch, reqs); err != nil { + if err := renderutil.CheckDependencies(ch, reqs); err != nil { return err } } else { @@ -214,7 +215,7 @@ func (p *packageCmd) clearsign(filename string) error { return err } - if err := signer.DecryptKey(promptUser); err != nil { + if err := signer.DecryptKey(passphraseFetcher); err != nil { return err } @@ -228,8 +229,13 @@ func (p *packageCmd) clearsign(filename string) error { return ioutil.WriteFile(filename+".prov", []byte(sig), 0755) } -// promptUser implements provenance.PassphraseFetcher -func promptUser(name string) ([]byte, error) { +// passphraseFetcher implements provenance.PassphraseFetcher +func passphraseFetcher(name string) ([]byte, error) { + var passphrase = settings.HelmKeyPassphrase() + if passphrase != "" { + return []byte(passphrase), nil + } + fmt.Printf("Password for key %q > ", name) pw, err := terminal.ReadPassword(int(syscall.Stdin)) fmt.Println() diff --git a/cmd/helm/package_test.go b/cmd/helm/package_test.go index 4404586e0..7ed9829a5 100644 --- a/cmd/helm/package_test.go +++ b/cmd/helm/package_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin.go b/cmd/helm/plugin.go index cf0b02f09..fbdd1245b 100644 --- a/cmd/helm/plugin.go +++ b/cmd/helm/plugin.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_install.go b/cmd/helm/plugin_install.go index f36178808..7d77be3fc 100644 --- a/cmd/helm/plugin_install.go +++ b/cmd/helm/plugin_install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_list.go b/cmd/helm/plugin_list.go index e7618f38a..9693baaa2 100644 --- a/cmd/helm/plugin_list.go +++ b/cmd/helm/plugin_list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_remove.go b/cmd/helm/plugin_remove.go index ec1154734..f30e5b516 100644 --- a/cmd/helm/plugin_remove.go +++ b/cmd/helm/plugin_remove.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_test.go b/cmd/helm/plugin_test.go index 2a4a0e9aa..2d06c3797 100644 --- a/cmd/helm/plugin_test.go +++ b/cmd/helm/plugin_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/plugin_update.go b/cmd/helm/plugin_update.go index d3778764d..f9d5a3fac 100644 --- a/cmd/helm/plugin_update.go +++ b/cmd/helm/plugin_update.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/printer.go b/cmd/helm/printer.go index ebb24bf7d..e98b71c64 100644 --- a/cmd/helm/printer.go +++ b/cmd/helm/printer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/release_testing.go b/cmd/helm/release_testing.go index bdfa87a60..f39d9b81f 100644 --- a/cmd/helm/release_testing.go +++ b/cmd/helm/release_testing.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -64,9 +64,13 @@ func newReleaseTestCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.Int64Var(&rlsTest.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&rlsTest.cleanup, "cleanup", false, "delete test pods upon completion") + // set defaults from environment + settings.InitTLS(f) + return cmd } diff --git a/cmd/helm/release_testing_test.go b/cmd/helm/release_testing_test.go index b946746d0..f4f64c16d 100644 --- a/cmd/helm/release_testing_test.go +++ b/cmd/helm/release_testing_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo.go b/cmd/helm/repo.go index 8acc762e2..9f1dc8928 100644 --- a/cmd/helm/repo.go +++ b/cmd/helm/repo.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 77a64cc89..bfb3f0174 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,9 +22,11 @@ import ( "github.com/spf13/cobra" + "golang.org/x/crypto/ssh/terminal" "k8s.io/helm/pkg/getter" "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/repo" + "syscall" ) type repoAddCmd struct { @@ -73,6 +75,16 @@ func newRepoAddCmd(out io.Writer) *cobra.Command { } func (a *repoAddCmd) run() error { + if a.username != "" && a.password == "" { + fmt.Fprint(a.out, "Password:") + password, err := readPassword() + fmt.Fprintln(a.out) + if err != nil { + return err + } + a.password = password + } + if err := addRepository(a.name, a.url, a.username, a.password, a.home, a.certFile, a.keyFile, a.caFile, a.noupdate); err != nil { return err } @@ -80,6 +92,14 @@ func (a *repoAddCmd) run() error { return nil } +func readPassword() (string, error) { + password, err := terminal.ReadPassword(int(syscall.Stdin)) + if err != nil { + return "", err + } + return string(password), nil +} + func addRepository(name, url, username, password string, home helmpath.Home, certFile, keyFile, caFile string, noUpdate bool) error { f, err := repo.LoadRepositoriesFile(home.RepositoryFile()) if err != nil { diff --git a/cmd/helm/repo_add_test.go b/cmd/helm/repo_add_test.go index 157b1cc5b..5a458cef7 100644 --- a/cmd/helm/repo_add_test.go +++ b/cmd/helm/repo_add_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_index.go b/cmd/helm/repo_index.go index 540057eb8..b3f49fb97 100644 --- a/cmd/helm/repo_index.go +++ b/cmd/helm/repo_index.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -91,7 +91,7 @@ func index(dir, url, mergeTo string) error { var i2 *repo.IndexFile if _, err := os.Stat(mergeTo); os.IsNotExist(err) { i2 = repo.NewIndexFile() - i2.WriteFile(mergeTo, 0755) + i2.WriteFile(mergeTo, 0644) } else { i2, err = repo.LoadIndexFile(mergeTo) if err != nil { @@ -101,5 +101,5 @@ func index(dir, url, mergeTo string) error { i.Merge(i2) } i.SortEntries() - return i.WriteFile(out, 0755) + return i.WriteFile(out, 0644) } diff --git a/cmd/helm/repo_index_test.go b/cmd/helm/repo_index_test.go index 4d6313f6c..0d5571ef7 100644 --- a/cmd/helm/repo_index_test.go +++ b/cmd/helm/repo_index_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_list.go b/cmd/helm/repo_list.go index 0f795b2b0..36887c69b 100644 --- a/cmd/helm/repo_list.go +++ b/cmd/helm/repo_list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_remove.go b/cmd/helm/repo_remove.go index 728852fa1..f13b8dadb 100644 --- a/cmd/helm/repo_remove.go +++ b/cmd/helm/repo_remove.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_remove_test.go b/cmd/helm/repo_remove_test.go index bc071b989..f52c3afc4 100644 --- a/cmd/helm/repo_remove_test.go +++ b/cmd/helm/repo_remove_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_update.go b/cmd/helm/repo_update.go index 51e5c0868..291b21b72 100644 --- a/cmd/helm/repo_update.go +++ b/cmd/helm/repo_update.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index 68f964f32..71dc87966 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/reset.go b/cmd/helm/reset.go index 9d3e17e03..887ce34d0 100644 --- a/cmd/helm/reset.go +++ b/cmd/helm/reset.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +23,8 @@ import ( "os" "github.com/spf13/cobra" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + + "k8s.io/client-go/kubernetes" "k8s.io/helm/cmd/helm/installer" "k8s.io/helm/pkg/helm" @@ -44,7 +45,7 @@ type resetCmd struct { out io.Writer home helmpath.Home client helm.Interface - kubeClient internalclientset.Interface + kubeClient kubernetes.Interface } func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { @@ -77,16 +78,20 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVarP(&d.force, "force", "f", false, "forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.)") f.BoolVar(&d.removeHelmHome, "remove-helm-home", false, "if set deletes $HELM_HOME") + // set defaults from environment + settings.InitTLS(f) + return cmd } // runReset uninstalls tiller from Kubernetes Cluster and deletes local config func (d *resetCmd) run() error { if d.kubeClient == nil { - c, err := getInternalKubeClient(settings.KubeContext) + _, c, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return fmt.Errorf("could not get kubernetes client: %s", err) } diff --git a/cmd/helm/reset_test.go b/cmd/helm/reset_test.go index 189b69273..78055d866 100644 --- a/cmd/helm/reset_test.go +++ b/cmd/helm/reset_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ import ( "strings" "testing" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" + "k8s.io/api/core/v1" + "k8s.io/client-go/kubernetes/fake" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm/helmpath" @@ -101,7 +101,7 @@ func verifyResetCmd(t *testing.T, tc resetCase) { home: helmpath.Home(home), client: c, kubeClient: fc, - namespace: core.NamespaceDefault, + namespace: v1.NamespaceDefault, } err = cmd.run() diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index 889b6ae28..0c46fa818 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ type rollbackCmd struct { client helm.Interface timeout int64 wait bool + description string } func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { @@ -77,12 +78,17 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVar(&rollback.dryRun, "dry-run", false, "simulate a rollback") f.BoolVar(&rollback.recreate, "recreate-pods", false, "performs pods restart for the resource if applicable") f.BoolVar(&rollback.force, "force", false, "force resource update through delete/recreate if needed") f.BoolVar(&rollback.disableHooks, "no-hooks", false, "prevent hooks from running during rollback") f.Int64Var(&rollback.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&rollback.wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout") + f.StringVar(&rollback.description, "description", "", "specify a description for the release") + + // set defaults from environment + settings.InitTLS(f) return cmd } @@ -96,7 +102,8 @@ func (r *rollbackCmd) run() error { helm.RollbackDisableHooks(r.disableHooks), helm.RollbackVersion(r.revision), helm.RollbackTimeout(r.timeout), - helm.RollbackWait(r.wait)) + helm.RollbackWait(r.wait), + helm.RollbackDescription(r.description)) if err != nil { return prettyError(err) } diff --git a/cmd/helm/rollback_test.go b/cmd/helm/rollback_test.go index f1479b2eb..a98a4096a 100644 --- a/cmd/helm/rollback_test.go +++ b/cmd/helm/rollback_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -45,6 +45,12 @@ func TestRollbackCmd(t *testing.T) { flags: []string{"--wait"}, expected: "Rollback was a success! Happy Helming!", }, + { + name: "rollback a release with description", + args: []string{"funny-honey", "1"}, + flags: []string{"--description", "foo"}, + expected: "Rollback was a success! Happy Helming!", + }, { name: "rollback a release without revision", args: []string{"funny-honey"}, diff --git a/cmd/helm/search.go b/cmd/helm/search.go index ab284a898..84f328d41 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/search/search.go b/cmd/helm/search/search.go index 6c4cb4aa4..04acb8690 100644 --- a/cmd/helm/search/search.go +++ b/cmd/helm/search/search.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/search/search_test.go b/cmd/helm/search/search_test.go index 574f55448..8432685fa 100644 --- a/cmd/helm/search/search_test.go +++ b/cmd/helm/search/search_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/search_test.go b/cmd/helm/search_test.go index 734f752f5..233f94572 100644 --- a/cmd/helm/search_test.go +++ b/cmd/helm/search_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/serve.go b/cmd/helm/serve.go index 21ae36da1..7ddae6ca2 100644 --- a/cmd/helm/serve.go +++ b/cmd/helm/serve.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ This command is intended to be used for educational and testing purposes only. It is best to rely on a dedicated web server or a cloud-hosted solution like Google Cloud Storage for production use. -See https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories +See https://github.com/helm/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories for more information on hosting chart repositories in a production setting. ` diff --git a/cmd/helm/status.go b/cmd/helm/status.go index b73b6f56e..b03453adc 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -76,8 +76,13 @@ func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command { }, } - cmd.PersistentFlags().Int32Var(&status.version, "revision", 0, "if set, display the status of the named release with revision") - cmd.PersistentFlags().StringVarP(&status.outfmt, "output", "o", "", "output the status in the specified format (json or yaml)") + f := cmd.Flags() + settings.AddFlagsTLS(f) + f.Int32Var(&status.version, "revision", 0, "if set, display the status of the named release with revision") + f.StringVarP(&status.outfmt, "output", "o", "", "output the status in the specified format (json or yaml)") + + // set defaults from environment + settings.InitTLS(f) return cmd } diff --git a/cmd/helm/status_test.go b/cmd/helm/status_test.go index 616b027f3..4a00b8698 100644 --- a/cmd/helm/status_test.go +++ b/cmd/helm/status_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 458df87b5..63609c18c 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,17 +27,15 @@ import ( "strings" "time" - "github.com/Masterminds/semver" "github.com/spf13/cobra" "k8s.io/helm/pkg/chartutil" - "k8s.io/helm/pkg/engine" + "k8s.io/helm/pkg/manifest" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" - util "k8s.io/helm/pkg/releaseutil" + "k8s.io/helm/pkg/renderutil" "k8s.io/helm/pkg/tiller" "k8s.io/helm/pkg/timeconv" - tversion "k8s.io/helm/pkg/version" ) const defaultDirectoryPermission = 0755 @@ -63,18 +61,20 @@ To render just one template in a chart, use '-x': ` type templateCmd struct { - namespace string - valueFiles valueFiles - chartPath string - out io.Writer - values []string - stringValues []string - nameTemplate string - showNotes bool - releaseName string - renderFiles []string - kubeVersion string - outputDir string + namespace string + valueFiles valueFiles + chartPath string + out io.Writer + values []string + stringValues []string + fileValues []string + nameTemplate string + showNotes bool + releaseName string + releaseIsUpgrade bool + renderFiles []string + kubeVersion string + outputDir string } func newTemplateCmd(out io.Writer) *cobra.Command { @@ -93,11 +93,13 @@ func newTemplateCmd(out io.Writer) *cobra.Command { f := cmd.Flags() f.BoolVar(&t.showNotes, "notes", false, "show the computed NOTES.txt file as well") f.StringVarP(&t.releaseName, "name", "n", "RELEASE-NAME", "release name") + f.BoolVar(&t.releaseIsUpgrade, "is-upgrade", false, "set .Release.IsUpgrade instead of .Release.IsInstall") f.StringArrayVarP(&t.renderFiles, "execute", "x", []string{}, "only execute the given templates") f.VarP(&t.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)") 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.StringArrayVar(&t.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&t.fileValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") f.StringVar(&t.nameTemplate, "name-template", "", "specify template used to name the release") f.StringVar(&t.kubeVersion, "kube-version", defaultKubeVersion, "kubernetes version used as Capabilities.KubeVersion.Major/Minor") f.StringVar(&t.outputDir, "output-dir", "", "writes the executed templates to files in output-dir instead of stdout") @@ -130,7 +132,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { t.namespace = defaultNamespace() } // get combined values and create config - rawVals, err := vals(t.valueFiles, t.values, t.stringValues, "", "", "") + rawVals, err := vals(t.valueFiles, t.values, t.stringValues, t.fileValues, "", "", "") if err != nil { return err } @@ -150,67 +152,21 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { return prettyError(err) } - if req, err := chartutil.LoadRequirements(c); err == nil { - if err := checkDependencies(c, req); err != nil { - return prettyError(err) - } - } else if err != chartutil.ErrRequirementsNotFound { - return fmt.Errorf("cannot load requirements: %v", err) - } - options := chartutil.ReleaseOptions{ - Name: t.releaseName, - Time: timeconv.Now(), - Namespace: t.namespace, - } - - err = chartutil.ProcessRequirementsEnabled(c, config) - if err != nil { - return err - } - err = chartutil.ProcessRequirementsImportValues(c) - if err != nil { - return err - } - - // Set up engine. - renderer := engine.New() - - caps := &chartutil.Capabilities{ - APIVersions: chartutil.DefaultVersionSet, - KubeVersion: chartutil.DefaultKubeVersion, - TillerVersion: tversion.GetVersionProto(), - } - - // kubernetes version - 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()) - caps.KubeVersion.GitVersion = fmt.Sprintf("v%d.%d.0", kv.Major(), kv.Minor()) - - vals, err := chartutil.ToRenderValuesCaps(c, config, options, caps) - if err != nil { - return err + renderOpts := renderutil.Options{ + ReleaseOptions: chartutil.ReleaseOptions{ + Name: t.releaseName, + IsInstall: !t.releaseIsUpgrade, + IsUpgrade: t.releaseIsUpgrade, + Time: timeconv.Now(), + Namespace: t.namespace, + }, + KubeVersion: t.kubeVersion, } - out, err := renderer.Render(c, vals) - listManifests := []tiller.Manifest{} + renderedTemplates, err := renderutil.Render(c, config, renderOpts) if err != nil { return err } - // extract kind and name - re := regexp.MustCompile("kind:(.*)\n") - for k, v := range out { - match := re.FindStringSubmatch(v) - h := "Unknown" - if len(match) == 2 { - h = strings.TrimSpace(match[1]) - } - m := tiller.Manifest{Name: k, Content: v, Head: &util.SimpleHead{Kind: h}} - listManifests = append(listManifests, m) - } if settings.Debug { rel := &release.Release{ @@ -224,7 +180,8 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { printRelease(os.Stdout, rel) } - var manifestsToRender []tiller.Manifest + listManifests := manifest.SplitManifests(renderedTemplates) + var manifestsToRender []manifest.Manifest // if we have a list of files to render, then check that each of the // provided files exists in the chart. @@ -240,7 +197,9 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } for _, manifest := range listManifests { - manifestPathSplit := strings.Split(manifest.Name, string(filepath.Separator)) + // manifest.Name is rendered using linux-style filepath separators on Windows as + // well as macOS/linux. + manifestPathSplit := strings.Split(manifest.Name, "/") // remove the chart name from the path manifestPathSplit = manifestPathSplit[1:] toJoin := append([]string{t.chartPath}, manifestPathSplit...) @@ -305,7 +264,7 @@ func writeToFile(outputDir string, name string, data string) error { defer f.Close() - _, err = f.WriteString(fmt.Sprintf("##---\n# Source: %s\n%s", name, data)) + _, err = f.WriteString(fmt.Sprintf("---\n# Source: %s\n%s", name, data)) if err != nil { return err diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index cad42db16..64924c2f2 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -68,8 +68,8 @@ func TestTemplateCmd(t *testing.T) { }, { name: "check_execute_non_existent", - desc: "verify --execute fails on a template that doesnt exist", - args: []string{subchart1ChartPath, "-x", "templates/thisdoesntexist.yaml"}, + desc: "verify --execute fails on a template that doesn't exist", + args: []string{subchart1ChartPath, "-x", "templates/thisdoesn'texist.yaml"}, expectError: "could not find template", }, { @@ -107,6 +107,20 @@ func TestTemplateCmd(t *testing.T) { expectKey: "subchart1/templates/service.yaml", expectValue: "release-name: \"test\"", }, + { + name: "check_release_is_install", + desc: "verify --is-upgrade toggles .Release.IsInstall", + args: []string{subchart1ChartPath, "--is-upgrade=false"}, + expectKey: "subchart1/templates/service.yaml", + expectValue: "release-is-install: \"true\"", + }, + { + name: "check_release_is_upgrade", + desc: "verify --is-upgrade toggles .Release.IsUpgrade", + args: []string{subchart1ChartPath, "--is-upgrade", "true"}, + expectKey: "subchart1/templates/service.yaml", + expectValue: "release-is-upgrade: \"true\"", + }, { name: "check_notes", desc: "verify --notes shows notes", diff --git a/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml b/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml index 96c98c38c..e18e90d29 100644 --- a/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml +++ b/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml @@ -6,7 +6,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.1.0 appVersion: 1.2.3 description: Deploy a basic Alpine Linux pod @@ -19,7 +19,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 appVersion: 2.3.4 description: Deploy a basic Alpine Linux pod diff --git a/cmd/helm/testdata/testcharts/alpine/Chart.yaml b/cmd/helm/testdata/testcharts/alpine/Chart.yaml index 6fbb27f18..fea865aa5 100644 --- a/cmd/helm/testdata/testcharts/alpine/Chart.yaml +++ b/cmd/helm/testdata/testcharts/alpine/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: alpine sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.1.0 diff --git a/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml index 424920782..b8ae22b6c 100644 --- a/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml @@ -6,12 +6,12 @@ metadata: # The "heritage" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{.Release.Service | quote }} + app.kubernetes.io/managed-by: {{.Release.Service | quote }} # The "release" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{.Release.Name | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} # This makes it easy to audit chart usage. - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" values: {{.Values.test.Name}} annotations: "helm.sh/created": {{.Release.Time.Seconds | quote }} diff --git a/cmd/helm/testdata/testcharts/novals/Chart.yaml b/cmd/helm/testdata/testcharts/novals/Chart.yaml index ce1a81da6..85f7a5d83 100644 --- a/cmd/helm/testdata/testcharts/novals/Chart.yaml +++ b/cmd/helm/testdata/testcharts/novals/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: novals sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.2.0 diff --git a/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml index c15ab8efc..f569d556c 100644 --- a/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml @@ -6,12 +6,12 @@ metadata: # The "heritage" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{.Release.Service | quote }} + app.kubernetes.io/managed-by: {{.Release.Service | quote }} # The "release" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{.Release.Name | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} # This makes it easy to audit chart usage. - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" annotations: "helm.sh/created": {{.Release.Time.Seconds | quote }} spec: diff --git a/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml b/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml index 6fbb27f18..fea865aa5 100644 --- a/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml +++ b/cmd/helm/testdata/testcharts/signtest/alpine/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: alpine sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.1.0 diff --git a/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 41a4d7d5c..d6c915c3a 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -25,32 +25,62 @@ import ( "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/helm" - "k8s.io/helm/pkg/storage/driver" + "k8s.io/helm/pkg/renderutil" + storageerrors "k8s.io/helm/pkg/storage/errors" ) const upgradeDesc = ` -This command upgrades a release to a new version of a chart. +This command upgrades a release to a specified version of a chart and/or updates chart values. -The upgrade arguments must be a release and chart. The chart -argument can be either: a chart reference('stable/mariadb'), a path to a chart directory, -a packaged chart, or a fully qualified URL. For chart references, the latest -version will be specified unless the '--version' flag is set. +Required arguments are release and chart. The chart argument can be one of: + - a chart reference('stable/mariadb'); use '--version' and '--devel' flags for versions other than latest, + - a path to a chart directory, + - a packaged chart, + - a fully qualified 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, to force string -values, use '--set-string'. +To customize the chart values, use any of + - '--values'/'-f' to pass in a yaml file holding settings, + - '--set' to provide one or more key=val pairs directly, + - '--set-string' to provide key=val forcing val to be stored as a string, + - '--set-file' to provide key=path to read a single large value from a file at path. -You can specify the '--values'/'-f' flag multiple times. The priority will be given to the -last (right-most) file specified. For example, if both myvalues.yaml and override.yaml -contained a key called 'Test', the value set in override.yaml would take precedence: +To edit or append to the existing customized values, add the + '--reuse-values' flag, otherwise any existing customized values are ignored. + +If no chart value arguments are provided on the command line, any existing customized values are carried +forward. If you want to revert to just the values provided in the chart, use the '--reset-values' flag. + +You can specify any of the chart value flags multiple times. The priority will be given to the last +(right-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key +called 'Test', the value set in override.yaml would take precedence: $ helm upgrade -f myvalues.yaml -f override.yaml redis ./redis -You can specify the '--set' flag multiple times. The priority will be given to the -last (right-most) set specified. For example, if both 'bar' and 'newbar' values are -set for a key called 'foo', the 'newbar' value would take precedence: +Note that the key name provided to the '--set', '--set-string' and '--set-file' flags can reference +structure elements. Examples: + - mybool=TRUE + - livenessProbe.timeoutSeconds=10 + - metrics.annotations[0]=hey,metrics.annotations[1]=ho + +which sets the top level key mybool to true, the nested timeoutSeconds to 10, and two array values, respectively. + +Note that the value side of the key=val provided to '--set' and '--set-string' flags will pass through +shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with +special characters in unexpected ways, for example + + $ helm upgrade --set pwd=3jk$o2,z=f\30.e redis ./redis - $ helm upgrade --set foo=bar --set foo=newbar redis ./redis +results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaluation and argument delimiters, +and use backslash to escape yaml special characters: + + $ helm upgrade --set pwd='3jk$o2z=f\\30.e' redis ./redis + +which results in the expected "pwd: 3jk$o2z=f\30.e". If a single quote occurs in your value then follow +your shell convention for escaping it; for example in bash: + + $ helm upgrade --set pwd='3jk$o2z=f\\30with'\''quote' + +which results in "pwd: 3jk$o2z=f\30with'quote". ` type upgradeCmd struct { @@ -65,6 +95,7 @@ type upgradeCmd struct { valueFiles valueFiles values []string stringValues []string + fileValues []string verify bool keyring string install bool @@ -79,6 +110,7 @@ type upgradeCmd struct { password string devel bool subNotes bool + description string certFile string keyFile string @@ -116,12 +148,14 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { } f := cmd.Flags() + settings.AddFlagsTLS(f) f.VarP(&upgrade.valueFiles, "values", "f", "specify values in a YAML file or a URL(can specify multiple)") f.BoolVar(&upgrade.dryRun, "dry-run", false, "simulate an upgrade") f.BoolVar(&upgrade.recreate, "recreate-pods", false, "performs pods restart for the resource if applicable") f.BoolVar(&upgrade.force, "force", false, "force resource update through delete/recreate if needed") f.StringArrayVar(&upgrade.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") f.StringArrayVar(&upgrade.stringValues, "set-string", []string{}, "set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)") + f.StringArrayVar(&upgrade.fileValues, "set-file", []string{}, "set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)") f.BoolVar(&upgrade.disableHooks, "disable-hooks", false, "disable pre/post upgrade hooks. DEPRECATED. Use no-hooks") f.BoolVar(&upgrade.disableHooks, "no-hooks", false, "disable pre/post upgrade hooks") f.BoolVar(&upgrade.verify, "verify", false, "verify the provenance of the chart before upgrading") @@ -141,9 +175,13 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&upgrade.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") f.BoolVar(&upgrade.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.") f.BoolVar(&upgrade.subNotes, "render-subchart-notes", false, "render subchart notes along with parent") + f.StringVar(&upgrade.description, "description", "", "specify the description to use for the upgrade, rather than the default") f.MarkDeprecated("disable-hooks", "use --no-hooks instead") + // set defaults from environment + settings.InitTLS(f) + return cmd } @@ -175,7 +213,7 @@ func (u *upgradeCmd) run() error { } } - if err != nil && strings.Contains(err.Error(), driver.ErrReleaseNotFound(u.release).Error()) { + if err != nil && strings.Contains(err.Error(), storageerrors.ErrReleaseNotFound(u.release).Error()) { fmt.Fprintf(u.out, "Release %q does not exist. Installing it now.\n", u.release) ic := &installCmd{ chartPath: chartPath, @@ -189,15 +227,17 @@ func (u *upgradeCmd) run() error { keyring: u.keyring, values: u.values, stringValues: u.stringValues, + fileValues: u.fileValues, namespace: u.namespace, timeout: u.timeout, wait: u.wait, + description: u.description, } return ic.run() } } - rawVals, err := vals(u.valueFiles, u.values, u.stringValues, u.certFile, u.keyFile, u.caFile) + rawVals, err := vals(u.valueFiles, u.values, u.stringValues, u.fileValues, u.certFile, u.keyFile, u.caFile) if err != nil { return err } @@ -205,7 +245,7 @@ func (u *upgradeCmd) run() error { // Check chart requirements to make sure all dependencies are present in /charts if ch, err := chartutil.Load(chartPath); err == nil { if req, err := chartutil.LoadRequirements(ch); err == nil { - if err := checkDependencies(ch, req); err != nil { + if err := renderutil.CheckDependencies(ch, req); err != nil { return err } } else if err != chartutil.ErrRequirementsNotFound { @@ -227,7 +267,8 @@ func (u *upgradeCmd) run() error { helm.ResetValues(u.resetValues), helm.ReuseValues(u.reuseValues), helm.UpgradeSubNotes(u.subNotes), - helm.UpgradeWait(u.wait)) + helm.UpgradeWait(u.wait), + helm.UpgradeDescription(u.description)) if err != nil { return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) } diff --git a/cmd/helm/upgrade_test.go b/cmd/helm/upgrade_test.go index 187d3593e..60b529f63 100644 --- a/cmd/helm/upgrade_test.go +++ b/cmd/helm/upgrade_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -139,6 +139,14 @@ func TestUpgradeCmd(t *testing.T) { expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch})}, }, + { + name: "install a release with 'upgrade --install' and custom description", + args: []string{"crazy-bunny", chartPath}, + flags: []string{"-i", "--description", "foo"}, + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch, Description: "foo"}), + expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch, Description: "foo"})}, + }, { name: "upgrade a release with wait", args: []string{"crazy-bunny", chartPath}, @@ -147,6 +155,14 @@ func TestUpgradeCmd(t *testing.T) { expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2})}, }, + { + name: "upgrade a release with description", + args: []string{"crazy-bunny", chartPath}, + flags: []string{"--description", "foo"}, + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2}), + expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2, Description: "foo"})}, + }, { name: "upgrade a release with missing dependencies", args: []string{"bonkers-bunny", missingDepsPath}, diff --git a/cmd/helm/verify.go b/cmd/helm/verify.go index e82eb4e33..bbc8347c1 100644 --- a/cmd/helm/verify.go +++ b/cmd/helm/verify.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/verify_test.go b/cmd/helm/verify_test.go index 6e8b906fc..4d683df75 100644 --- a/cmd/helm/verify_test.go +++ b/cmd/helm/verify_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/cmd/helm/version.go b/cmd/helm/version.go index d541067a0..a803a990b 100644 --- a/cmd/helm/version.go +++ b/cmd/helm/version.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -73,21 +73,19 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command { if !version.showClient && !version.showServer { version.showClient, version.showServer = true, true } - if version.showServer { - // We do this manually instead of in PreRun because we only - // need a tunnel if server version is requested. - setupConnection() - } - version.client = ensureHelmClient(version.client) return version.run() }, } f := cmd.Flags() + settings.AddFlagsTLS(f) f.BoolVarP(&version.showClient, "client", "c", false, "client version only") f.BoolVarP(&version.showServer, "server", "s", false, "server version only") f.BoolVar(&version.short, "short", false, "print the version number") f.StringVar(&version.template, "template", "", "template for version string format") + // set defaults from environment + settings.InitTLS(f) + return cmd } @@ -108,6 +106,13 @@ func (v *versionCmd) run() error { return tpl(v.template, data, v.out) } + // We do this manually instead of in PreRun because we only + // need a tunnel if server version is requested. + if err := setupConnection(); err != nil { + return err + } + v.client = ensureHelmClient(v.client) + if settings.Debug { k8sVersion, err := getK8sVersion() if err != nil { @@ -115,7 +120,6 @@ func (v *versionCmd) run() error { } fmt.Fprintf(v.out, "Kubernetes: %#v\n", k8sVersion) } - resp, err := v.client.GetVersion() if err != nil { if grpc.Code(err) == codes.Unimplemented { @@ -135,7 +139,7 @@ func (v *versionCmd) run() error { func getK8sVersion() (*apiVersion.Info, error) { var v *apiVersion.Info - _, client, err := getKubeClient(settings.KubeContext) + _, client, err := getKubeClient(settings.KubeContext, settings.KubeConfig) if err != nil { return v, err } @@ -144,7 +148,7 @@ func getK8sVersion() (*apiVersion.Info, error) { } func formatVersion(v *pb.Version, short bool) string { - if short { + if short && v.GitCommit != "" { return fmt.Sprintf("%s+g%s", v.SemVer, v.GitCommit[:7]) } return fmt.Sprintf("%#v", v) diff --git a/cmd/helm/version_test.go b/cmd/helm/version_test.go index e25724f4c..c1223ef91 100644 --- a/cmd/helm/version_test.go +++ b/cmd/helm/version_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -57,6 +57,12 @@ func TestVersion(t *testing.T) { flags: []string{"--template", "{{ .Client.SemVer }} {{ .Server.SemVer }}"}, expected: lver + " " + sver, }, + { + name: "client short empty git", + args: []string{}, + flags: []string{"-c", "--short"}, + expected: lver, + }, } settings.TillerHost = "fake-localhost" runReleaseCases(t, tests, func(c *helm.FakeClient, out io.Writer) *cobra.Command { diff --git a/cmd/rudder/rudder.go b/cmd/rudder/rudder.go index 30ece3998..051640542 100644 --- a/cmd/rudder/rudder.go +++ b/cmd/rudder/rudder.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -21,12 +21,12 @@ import ( "fmt" "net" + "github.com/spf13/pflag" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" - "github.com/spf13/pflag" "k8s.io/helm/pkg/kube" rudderAPI "k8s.io/helm/pkg/proto/hapi/rudder" "k8s.io/helm/pkg/tiller" @@ -34,7 +34,7 @@ import ( ) var kubeClient *kube.Client -var clientset internalclientset.Interface +var clientset kubernetes.Interface type options struct { listen string @@ -59,7 +59,7 @@ func main() { opts.regAndParseFlags() var err error kubeClient = kube.New(nil) - clientset, err = kubeClient.ClientSet() + clientset, err = kubeClient.KubernetesClientSet() if err != nil { grpclog.Fatalf("Cannot initialize Kubernetes connection: %s", err) } diff --git a/cmd/tiller/probes.go b/cmd/tiller/probes.go index 144ad8a1b..7d209aa42 100644 --- a/cmd/tiller/probes.go +++ b/cmd/tiller/probes.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/probes_test.go b/cmd/tiller/probes_test.go index 0b13460e0..d13979a8a 100644 --- a/cmd/tiller/probes_test.go +++ b/cmd/tiller/probes_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index 5d2db3816..478ca92f4 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -37,6 +37,9 @@ import ( healthpb "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/keepalive" + // Import to initialize client auth plugins. + _ "k8s.io/client-go/plugin/pkg/client/auth" + "k8s.io/helm/pkg/kube" "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/storage" @@ -85,7 +88,7 @@ var ( // rootServer is the root gRPC server. // - // Each gRPC service registers itself to this server during init(). + // Each gRPC service registers itself to this server during start(). rootServer *grpc.Server // env is the default environment. @@ -118,7 +121,7 @@ func start() { healthSrv := health.NewServer() healthSrv.SetServingStatus("Tiller", healthpb.HealthCheckResponse_NOT_SERVING) - clientset, err := kube.New(nil).ClientSet() + clientset, err := kube.New(nil).KubernetesClientSet() if err != nil { logger.Fatalf("Cannot initialize Kubernetes connection: %s", err) } @@ -127,13 +130,13 @@ func start() { case storageMemory: env.Releases = storage.Init(driver.NewMemory()) case storageConfigMap: - cfgmaps := driver.NewConfigMaps(clientset.Core().ConfigMaps(namespace())) + cfgmaps := driver.NewConfigMaps(clientset.CoreV1().ConfigMaps(namespace())) cfgmaps.Log = newLogger("storage/driver").Printf env.Releases = storage.Init(cfgmaps) env.Releases.Log = newLogger("storage").Printf case storageSecret: - secrets := driver.NewSecrets(clientset.Core().Secrets(namespace())) + secrets := driver.NewSecrets(clientset.CoreV1().Secrets(namespace())) secrets.Log = newLogger("storage/driver").Printf env.Releases = storage.Init(secrets) diff --git a/cmd/tiller/tiller_test.go b/cmd/tiller/tiller_test.go index 0698e9d94..9ce153fc7 100644 --- a/cmd/tiller/tiller_test.go +++ b/cmd/tiller/tiller_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/tiller/trace.go b/cmd/tiller/trace.go index 71d7e8f72..126bbf83a 100644 --- a/cmd/tiller/trace.go +++ b/cmd/tiller/trace.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/docs/index.md b/docs/README.md similarity index 100% rename from docs/index.md rename to docs/README.md diff --git a/docs/chart_best_practices/README.md b/docs/chart_best_practices/README.md index 58cc65407..1160dc287 100644 --- a/docs/chart_best_practices/README.md +++ b/docs/chart_best_practices/README.md @@ -17,5 +17,5 @@ may find that their internal interests override our suggestions here. - Kubernetes Resources: - [Pods and Pod Specs](pods.md): See the best practices for working with pod specifications. - [Role-Based Access Control](rbac.md): Guidance on creating and using service accounts, roles, and role bindings. - - [Third Party Resources](third_party_resources.md): Third Party Resources (TPRs) have their own associated best practices. + - [Custom Resource Definitions](custom_resource_definitions.md): Custom Resource Definitions (CRDs) have their own associated best practices. diff --git a/docs/chart_best_practices/conventions.md b/docs/chart_best_practices/conventions.md index 324ef88f9..524928e25 100644 --- a/docs/chart_best_practices/conventions.md +++ b/docs/chart_best_practices/conventions.md @@ -4,19 +4,21 @@ This part of the Best Practices Guide explains general conventions. ## Chart Names -Chart names should be lower case letters and numbers. Words _may_ be separated with dashes (-): +Chart names should use lower case letters and numbers, and start with a letter. -Examples: +Hyphens (-) are allowed, but are known to be a little trickier to work with in Helm templates (see [issue #2192](https://github.com/helm/helm/issues/2192) for more information). + +Here are a few examples of good chart names from the [Helm Community Charts](https://github.com/helm/charts): ``` drupal -nginx-lego -aws-cluster-autoscaler +cert-manager +oauth2-proxy ``` Neither uppercase letters nor underscores should be used in chart names. Dots should not be used in chart names. -The directory that contains a chart MUST have the same name as the chart. Thus, the chart `nginx-lego` MUST be created in a directory called `nginx-lego/`. This is not merely a stylistic detail, but a requirement of the Helm Chart format. +The directory that contains a chart MUST have the same name as the chart. Thus, the chart `cert-manager` MUST be created in a directory called `cert-manager/`. This is not merely a stylistic detail, but a requirement of the Helm Chart format. ## Version Numbers diff --git a/docs/chart_best_practices/labels.md b/docs/chart_best_practices/labels.md index 7c3ac51db..6b7d24c49 100644 --- a/docs/chart_best_practices/labels.md +++ b/docs/chart_best_practices/labels.md @@ -10,7 +10,7 @@ An item of metadata should be a label under the following conditions: - It is used by Kubernetes to identify this resource - It is useful to expose to operators for the purpose of querying the system. -For example, we suggest using `chart: NAME-VERSION` as a label so that operators +For example, we suggest using `helm.sh/chart: NAME-VERSION` as a label so that operators can conveniently find all of the instances of a particular chart to use. If an item of metadata is not used for querying, it should be set as an annotation @@ -25,8 +25,12 @@ are recommended, and _should_ be placed onto a chart for global consistency. Tho Name|Status|Description -----|------|---------- -heritage | REC | This should always be set to `{{ .Release.Service }}`. It is for finding all things managed by Tiller. -release | REC | This should be the `{{ .Release.Name }}`. -chart | REC | This should be the chart name and version: `{{ .Chart.Name }}-{{ .Chart.Version \| replace "+" "_" }}`. -app | REC | This should be the app name, reflecting the entire app. Usually `{{ template "name" . }}` is used for this. This is used by many Kubernetes manifests, and is not Helm-specific. -component | OPT | This is a common label for marking the different roles that pieces may play in an application. For example, `component: frontend`. +`app.kubernetes.io/name` | REC | This should be the app name, reflecting the entire app. Usually `{{ template "name" . }}` is used for this. This is used by many Kubernetes manifests, and is not Helm-specific. +`helm.sh/chart` | REC | This should be the chart name and version: `{{ .Chart.Name }}-{{ .Chart.Version \| replace "+" "_" }}`. +`app.kubernetes.io/managed-by` | REC | This should always be set to `{{ .Release.Service }}`. It is for finding all things managed by Tiller. +`app.kubernetes.io/instance` | REC | This should be the `{{ .Release.Name }}`. It aids in differentiating between different instances of the same application. +`app.kubernetes.io/version` | OPT | The version of the app and can be set to `{{ .Chart.AppVersion }}`. +`app.kubernetes.io/component` | OPT | This is a common label for marking the different roles that pieces may play in an application. For example, `app.kubernetes.io/component: frontend`. +`app.kubernetes.io/part-of` | OPT | When multiple charts or pieces of software are used together to make one application. For example, application software and a database to produce a website. This can be set to the top level application being supported. + +You can find more information on the Kubernetes labels, prefixed with `app.kubernetes.io`, in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/). diff --git a/docs/chart_best_practices/pods.md b/docs/chart_best_practices/pods.md index 3f26b0253..bc9b42dd9 100644 --- a/docs/chart_best_practices/pods.md +++ b/docs/chart_best_practices/pods.md @@ -52,11 +52,11 @@ All PodTemplate sections should specify a selector. For example: ```yaml selector: matchLabels: - app: MyName + app.kubernetes.io/name: MyName template: metadata: labels: - app: MyName + app.kubernetes.io/name: MyName ``` This is a good practice because it makes the relationship between the set and diff --git a/docs/chart_best_practices/values.md b/docs/chart_best_practices/values.md index 2962e7d45..28e3a3eac 100644 --- a/docs/chart_best_practices/values.md +++ b/docs/chart_best_practices/values.md @@ -93,6 +93,7 @@ There are three potential sources of values: - A chart's `values.yaml` file - A values file supplied by `helm install -f` or `helm upgrade -f` - The values passed to a `--set` or `--set-string` flag on `helm install` or `helm upgrade` +- The content of a file passed to `--set-file` flag on `helm install` or `helm upgrade` When designing the structure of your values, keep in mind that users of your chart may want to override them via either the `-f` flag or with the `--set` diff --git a/docs/chart_repository.md b/docs/chart_repository.md index 01d457e63..91ae3a3c4 100644 --- a/docs/chart_repository.md +++ b/docs/chart_repository.md @@ -21,7 +21,7 @@ optionally some packaged charts. When you're ready to share your charts, the preferred way to do so is by uploading them to a chart repository. **Note:** For Helm 2.0.0, chart repositories do not have any intrinsic -authentication. There is an [issue tracking progress](https://github.com/kubernetes/helm/issues/1038) +authentication. There is an [issue tracking progress](https://github.com/helm/helm/issues/1038) in GitHub. Because a chart repository can be any HTTP server that can serve YAML and tar @@ -78,7 +78,7 @@ entries: home: https://k8s.io/helm name: alpine sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm urls: - https://technosophos.github.io/tscharts/alpine-0.2.0.tgz version: 0.2.0 @@ -88,7 +88,7 @@ entries: home: https://k8s.io/helm name: alpine sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm urls: - https://technosophos.github.io/tscharts/alpine-0.1.0.tgz version: 0.1.0 diff --git a/docs/chart_repository_faq.md b/docs/chart_repository_faq.md index a3e6392ba..a3340b661 100644 --- a/docs/chart_repository_faq.md +++ b/docs/chart_repository_faq.md @@ -3,7 +3,7 @@ This section tracks some of the more frequently encountered issues with using chart repositories. **We'd love your help** making this document better. To add, correct, or remove -information, [file an issue](https://github.com/kubernetes/helm/issues) or +information, [file an issue](https://github.com/helm/helm/issues) or send us a pull request. ## Fetching diff --git a/docs/chart_repository_sync_example.md b/docs/chart_repository_sync_example.md index de140c636..931275431 100644 --- a/docs/chart_repository_sync_example.md +++ b/docs/chart_repository_sync_example.md @@ -29,7 +29,7 @@ Upload the contents of the directory to your GCS bucket by running `scripts/sync For example: ```console $ pwd -/Users/funuser/go/src/github.com/kubernetes/helm +/Users/funuser/go/src/github.com/helm/helm $ scripts/sync-repo.sh fantastic-charts/ fantastic-charts Getting ready to sync your local directory (fantastic-charts/) to a remote repository at gs://fantastic-charts Verifying Prerequisites.... diff --git a/docs/chart_template_guide/accessing_files.md b/docs/chart_template_guide/accessing_files.md index 11747d4f0..c959002b7 100644 --- a/docs/chart_template_guide/accessing_files.md +++ b/docs/chart_template_guide/accessing_files.md @@ -130,7 +130,7 @@ Or ```yaml {{ range $path, $bytes := .Files.Glob "foo/*" }} -{{ $path.base }}: '{{ $root.Files.Get $path | b64enc }}' +{{ base $path }}: '{{ $root.Files.Get $path | b64enc }}' {{ end }} ``` diff --git a/docs/chart_template_guide/builtin_objects.md b/docs/chart_template_guide/builtin_objects.md index 11982229b..2108940ec 100644 --- a/docs/chart_template_guide/builtin_objects.md +++ b/docs/chart_template_guide/builtin_objects.md @@ -16,7 +16,7 @@ In the previous section, we use `{{.Release.Name}}` to insert the name of a rele - `Release.IsInstall`: This is set to `true` if the current operation is an install. - `Values`: Values passed into the template from the `values.yaml` file and from user-supplied files. By default, `Values` is empty. - `Chart`: The contents of the `Chart.yaml` file. Any data in `Chart.yaml` will be accessible here. For example `{{.Chart.Name}}-{{.Chart.Version}}` will print out the `mychart-0.1.0`. - - The available fields are listed in the [Charts Guide](https://github.com/kubernetes/helm/blob/master/docs/charts.md#the-chartyaml-file) + - The available fields are listed in the [Charts Guide](https://github.com/helm/helm/blob/master/docs/charts.md#the-chartyaml-file) - `Files`: This provides access to all non-special files in a chart. While you cannot use it to access templates, you can use it to access other files in the chart. See the section _Accessing Files_ for more. - `Files.Get` is a function for getting a file by name (`.Files.Get config.ini`) - `Files.GetBytes` is a function for getting the contents of a file as an array of bytes instead of as a string. This is useful for things like images. diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 7575ebc35..9ecd55142 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -40,7 +40,7 @@ A pipeline is evaluated as _false_ if the value is: - a `nil` (empty or null) - an empty collection (`map`, `slice`, `tuple`, `dict`, `array`) -Under all other conditions, the condition is true. +In any other case, the condition is evaluated to _true_ and the pipeline is executed. Let's add a simple conditional to our ConfigMap. We'll add another setting if the drink is set to coffee: @@ -53,10 +53,10 @@ data: myvalue: "Hello World" drink: {{ .Values.favorite.drink | default "tea" | quote }} food: {{ .Values.favorite.food | upper | quote }} - {{ if eq .Values.favorite.drink "coffee" }}mug: true{{ end }} + {{ if (.Values.favorite.drink) and eq .Values.favorite.drink "coffee" }}mug: true{{ end }} ``` -Since we commented out `drink: coffee` in our last example, the output should not include a `mug: true` flag. But if we add that line back into our `values.yaml` file, the output should look like this: +Note that `.Values.favorite.drink` must be defined or else it will throw an error when comparing it to "coffee". Since we commented out `drink: coffee` in our last example, the output should not include a `mug: true` flag. But if we add that line back into our `values.yaml` file, the output should look like this: ```yaml # Source: mychart/templates/configmap.yaml diff --git a/docs/chart_template_guide/subcharts_and_globals.md b/docs/chart_template_guide/subcharts_and_globals.md index 33274effe..a288556d8 100644 --- a/docs/chart_template_guide/subcharts_and_globals.md +++ b/docs/chart_template_guide/subcharts_and_globals.md @@ -201,7 +201,7 @@ will only accept a string literal. The Go template language provides a `block` keyword that allows developers to provide a default implementation which is overridden later. In Helm charts, blocks are not -the best tool for overriding because it if multiple implementations of the same block +the best tool for overriding because if multiple implementations of the same block are provided, the one selected is unpredictable. The suggestion is to instead use `include`. diff --git a/docs/chart_template_guide/values_files.md b/docs/chart_template_guide/values_files.md index 32a178735..a15047667 100644 --- a/docs/chart_template_guide/values_files.md +++ b/docs/chart_template_guide/values_files.md @@ -4,7 +4,7 @@ In the previous section we looked at the built-in objects that Helm templates of - The `values.yaml` file in the chart - If this is a subchart, the `values.yaml` file of a parent chart -- A values file if passed into `helm install` or `helm upgrade` with the `-f` flag (`helm install -f myvals.yaml ./mychart`) +- A values file is passed into `helm install` or `helm upgrade` with the `-f` flag (`helm install -f myvals.yaml ./mychart`) - Individual parameters passed with `--set` (such as `helm install --set foo=bar ./mychart`) The list above is in order of specificity: `values.yaml` is the default, which can be overridden by a parent chart's `values.yaml`, which can in turn be overridden by a user-supplied values file, which can in turn be overridden by `--set` parameters. diff --git a/docs/chart_template_guide/variables.md b/docs/chart_template_guide/variables.md index b55e6e422..d924fe2cf 100644 --- a/docs/chart_template_guide/variables.md +++ b/docs/chart_template_guide/variables.md @@ -113,11 +113,11 @@ metadata: labels: # Many helm templates would use `.` below, but that will not work, # however `$` will work here - app: {{ template "fullname" $ }} + app.kubernetes.io/name: {{ template "fullname" $ }} # I cannot reference .Chart.Name, but I can do $.Chart.Name - chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" - release: "{{ $.Release.Name }}" - heritage: "{{ $.Release.Service }}" + helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" + app.kubernetes.io/instance: "{{ $.Release.Name }}" + app.kubernetes.io/managed-by: "{{ $.Release.Service }}" type: kubernetes.io/tls data: tls.crt: {{ .certificate }} diff --git a/docs/chart_template_guide/wrapping_up.md b/docs/chart_template_guide/wrapping_up.md index 1ed7c602a..6a96632bd 100755 --- a/docs/chart_template_guide/wrapping_up.md +++ b/docs/chart_template_guide/wrapping_up.md @@ -13,8 +13,10 @@ But there are many things this guide has not covered when it comes to the practi - The [Go template docs](https://godoc.org/text/template) explain the template syntax in detail. - The [Schelm tool](https://github.com/databus23/schelm) is a nice helper utility for debugging charts. -Sometimes it's easier to ask a few questions and get answers from experienced developers. The best place to do that is in the Kubernetes `#Helm` Slack channel: +Sometimes it's easier to ask a few questions and get answers from experienced developers. The best place to do this is in the [Kubernetes Slack](https://kubernetes.slack.com) Helm channels: -- [Kubernetes Slack](https://slack.k8s.io/): `#helm` +- [#helm-users](https://kubernetes.slack.com/messages/helm-users) +- [#helm-dev](https://kubernetes.slack.com/messages/helm-dev) +- [#charts](https://kubernetes.slack.com/messages/charts) -Finally, if you find errors or omissions in this document, want to suggest some new content, or would like to contribute, visit [The Helm Project](https://github.com/kubernetes/helm). +Finally, if you find errors or omissions in this document, want to suggest some new content, or would like to contribute, visit [The Helm Project](https://github.com/helm/helm). diff --git a/docs/chart_tests.md b/docs/chart_tests.md index d1cfe5017..300eeaf73 100644 --- a/docs/chart_tests.md +++ b/docs/chart_tests.md @@ -8,7 +8,7 @@ Example tests: - Validate that your configuration from the values.yaml file was properly injected. - Make sure your username and password work correctly - Make sure an incorrect username and password does not work -- Assert that your services are up and correctly load balancing +- Assert that your services are up and correctly loadbalanced. - etc. You can run the pre-defined tests in Helm on a release using the command `helm test `. For a chart consumer, this is a great way to sanity check that their release of a chart (or application) works as expected. @@ -22,10 +22,10 @@ In Helm, there are two test hooks: `test-success` and `test-failure` ## Example Test -Here is an example of a helm test pod definition in an example mariadb chart: +Here is an example of a helm test pod definition in an example wordpress chart. The test verifies the access and login to the mariadb database: ``` -mariadb/ +wordpress/ Chart.yaml README.md values.yaml @@ -64,7 +64,7 @@ spec: ``` ## Steps to Run a Test Suite on a Release -1. `$ helm install mariadb` +1. `$ helm install wordpress` ``` NAME: quirky-walrus LAST DEPLOYED: Mon Feb 13 13:50:43 2017 diff --git a/docs/charts.md b/docs/charts.md index a55038e3e..669d90164 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -265,7 +265,7 @@ dependencies: - name: subchart1 repository: http://localhost:10191 version: 0.1.0 - condition: subchart1.enabled, global.subchart1.enabled + condition: subchart1.enabled,global.subchart1.enabled tags: - front-end - subchart1 @@ -303,7 +303,6 @@ The `--set` parameter can be used as usual to alter tag and condition values. ```` helm install --set tags.front-end=true --set subchart2.enabled=false - ```` ##### Tags and Condition Resolution @@ -489,7 +488,7 @@ the Kubernetes objects from the charts and all its dependencies are Hence a single release is created with all the objects for the chart and its dependencies. The install order of Kubernetes types is given by the enumeration InstallOrder in kind_sorter.go -(see [the Helm source file](https://github.com/kubernetes/helm/blob/master/pkg/tiller/kind_sorter.go#L26)). +(see [the Helm source file](https://github.com/helm/helm/blob/master/pkg/tiller/kind_sorter.go#L26)). ## Templates and Values @@ -527,15 +526,15 @@ metadata: name: deis-database namespace: deis labels: - heritage: deis + app.kubernetes.io/managed-by: deis spec: replicas: 1 selector: - app: deis-database + app.kubernetes.io/name: deis-database template: metadata: labels: - app: deis-database + app.kubernetes.io/name: deis-database spec: serviceAccount: deis-database containers: @@ -664,15 +663,15 @@ metadata: name: deis-database namespace: deis labels: - heritage: deis + app.kubernetes.io/managed-by: deis spec: replicas: 1 selector: - app: deis-database + app.kubernetes.io/name: deis-database template: metadata: labels: - app: deis-database + app.kubernetes.io/name: deis-database spec: serviceAccount: deis-database containers: @@ -849,8 +848,10 @@ considerations in mind: - The `Chart.yaml` will be overwritten by the generator. - Users will expect to modify such a chart's contents, so documentation should indicate how users can do so. -- All occurrences of `` will be replaced with the specified chart - name so that starter charts can be used as templates. +- All occurrences of `` in files within the `templates` directory + will be replaced with the specified chart name so that starter charts can be + used as templates. Additionally, occurrences of `` in + `values.yaml` will also be replaced. Currently the only way to add a chart to `$HELM_HOME/starters` is to manually copy it there. In your chart's documentation, you may want to explain that diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index f51749f57..59c9c91a2 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -127,9 +127,9 @@ kind: Job metadata: name: "{{.Release.Name}}" labels: - heritage: {{.Release.Service | quote }} - release: {{.Release.Name | quote }} - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + app.kubernetes.io/managed-by: {{.Release.Service | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" annotations: # This is what defines this resource as a hook. Without this line, the # job is considered part of the release. @@ -141,9 +141,9 @@ spec: metadata: name: "{{.Release.Name}}" labels: - heritage: {{.Release.Service | quote }} - release: {{.Release.Name | quote }} - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + app.kubernetes.io/managed-by: {{.Release.Service | quote }} + app.kubernetes.io/instance: {{.Release.Name | quote }} + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" spec: restartPolicy: Never containers: @@ -183,8 +183,7 @@ deterministic executing order. Weights are defined using the following annotatio ``` Hook weights can be positive or negative numbers but must be represented as -strings. When Tiller starts the execution cycle of hooks of a particular Kind it -will sort those hooks in ascending order. +strings. When Tiller starts the execution cycle of hooks of a particular kind (ex. the `pre-install` hooks or `post-install` hooks, etc.) it will sort those hooks in ascending order. It is also possible to define policies that determine when to delete corresponding hook resources. Hook deletion policies are defined using the following annotation: @@ -194,6 +193,7 @@ It is also possible to define policies that determine when to delete correspondi ``` You can choose one or more defined annotation values: + * `"hook-succeeded"` specifies Tiller should delete the hook after the hook is successfully executed. * `"hook-failed"` specifies Tiller should delete the hook if the hook failed during execution. * `"before-hook-creation"` specifies Tiller should delete the previous hook before the new hook is launched. diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index 484d8b936..a83b44457 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -106,6 +106,43 @@ For example: The above will render the template when .Values.foo is defined, but will fail to render and exit when .Values.foo is undefined. +## Using the 'tpl' Function + +The `tpl` function allows developers to evaluate strings as templates inside a template. +This is useful to pass a template string as a value to a chart or render external configuration files. +Syntax: `{{ tpl TEMPLATE_STRING VALUES }}` + +Examples: +``` +# values +template: "{{ .Values.name }}" +name: "Tom" + +# template +{{ tpl .Values.template . }} + +# output +Tom +``` + +Rendering a external configuration file: +``` +# external configuration file conf/app.conf +firstName={{ .Values.firstName }} +lastName={{ .Values.lastName }} + +# values +firstName: Peter +lastName: Parker + +# template +{{ tpl (.Files.Get "conf/app.conf") . }} + +# output +firstName=Peter +lastName=Parker +``` + ## Creating Image Pull Secrets Image pull secrets are essentially a combination of _registry_, _username_, and _password_. You may need them in an application you are deploying, but to create them requires running _base64_ a couple of times. We can write a helper template to compose the Docker configuration file for use as the Secret's payload. Here is an example: diff --git a/docs/developers.md b/docs/developers.md index e18c28d5d..4f1da2d96 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -27,7 +27,8 @@ This will build both Helm and Tiller. `make bootstrap` will attempt to install certain tools if they are missing. To run all the tests (without running the tests for `vendor/`), run -`make test`. +`make test`. To run all tests in a containerized environment, run `make +docker-test`. To run Helm and Tiller locally, you can run `bin/helm` or `bin/tiller`. @@ -131,7 +132,7 @@ elegant and high-quality open source code so that our users will benefit. Make sure you have read and understood the main CONTRIBUTING guide: -https://github.com/kubernetes/helm/blob/master/CONTRIBUTING.md +https://github.com/helm/helm/blob/master/CONTRIBUTING.md ### Structure of the Code @@ -161,7 +162,7 @@ We accept changes to the code via GitHub Pull Requests (PRs). One workflow for doing this is as follows: 1. Go to your `$GOPATH/src/k8s.io` directory and `git clone` the - `github.com/kubernetes/helm` repository. + `github.com/helm/helm` repository. 2. Fork that repository into your GitHub account 3. Add your repository as a remote for `$GOPATH/src/k8s.io/helm` 4. Create a new working branch (`git checkout -b feat/my-feature`) and @@ -209,6 +210,9 @@ We follow the Go coding style standards very closely. Typically, running We also typically follow the conventions recommended by `go lint` and `gometalinter`. Run `make test-style` to test the style conformance. +If you do not want to install all the linters from `gometalinter` into your +global Go environment, you can run `make docker-test-style` which will +run the same tests, but isolated within a docker container. Read more: diff --git a/docs/examples/README.md b/docs/examples/README.md index 723040ca8..f936e1551 100644 --- a/docs/examples/README.md +++ b/docs/examples/README.md @@ -14,6 +14,5 @@ It simply deploys a single pod running Alpine Linux. The `nginx` chart shows how to compose several resources into one chart, and it illustrates more complex template usage. -It deploys a `deployment` (which creates a `replica set`), a `config -map`, and a `service`. The replica set starts an nginx pod. The config +It deploys a `Deployment` (which creates a `ReplicaSet`), a `ConfigMap`, and a `Service`. The replica set starts an nginx pod. The config map stores the files that the nginx server can serve. diff --git a/docs/examples/alpine/Chart.yaml b/docs/examples/alpine/Chart.yaml index f4b660d4f..e56f8a469 100644 --- a/docs/examples/alpine/Chart.yaml +++ b/docs/examples/alpine/Chart.yaml @@ -1,7 +1,7 @@ name: alpine description: Deploy a basic Alpine Linux pod version: 0.1.0 -home: https://github.com/kubernetes/helm +home: https://github.com/helm/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm appVersion: 3.3 diff --git a/docs/examples/alpine/templates/alpine-pod.yaml b/docs/examples/alpine/templates/alpine-pod.yaml index da9caef78..1fc299b6d 100644 --- a/docs/examples/alpine/templates/alpine-pod.yaml +++ b/docs/examples/alpine/templates/alpine-pod.yaml @@ -3,16 +3,16 @@ kind: Pod metadata: name: {{ template "alpine.fullname" . }} labels: - # The "heritage" label is used to track which tool deployed a given chart. + # The "app.kubernetes.io/managed-by" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{ .Release.Service }} - # The "release" convention makes it easy to tie a release to all of the + app.kubernetes.io/managed-by: {{ .Release.Service }} + # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} # This makes it easy to audit chart usage. - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "alpine.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "alpine.name" . }} spec: # This shows how to use a simple value. This will look for a passed-in value called restartPolicy. restartPolicy: {{ .Values.restartPolicy }} diff --git a/docs/examples/nginx/Chart.yaml b/docs/examples/nginx/Chart.yaml index 807455210..3d6f5751b 100644 --- a/docs/examples/nginx/Chart.yaml +++ b/docs/examples/nginx/Chart.yaml @@ -7,7 +7,7 @@ keywords: - nginx - www - web -home: https://github.com/kubernetes/helm +home: https://github.com/helm/helm sources: - https://hub.docker.com/_/nginx/ maintainers: diff --git a/docs/examples/nginx/templates/configmap.yaml b/docs/examples/nginx/templates/configmap.yaml index b90d6c0c7..0141cbc69 100644 --- a/docs/examples/nginx/templates/configmap.yaml +++ b/docs/examples/nginx/templates/configmap.yaml @@ -4,10 +4,10 @@ kind: ConfigMap metadata: name: {{ template "nginx.fullname" . }} labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} data: # When the config map is mounted as a volume, these will be created as files. index.html: {{ .Values.index | quote }} diff --git a/docs/examples/nginx/templates/deployment.yaml b/docs/examples/nginx/templates/deployment.yaml index 5fa2633ea..08850935a 100644 --- a/docs/examples/nginx/templates/deployment.yaml +++ b/docs/examples/nginx/templates/deployment.yaml @@ -6,16 +6,16 @@ metadata: # multiple times into the same namespace. name: {{ template "nginx.fullname" . }} labels: - # The "heritage" label is used to track which tool deployed a given chart. + # The "app.kubernetes.io/managed-by" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{ .Release.Service }} - # The "release" convention makes it easy to tie a release to all of the + app.kubernetes.io/managed-by: {{ .Release.Service }} + # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} # This makes it easy to audit chart usage. - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} spec: replicas: {{ .Values.replicaCount }} template: @@ -26,8 +26,8 @@ spec: {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} labels: - app: {{ template "nginx.name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: containers: - name: {{ template "nginx.name" . }} diff --git a/docs/examples/nginx/templates/post-install-job.yaml b/docs/examples/nginx/templates/post-install-job.yaml index 9ec90cd0a..6e32086ab 100644 --- a/docs/examples/nginx/templates/post-install-job.yaml +++ b/docs/examples/nginx/templates/post-install-job.yaml @@ -3,16 +3,16 @@ kind: Job metadata: name: {{ template "nginx.fullname" . }} labels: - # The "heritage" label is used to track which tool deployed a given chart. + # The "app.kubernetes.io/managed-by" label is used to track which tool deployed a given chart. # It is useful for admins who want to see what releases a particular tool # is responsible for. - heritage: {{ .Release.Service }} - # The "release" convention makes it easy to tie a release to all of the + app.kubernetes.io/managed-by: {{ .Release.Service }} + # The "app.kubernetes.io/instance" convention makes it easy to tie a release to all of the # Kubernetes resources that were created as part of that release. - release: {{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} # This makes it easy to audit chart usage. - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} annotations: # This is what defines this resource as a hook. Without this line, the # job is considered part of the release. @@ -22,8 +22,8 @@ spec: metadata: name: {{ template "nginx.fullname" . }} labels: - release: {{ .Release.Name }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} spec: # This shows how to use a simple value. This will look for a passed-in value # called restartPolicy. If it is not found, it will use the default value. diff --git a/docs/examples/nginx/templates/pre-install-secret.yaml b/docs/examples/nginx/templates/pre-install-secret.yaml index 6392f9684..07a9504b5 100644 --- a/docs/examples/nginx/templates/pre-install-secret.yaml +++ b/docs/examples/nginx/templates/pre-install-secret.yaml @@ -5,10 +5,10 @@ kind: Secret metadata: name: {{ template "nginx.fullname" . }} labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} # This declares the resource to be a hook. By convention, we also name the # file "pre-install-XXX.yaml", but Helm itself doesn't care about file names. annotations: diff --git a/docs/examples/nginx/templates/service-test.yaml b/docs/examples/nginx/templates/service-test.yaml index 3913ead9c..ffb37e9f4 100644 --- a/docs/examples/nginx/templates/service-test.yaml +++ b/docs/examples/nginx/templates/service-test.yaml @@ -3,10 +3,10 @@ kind: Pod metadata: name: "{{ template "nginx.fullname" . }}-service-test" labels: - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - app: {{ template "nginx.name" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/name: {{ template "nginx.name" . }} annotations: "helm.sh/hook": test-success spec: diff --git a/docs/examples/nginx/templates/service.yaml b/docs/examples/nginx/templates/service.yaml index 1481e34f0..03f7aa2c6 100644 --- a/docs/examples/nginx/templates/service.yaml +++ b/docs/examples/nginx/templates/service.yaml @@ -6,10 +6,10 @@ metadata: {{ toYaml .Values.service.annotations | indent 4 }} {{- end }} labels: - app: {{ template "nginx.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - heritage: {{ .Release.Service }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} name: {{ template "nginx.fullname" . }} spec: # Provides options for the service so chart users have the full choice @@ -35,5 +35,5 @@ spec: nodePort: {{ .Values.service.nodePort }} {{- end }} selector: - app: {{ template "nginx.name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ template "nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/docs/helm/helm.md b/docs/helm/helm.md index 8592cad7c..177be7e88 100644 --- a/docs/helm/helm.md +++ b/docs/helm/helm.md @@ -4,7 +4,6 @@ The Helm package manager for Kubernetes. ### Synopsis - The Kubernetes package manager To begin working with Helm, run the 'helm init' command: @@ -22,25 +21,36 @@ Common actions from this point include: - helm list: list releases of charts Environment: - $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm - $HELM_HOST set an alternative Tiller host. The format is host:port - $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. - $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") - $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm + $HELM_HOST set an alternative Tiller host. The format is host:port + $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. + $TILLER_NAMESPACE set an alternative Tiller namespace (default "kube-system") + $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") + $HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem") + $HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem") + $HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem") + $HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false") + $HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default "false") + $HELM_KEY_PASSPHRASE set HELM_KEY_PASSPHRASE to the passphrase of your PGP private key. If set, you will not be prompted for + the passphrase while signing helm charts + ### Options ``` --debug enable verbose output + -h, --help help for helm --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm completion](helm_completion.md) - Generate autocompletions script for the specified shell (bash or zsh) * [helm create](helm_create.md) - create a new chart with the given name * [helm delete](helm_delete.md) - given a release name, delete the release from Kubernetes @@ -68,4 +78,4 @@ Environment: * [helm verify](helm_verify.md) - verify that a chart at the given path has been signed and is valid * [helm version](helm_version.md) - print the client/server version information -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 16-Oct-2018 diff --git a/docs/helm/helm_completion.md b/docs/helm/helm_completion.md index 994205d88..440393076 100644 --- a/docs/helm/helm_completion.md +++ b/docs/helm/helm_completion.md @@ -5,7 +5,6 @@ Generate autocompletions script for the specified shell (bash or zsh) ### Synopsis - Generate autocompletions script for Helm for the specified shell (bash or zsh). This command can generate shell autocompletions. e.g. @@ -18,7 +17,13 @@ Can be sourced as such ``` -helm completion SHELL +helm completion SHELL [flags] +``` + +### Options + +``` + -h, --help help for completion ``` ### Options inherited from parent commands @@ -28,11 +33,13 @@ helm completion SHELL --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_create.md b/docs/helm/helm_create.md index 6e0f3de78..2dc45a77c 100644 --- a/docs/helm/helm_create.md +++ b/docs/helm/helm_create.md @@ -5,7 +5,6 @@ create a new chart with the given name ### Synopsis - This command creates a chart directory along with the common files and directories used in a chart. @@ -14,15 +13,17 @@ something like this: foo/ | - |- .helmignore # Contains patterns to ignore when packaging Helm charts. + |- .helmignore # Contains patterns to ignore when packaging Helm charts. + | + |- Chart.yaml # Information about your chart | - |- Chart.yaml # Information about your chart + |- values.yaml # The default values for your templates | - |- values.yaml # The default values for your templates + |- charts/ # Charts that this chart depends on | - |- charts/ # Charts that this chart depends on + |- templates/ # The template files | - |- templates/ # The template files + |- templates/tests/ # The test files 'helm create' takes a path for an argument. If directories in the given path do not exist, Helm will attempt to create them as it goes. If the given @@ -31,12 +32,13 @@ will be overwritten, but other files will be left alone. ``` -helm create NAME +helm create NAME [flags] ``` ### Options ``` + -h, --help help for create -p, --starter string the named Helm starter scaffold ``` @@ -47,11 +49,13 @@ helm create NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 18-Sep-2018 diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index 5d41cd7ea..3c6a46844 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -5,7 +5,6 @@ given a release name, delete the release from Kubernetes ### Synopsis - This command takes a release name, and then deletes the release from Kubernetes. It removes all of the resources associated with the last release of the chart. @@ -20,15 +19,18 @@ helm delete [flags] RELEASE_NAME [...] ### Options ``` - --dry-run simulate a delete - --no-hooks prevent hooks from running during deletion - --purge remove the release from the store and make its name free for later use - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --description string specify a description for the release + --dry-run simulate a delete + -h, --help help for delete + --no-hooks prevent hooks from running during deletion + --purge remove the release from the store and make its name free for later use + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -38,11 +40,13 @@ helm delete [flags] RELEASE_NAME [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_dependency.md b/docs/helm/helm_dependency.md index 34d49e20a..317860bdb 100644 --- a/docs/helm/helm_dependency.md +++ b/docs/helm/helm_dependency.md @@ -5,7 +5,6 @@ manage a chart's dependencies ### Synopsis - Manage the dependencies of a chart. Helm charts store their dependencies in 'charts/'. For chart developers, it is @@ -54,6 +53,12 @@ repository added to helm by "helm add repo". Version matching is also supported for this case. +### Options + +``` + -h, --help help for dependency +``` + ### Options inherited from parent commands ``` @@ -61,14 +66,16 @@ for this case. --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm dependency build](helm_dependency_build.md) - rebuild the charts/ directory based on the requirements.lock file * [helm dependency list](helm_dependency_list.md) - list the dependencies for the given chart * [helm dependency update](helm_dependency_update.md) - update charts/ based on the contents of requirements.yaml -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_dependency_build.md b/docs/helm/helm_dependency_build.md index 0413a9a85..fba70f2ec 100644 --- a/docs/helm/helm_dependency_build.md +++ b/docs/helm/helm_dependency_build.md @@ -5,7 +5,6 @@ rebuild the charts/ directory based on the requirements.lock file ### Synopsis - Build out the charts/ directory from the requirements.lock file. Build is used to reconstruct a chart's dependencies to the state specified in @@ -23,6 +22,7 @@ helm dependency build [flags] CHART ### Options ``` + -h, --help help for build --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") --verify verify the packages against signatures ``` @@ -34,11 +34,13 @@ helm dependency build [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_dependency_list.md b/docs/helm/helm_dependency_list.md index b4343081c..da754c5d1 100644 --- a/docs/helm/helm_dependency_list.md +++ b/docs/helm/helm_dependency_list.md @@ -5,7 +5,6 @@ list the dependencies for the given chart ### Synopsis - List all of the dependencies declared in a chart. This can take chart archives and chart directories as input. It will not alter @@ -19,6 +18,12 @@ if it cannot find a requirements.yaml. helm dependency list [flags] CHART ``` +### Options + +``` + -h, --help help for list +``` + ### Options inherited from parent commands ``` @@ -26,11 +31,13 @@ helm dependency list [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_dependency_update.md b/docs/helm/helm_dependency_update.md index 3c90ff779..88bf3fafd 100644 --- a/docs/helm/helm_dependency_update.md +++ b/docs/helm/helm_dependency_update.md @@ -5,7 +5,6 @@ update charts/ based on the contents of requirements.yaml ### Synopsis - Update the on-disk dependencies to mirror the requirements.yaml file. This command verifies that the required charts, as expressed in 'requirements.yaml', @@ -27,6 +26,7 @@ helm dependency update [flags] CHART ### Options ``` + -h, --help help for update --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") --skip-refresh do not refresh the local repository cache --verify verify the packages against signatures @@ -39,11 +39,13 @@ helm dependency update [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm dependency](helm_dependency.md) - manage a chart's dependencies -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_fetch.md b/docs/helm/helm_fetch.md index 1ddef65fa..81c0a9596 100644 --- a/docs/helm/helm_fetch.md +++ b/docs/helm/helm_fetch.md @@ -5,7 +5,6 @@ download a chart from a repository and (optionally) unpack it in local directory ### Synopsis - Retrieve a package from a package repository, and download it locally. This is useful for fetching packages to inspect, modify, or repackage. It can @@ -31,6 +30,7 @@ helm fetch [flags] [chart URL | repo/chartname] [...] --cert-file string identify HTTPS client using this SSL certificate file -d, --destination string location to write the chart. If this and tardir are specified, tardir is appended to this (default ".") --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. + -h, --help help for fetch --key-file string identify HTTPS client using this SSL key file --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") --password string chart repository password @@ -50,9 +50,13 @@ helm fetch [flags] [chart URL | repo/chartname] [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. + +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_get.md b/docs/helm/helm_get.md index 9cd70e520..3b99c93d5 100644 --- a/docs/helm/helm_get.md +++ b/docs/helm/helm_get.md @@ -5,7 +5,6 @@ download a named release ### Synopsis - This command shows the details of a named release. It can be used to get extended information about the release, including: @@ -25,12 +24,14 @@ helm get [flags] RELEASE_NAME ### Options ``` - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -h, --help help for get + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -40,14 +41,17 @@ helm get [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm get hooks](helm_get_hooks.md) - download all hooks for a named release * [helm get manifest](helm_get_manifest.md) - download the manifest for a named release +* [helm get notes](helm_get_notes.md) - displays the notes of the named release * [helm get values](helm_get_values.md) - download the values file for a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Sep-2018 diff --git a/docs/helm/helm_get_hooks.md b/docs/helm/helm_get_hooks.md index 85fa5d04b..d7097fd59 100644 --- a/docs/helm/helm_get_hooks.md +++ b/docs/helm/helm_get_hooks.md @@ -5,7 +5,6 @@ download all hooks for a named release ### Synopsis - This command downloads hooks for a given release. Hooks are formatted in YAML and separated by the YAML '---\n' separator. @@ -18,12 +17,14 @@ helm get hooks [flags] RELEASE_NAME ### Options ``` - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -h, --help help for hooks + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -33,11 +34,13 @@ helm get hooks [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_get_manifest.md b/docs/helm/helm_get_manifest.md index a00c1be56..60bfeac0b 100644 --- a/docs/helm/helm_get_manifest.md +++ b/docs/helm/helm_get_manifest.md @@ -5,7 +5,6 @@ download the manifest for a named release ### Synopsis - This command fetches the generated manifest for a given release. A manifest is a YAML-encoded representation of the Kubernetes resources that @@ -20,12 +19,14 @@ helm get manifest [flags] RELEASE_NAME ### Options ``` - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -h, --help help for manifest + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -35,11 +36,13 @@ helm get manifest [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_get_notes.md b/docs/helm/helm_get_notes.md new file mode 100644 index 000000000..076aaaa59 --- /dev/null +++ b/docs/helm/helm_get_notes.md @@ -0,0 +1,44 @@ +## helm get notes + +displays the notes of the named release + +### Synopsis + + +This command shows notes provided by the chart of a named release. + + +``` +helm get notes [flags] RELEASE_NAME +``` + +### Options + +``` + -h, --help help for notes + --revision int32 get the notes of the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote +``` + +### Options inherited from parent commands + +``` + --debug enable verbose output + --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") + --host string address of Tiller. Overrides $HELM_HOST + --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use + --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) + --tiller-namespace string namespace of Tiller (default "kube-system") +``` + +### SEE ALSO + +* [helm get](helm_get.md) - download a named release + +###### Auto generated by spf13/cobra on 1-Sep-2018 diff --git a/docs/helm/helm_get_values.md b/docs/helm/helm_get_values.md index d8944b475..87d21b954 100644 --- a/docs/helm/helm_get_values.md +++ b/docs/helm/helm_get_values.md @@ -5,7 +5,6 @@ download the values file for a named release ### Synopsis - This command downloads a values file for a given release. @@ -16,13 +15,16 @@ helm get values [flags] RELEASE_NAME ### Options ``` - -a, --all dump all (computed) values - --revision int32 get the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -a, --all dump all (computed) values + -h, --help help for values + --output string output the specified format (json or yaml) (default "yaml") + --revision int32 get the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -32,11 +34,13 @@ helm get values [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm get](helm_get.md) - download a named release -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 7-Sep-2018 diff --git a/docs/helm/helm_history.md b/docs/helm/helm_history.md index ac51a8994..7f0a68928 100755 --- a/docs/helm/helm_history.md +++ b/docs/helm/helm_history.md @@ -5,7 +5,6 @@ fetch release history ### Synopsis - History prints historical revisions for a given release. A default maximum of 256 revisions will be returned. Setting '--max' @@ -28,14 +27,16 @@ helm history [flags] RELEASE_NAME ### Options ``` - --col-width uint specifies the max column width of output (default 60) - --max int32 maximum number of revision to include in history (default 256) - -o, --output string prints the output in the specified format (json|table|yaml) (default "table") - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --col-width uint specifies the max column width of output (default 60) + -h, --help help for history + --max int32 maximum number of revision to include in history (default 256) + -o, --output string prints the output in the specified format (json|table|yaml) (default "table") + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -45,11 +46,13 @@ helm history [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_home.md b/docs/helm/helm_home.md index bdccd756f..192302424 100644 --- a/docs/helm/helm_home.md +++ b/docs/helm/helm_home.md @@ -5,13 +5,18 @@ displays the location of HELM_HOME ### Synopsis - This command displays the location of HELM_HOME. This is where any helm configuration files live. ``` -helm home +helm home [flags] +``` + +### Options + +``` + -h, --help help for home ``` ### Options inherited from parent commands @@ -21,11 +26,13 @@ helm home --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_init.md b/docs/helm/helm_init.md index 5374488af..72fd9e86b 100644 --- a/docs/helm/helm_init.md +++ b/docs/helm/helm_init.md @@ -5,7 +5,6 @@ initialize Helm on both client and server ### Synopsis - This command installs Tiller (the Helm server-side component) onto your Kubernetes Cluster and sets up local configuration in $HELM_HOME (default ~/.helm/). @@ -27,34 +26,37 @@ To dump a manifest containing the Tiller deployment YAML, combine the ``` -helm init +helm init [flags] ``` ### Options ``` - --canary-image use the canary Tiller image - -c, --client-only if set does not install Tiller - --dry-run do not install local or remote - --force-upgrade force upgrade of Tiller to the current helm version - --history-max int limit the maximum number of revisions saved per release. Use 0 for no limit. - --local-repo-url string URL for local repository (default "http://127.0.0.1:8879/charts") - --net-host install Tiller with net=host - --node-selectors string labels to specify the node on which Tiller is installed (app=tiller,helm=rocks) - -o, --output OutputFormat skip installation and output Tiller's manifest in specified format (json or yaml) - --override stringArray override values for the Tiller Deployment manifest (can specify multiple or separate values with commas: key1=val1,key2=val2) - --replicas int amount of tiller instances to run on the cluster (default 1) - --service-account string name of service account - --skip-refresh do not refresh (download) the local repository cache - --stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") - -i, --tiller-image string override Tiller image - --tiller-tls install Tiller with TLS enabled - --tiller-tls-cert string path to TLS certificate file to install with Tiller - --tiller-tls-key string path to TLS key file to install with Tiller - --tiller-tls-verify install Tiller with TLS enabled and to verify remote certificates - --tls-ca-cert string path to CA root certificate - --upgrade upgrade if Tiller is already installed - --wait block until Tiller is running and ready to receive requests + --automount-service-account-token auto-mount the given service account to tiller (default true) + --canary-image use the canary Tiller image + -c, --client-only if set does not install Tiller + --dry-run do not install local or remote + --force-upgrade force upgrade of Tiller to the current helm version + -h, --help help for init + --history-max int limit the maximum number of revisions saved per release. Use 0 for no limit. + --local-repo-url string URL for local repository (default "http://127.0.0.1:8879/charts") + --net-host install Tiller with net=host + --node-selectors string labels to specify the node on which Tiller is installed (app=tiller,helm=rocks) + -o, --output OutputFormat skip installation and output Tiller's manifest in specified format (json or yaml) + --override stringArray override values for the Tiller Deployment manifest (can specify multiple or separate values with commas: key1=val1,key2=val2) + --replicas int amount of tiller instances to run on the cluster (default 1) + --service-account string name of service account + --skip-refresh do not refresh (download) the local repository cache + --stable-repo-url string URL for stable repository (default "https://kubernetes-charts.storage.googleapis.com") + -i, --tiller-image string override Tiller image + --tiller-tls install Tiller with TLS enabled + --tiller-tls-cert string path to TLS certificate file to install with Tiller + --tiller-tls-hostname string the server name used to verify the hostname on the returned certificates from Tiller + --tiller-tls-key string path to TLS key file to install with Tiller + --tiller-tls-verify install Tiller with TLS enabled and to verify remote certificates + --tls-ca-cert string path to CA root certificate + --upgrade upgrade if Tiller is already installed + --wait block until Tiller is running and ready to receive requests ``` ### Options inherited from parent commands @@ -64,11 +66,13 @@ helm init --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 4-Sep-2018 diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index e46b3dbf4..86689eeaa 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -5,7 +5,6 @@ inspect a chart ### Synopsis - This command inspects a chart and displays information. It takes a chart reference ('stable/drupal'), a full path to a directory or packaged chart, or a URL. @@ -13,7 +12,7 @@ Inspect prints the contents of the Chart.yaml file and the values.yaml file. ``` -helm inspect [CHART] +helm inspect [CHART] [flags] ``` ### Options @@ -21,6 +20,7 @@ helm inspect [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for inspect --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --password string chart repository password where to locate the requested chart @@ -37,14 +37,16 @@ helm inspect [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm inspect chart](helm_inspect_chart.md) - shows inspect chart * [helm inspect readme](helm_inspect_readme.md) - shows inspect readme * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index cd1328b59..2b9adbb7e 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -5,13 +5,12 @@ shows inspect chart ### Synopsis - This command inspects a chart (directory, file, or URL) and displays the contents of the Charts.yaml file ``` -helm inspect chart [CHART] +helm inspect chart [CHART] [flags] ``` ### Options @@ -19,6 +18,7 @@ helm inspect chart [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for chart --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --password string chart repository password where to locate the requested chart @@ -35,11 +35,13 @@ helm inspect chart [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_inspect_readme.md b/docs/helm/helm_inspect_readme.md index 9dd9ebd43..d222cd53a 100644 --- a/docs/helm/helm_inspect_readme.md +++ b/docs/helm/helm_inspect_readme.md @@ -5,13 +5,12 @@ shows inspect readme ### Synopsis - This command inspects a chart (directory, file, or URL) and displays the contents of the README file ``` -helm inspect readme [CHART] +helm inspect readme [CHART] [flags] ``` ### Options @@ -19,6 +18,7 @@ helm inspect readme [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for readme --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --repo string chart repository url where to locate the requested chart @@ -33,11 +33,13 @@ helm inspect readme [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 14-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index 6a907cc7d..9cca2fc32 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -5,13 +5,12 @@ shows inspect values ### Synopsis - This command inspects a chart (directory, file, or URL) and displays the contents of the values.yaml file ``` -helm inspect values [CHART] +helm inspect values [CHART] [flags] ``` ### Options @@ -19,6 +18,7 @@ helm inspect values [CHART] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + -h, --help help for values --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") --password string chart repository password where to locate the requested chart @@ -35,11 +35,13 @@ helm inspect values [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 9f1ad86b0..05cdf1e4a 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -5,15 +5,16 @@ install a chart archive ### Synopsis - This command installs a chart archive. 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, to force -a string value use '--set-string'. +or use the '--set' flag and pass configuration from the command line. To force string +values in '--set', use '--set-string' instead. In case a value is large and therefore +you want not to use neither '--values' nor '--set', use '--set-file' to read the +single large value from file. $ helm install -f myvalues.yaml ./redis @@ -25,6 +26,9 @@ or $ helm install --set-string long_int=1234567890 ./redis +or + $ helm install --set-file multiline_text=path/to/textfile + You can specify the '--values'/'-f' flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml contained a key called 'Test', the value set in override.yaml would take precedence: @@ -68,7 +72,7 @@ charts in a repository, use 'helm search'. ``` -helm install [CHART] +helm install [CHART] [flags] ``` ### Options @@ -77,8 +81,10 @@ helm install [CHART] --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file --dep-up run helm dependency update before installing the chart + --description string specify a description for the release --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an install + -h, --help help for install --key-file string identify HTTPS client using this SSL key file --keyring string location of public keys used for verification (default "~/.gnupg/pubring.gpg") -n, --name string release name. If unspecified, it will autogenerate one for you @@ -90,11 +96,13 @@ helm install [CHART] --replace re-use the given name, even if that name is already used. This is unsafe in production --repo string chart repository url where to locate the requested chart --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") --tls-verify enable TLS for request and verify remote --username string chart repository username where to locate the requested chart @@ -111,11 +119,13 @@ helm install [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 27-Apr-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_lint.md b/docs/helm/helm_lint.md index 596edf2bb..bf168184e 100644 --- a/docs/helm/helm_lint.md +++ b/docs/helm/helm_lint.md @@ -5,7 +5,6 @@ examines a chart for possible issues ### Synopsis - This command takes a path to a chart and runs a series of tests to verify that the chart is well-formed. @@ -21,8 +20,10 @@ helm lint [flags] PATH ### Options ``` - --namespace string namespace to install the release into (only used if --install is set) (default "default") + -h, --help help for lint + --namespace string namespace to put the release into (default "default") --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --strict fail on lint warnings -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) @@ -35,11 +36,13 @@ helm lint [flags] PATH --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_list.md b/docs/helm/helm_list.md index 1d5bf7ea2..5087c8a59 100755 --- a/docs/helm/helm_list.md +++ b/docs/helm/helm_list.md @@ -5,7 +5,6 @@ list releases ### Synopsis - This command lists all of the releases. By default, it lists only releases that are deployed or failed. Flags like @@ -39,24 +38,28 @@ helm list [flags] [FILTER] ### Options ``` - -a, --all show all releases, not just the ones marked DEPLOYED - --col-width uint specifies the max column width of output (default 60) - -d, --date sort by release date - --deleted show deleted releases - --deleting show releases that are currently being deleted - --deployed show deployed releases. If no other is specified, this will be automatically enabled - --failed show failed releases - -m, --max int maximum number of releases to fetch (default 256) - --namespace string show releases within a specific namespace - -o, --offset string next release name in the list, used to offset from start value - --pending show pending releases - -r, --reverse reverse the sort order - -q, --short output short (quiet) listing format - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -a, --all show all releases, not just the ones marked DEPLOYED + -c, --chart-name sort by chart name + --col-width uint specifies the max column width of output (default 60) + -d, --date sort by release date + --deleted show deleted releases + --deleting show releases that are currently being deleted + --deployed show deployed releases. If no other is specified, this will be automatically enabled + --failed show failed releases + -h, --help help for list + -m, --max int maximum number of releases to fetch (default 256) + --namespace string show releases within a specific namespace + -o, --offset string next release name in the list, used to offset from start value + --output string output the specified format (json or yaml) + --pending show pending releases + -r, --reverse reverse the sort order + -q, --short output short (quiet) listing format + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -66,11 +69,13 @@ helm list [flags] [FILTER] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Sep-2018 diff --git a/docs/helm/helm_package.md b/docs/helm/helm_package.md index 21090fa45..b772fa70c 100644 --- a/docs/helm/helm_package.md +++ b/docs/helm/helm_package.md @@ -5,7 +5,6 @@ package a chart directory into a chart archive ### Synopsis - This command packages a chart into a versioned chart archive file. If a path is given, this will look at that path for a chart (which must contain a Chart.yaml file) and then package that directory. @@ -26,6 +25,7 @@ helm package [flags] [CHART_PATH] [...] --app-version string set the appVersion on the chart to this version -u, --dependency-update update dependencies from "requirements.yaml" to dir "charts/" before packaging -d, --destination string location to write the chart. (default ".") + -h, --help help for package --key string name of the key to use when signing. Used if --sign is true --keyring string location of a public keyring (default "~/.gnupg/pubring.gpg") --save save packaged chart to local chart repository (default true) @@ -40,11 +40,13 @@ helm package [flags] [CHART_PATH] [...] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 16-Apr-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin.md b/docs/helm/helm_plugin.md index cc42aa4dc..5aa57b69c 100644 --- a/docs/helm/helm_plugin.md +++ b/docs/helm/helm_plugin.md @@ -5,10 +5,15 @@ add, list, or remove Helm plugins ### Synopsis - Manage client-side Helm plugins. +### Options + +``` + -h, --help help for plugin +``` + ### Options inherited from parent commands ``` @@ -16,15 +21,17 @@ Manage client-side Helm plugins. --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm plugin install](helm_plugin_install.md) - install one or more Helm plugins * [helm plugin list](helm_plugin_list.md) - list installed Helm plugins * [helm plugin remove](helm_plugin_remove.md) - remove one or more Helm plugins * [helm plugin update](helm_plugin_update.md) - update one or more Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_install.md b/docs/helm/helm_plugin_install.md index 196ca97dd..f30bfff55 100644 --- a/docs/helm/helm_plugin_install.md +++ b/docs/helm/helm_plugin_install.md @@ -5,7 +5,6 @@ install one or more Helm plugins ### Synopsis - This command allows you to install a plugin from a url to a VCS repo or a local path. Example usage: @@ -13,12 +12,13 @@ Example usage: ``` -helm plugin install [options] ... +helm plugin install [options] ... [flags] ``` ### Options ``` + -h, --help help for install --version string specify a version constraint. If this is not specified, the latest version is installed ``` @@ -29,11 +29,13 @@ helm plugin install [options] ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_list.md b/docs/helm/helm_plugin_list.md index ddfd04ee6..373462e2b 100644 --- a/docs/helm/helm_plugin_list.md +++ b/docs/helm/helm_plugin_list.md @@ -4,11 +4,16 @@ list installed Helm plugins ### Synopsis - list installed Helm plugins ``` -helm plugin list +helm plugin list [flags] +``` + +### Options + +``` + -h, --help help for list ``` ### Options inherited from parent commands @@ -18,11 +23,13 @@ helm plugin list --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_remove.md b/docs/helm/helm_plugin_remove.md index 8543a367a..30f222c9f 100644 --- a/docs/helm/helm_plugin_remove.md +++ b/docs/helm/helm_plugin_remove.md @@ -4,11 +4,16 @@ remove one or more Helm plugins ### Synopsis - remove one or more Helm plugins ``` -helm plugin remove ... +helm plugin remove ... [flags] +``` + +### Options + +``` + -h, --help help for remove ``` ### Options inherited from parent commands @@ -18,11 +23,13 @@ helm plugin remove ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_plugin_update.md b/docs/helm/helm_plugin_update.md index 9e5e205f0..65b16cd9d 100644 --- a/docs/helm/helm_plugin_update.md +++ b/docs/helm/helm_plugin_update.md @@ -4,11 +4,16 @@ update one or more Helm plugins ### Synopsis - update one or more Helm plugins ``` -helm plugin update ... +helm plugin update ... [flags] +``` + +### Options + +``` + -h, --help help for update ``` ### Options inherited from parent commands @@ -18,11 +23,13 @@ helm plugin update ... --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo.md b/docs/helm/helm_repo.md index 4109ceca4..0b73fbcd0 100644 --- a/docs/helm/helm_repo.md +++ b/docs/helm/helm_repo.md @@ -5,7 +5,6 @@ add, list, remove, update, and index chart repositories ### Synopsis - This command consists of multiple subcommands to interact with chart repositories. It can be used to add, remove, list, and index chart repositories. @@ -13,6 +12,12 @@ Example usage: $ helm repo add [NAME] [REPO_URL] +### Options + +``` + -h, --help help for repo +``` + ### Options inherited from parent commands ``` @@ -20,11 +25,13 @@ Example usage: --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. * [helm repo add](helm_repo_add.md) - add a chart repository * [helm repo index](helm_repo_index.md) - generate an index file given a directory containing packaged charts @@ -32,4 +39,4 @@ Example usage: * [helm repo remove](helm_repo_remove.md) - remove a chart repository * [helm repo update](helm_repo_update.md) - update information of available charts locally from chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_add.md b/docs/helm/helm_repo_add.md index 456ffa27e..29947147d 100644 --- a/docs/helm/helm_repo_add.md +++ b/docs/helm/helm_repo_add.md @@ -4,7 +4,6 @@ add a chart repository ### Synopsis - add a chart repository ``` @@ -16,6 +15,7 @@ helm repo add [flags] [NAME] [URL] ``` --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file + -h, --help help for add --key-file string identify HTTPS client using this SSL key file --no-update raise error if repo is already registered --password string chart repository password @@ -29,11 +29,13 @@ helm repo add [flags] [NAME] [URL] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_index.md b/docs/helm/helm_repo_index.md index 14b412b29..4660489f9 100644 --- a/docs/helm/helm_repo_index.md +++ b/docs/helm/helm_repo_index.md @@ -5,7 +5,6 @@ generate an index file given a directory containing packaged charts ### Synopsis - Read the current directory and generate an index file based on the charts found. This tool is used for creating an 'index.yaml' file for a chart repository. To @@ -23,6 +22,7 @@ helm repo index [flags] [DIR] ### Options ``` + -h, --help help for index --merge string merge the generated index into the given index --url string url of chart repository ``` @@ -34,11 +34,13 @@ helm repo index [flags] [DIR] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_list.md b/docs/helm/helm_repo_list.md index 858ef957f..bebaa6333 100644 --- a/docs/helm/helm_repo_list.md +++ b/docs/helm/helm_repo_list.md @@ -4,13 +4,18 @@ list chart repositories ### Synopsis - list chart repositories ``` helm repo list [flags] ``` +### Options + +``` + -h, --help help for list +``` + ### Options inherited from parent commands ``` @@ -18,11 +23,13 @@ helm repo list [flags] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_remove.md b/docs/helm/helm_repo_remove.md index 801bc3c3f..89f43a130 100644 --- a/docs/helm/helm_repo_remove.md +++ b/docs/helm/helm_repo_remove.md @@ -4,13 +4,18 @@ remove a chart repository ### Synopsis - remove a chart repository ``` helm repo remove [flags] [NAME] ``` +### Options + +``` + -h, --help help for remove +``` + ### Options inherited from parent commands ``` @@ -18,11 +23,13 @@ helm repo remove [flags] [NAME] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_repo_update.md b/docs/helm/helm_repo_update.md index 897ed24b7..0d14f63ed 100644 --- a/docs/helm/helm_repo_update.md +++ b/docs/helm/helm_repo_update.md @@ -5,7 +5,6 @@ update information of available charts locally from chart repositories ### Synopsis - Update gets the latest information about charts from the respective chart repositories. Information is cached locally, where it is used by commands like 'helm search'. @@ -14,7 +13,13 @@ future releases. ``` -helm repo update +helm repo update [flags] +``` + +### Options + +``` + -h, --help help for update ``` ### Options inherited from parent commands @@ -24,11 +29,13 @@ helm repo update --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm repo](helm_repo.md) - add, list, remove, update, and index chart repositories -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_reset.md b/docs/helm/helm_reset.md index ed68b1b84..772ac42c3 100644 --- a/docs/helm/helm_reset.md +++ b/docs/helm/helm_reset.md @@ -5,26 +5,27 @@ uninstalls Tiller from a cluster ### Synopsis - This command uninstalls Tiller (the Helm server-side component) from your Kubernetes Cluster and optionally deletes local configuration in $HELM_HOME (default ~/.helm/) ``` -helm reset +helm reset [flags] ``` ### Options ``` - -f, --force forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.) - --remove-helm-home if set deletes $HELM_HOME - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -f, --force forces Tiller uninstall even if there are releases installed, or if Tiller is not in ready state. Releases are not deleted.) + -h, --help help for reset + --remove-helm-home if set deletes $HELM_HOME + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -34,11 +35,13 @@ helm reset --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 4b6dcbbb2..5862b180a 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -5,7 +5,6 @@ roll back a release to a previous revision ### Synopsis - This command rolls back a release to a previous revision. The first argument of the rollback command is the name of a release, and the @@ -20,17 +19,20 @@ helm rollback [flags] [RELEASE] [REVISION] ### Options ``` - --dry-run simulate a rollback - --force force resource update through delete/recreate if needed - --no-hooks prevent hooks from running during rollback - --recreate-pods performs pods restart for the resource if applicable - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote - --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout + --description string specify a description for the release + --dry-run simulate a rollback + --force force resource update through delete/recreate if needed + -h, --help help for rollback + --no-hooks prevent hooks from running during rollback + --recreate-pods performs pods restart for the resource if applicable + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote + --wait if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout ``` ### Options inherited from parent commands @@ -40,11 +42,13 @@ helm rollback [flags] [RELEASE] [REVISION] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_search.md b/docs/helm/helm_search.md index 1ed04e880..c45a397e3 100644 --- a/docs/helm/helm_search.md +++ b/docs/helm/helm_search.md @@ -5,7 +5,6 @@ search for a keyword in charts ### Synopsis - Search reads through all of the repositories configured on the system, and looks for matches. @@ -13,13 +12,14 @@ Repositories are managed with 'helm repo' commands. ``` -helm search [keyword] +helm search [keyword] [flags] ``` ### Options ``` --col-width uint specifies the max column width of output (default 60) + -h, --help help for search -r, --regexp use regular expressions for searching -v, --version string search using semantic versioning constraints -l, --versions show the long listing, with each version of each chart on its own line @@ -32,11 +32,13 @@ helm search [keyword] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 23-Apr-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_serve.md b/docs/helm/helm_serve.md index 90ebb6da9..62a68595a 100644 --- a/docs/helm/helm_serve.md +++ b/docs/helm/helm_serve.md @@ -5,7 +5,6 @@ start a local http web server ### Synopsis - This command starts a local chart repository server that serves charts from a local directory. The new server will provide HTTP access to a repository. By default, it will @@ -16,18 +15,19 @@ This command is intended to be used for educational and testing purposes only. It is best to rely on a dedicated web server or a cloud-hosted solution like Google Cloud Storage for production use. -See https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories +See https://github.com/helm/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories for more information on hosting chart repositories in a production setting. ``` -helm serve +helm serve [flags] ``` ### Options ``` --address string address to listen on (default "127.0.0.1:8879") + -h, --help help for serve --repo-path string local directory path from which to serve charts --url string external URL of chart repository ``` @@ -39,11 +39,13 @@ helm serve --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_status.md b/docs/helm/helm_status.md index 02ec0ad66..9dca005fd 100644 --- a/docs/helm/helm_status.md +++ b/docs/helm/helm_status.md @@ -5,7 +5,6 @@ displays the status of the named release ### Synopsis - This command shows the status of a named release. The status consists of: - last deployment time @@ -23,13 +22,15 @@ helm status [flags] RELEASE_NAME ### Options ``` - -o, --output string output the status in the specified format (json or yaml) - --revision int32 if set, display the status of the named release with revision - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -h, --help help for status + -o, --output string output the status in the specified format (json or yaml) + --revision int32 if set, display the status of the named release with revision + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -39,11 +40,13 @@ helm status [flags] RELEASE_NAME --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_template.md b/docs/helm/helm_template.md index 3a4e9ce4a..d7770fb7f 100644 --- a/docs/helm/helm_template.md +++ b/docs/helm/helm_template.md @@ -5,7 +5,6 @@ locally render templates ### Synopsis - Render chart templates locally and display the output. This does not require Tiller. However, any values that would normally be @@ -26,6 +25,8 @@ helm template [flags] CHART ``` -x, --execute stringArray only execute the given templates + -h, --help help for template + --is-upgrade set .Release.IsUpgrade instead of .Release.IsInstall --kube-version string kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9") -n, --name string release name (default "RELEASE-NAME") --name-template string specify template used to name the release @@ -33,6 +34,7 @@ helm template [flags] CHART --notes show the computed NOTES.txt file as well --output-dir string writes the executed templates to files in output-dir instead of stdout --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) -f, --values valueFiles specify values in a YAML file (can specify multiple) (default []) ``` @@ -44,11 +46,13 @@ helm template [flags] CHART --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_test.md b/docs/helm/helm_test.md index 062244e73..e55c5df68 100644 --- a/docs/helm/helm_test.md +++ b/docs/helm/helm_test.md @@ -5,7 +5,6 @@ test a release ### Synopsis - The test command runs the tests for a release. The argument this command takes is the name of a deployed release. @@ -13,19 +12,21 @@ The tests to be run are defined in the chart that was installed. ``` -helm test [RELEASE] +helm test [RELEASE] [flags] ``` ### Options ``` - --cleanup delete test pods upon completion - --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + --cleanup delete test pods upon completion + -h, --help help for test + --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -35,11 +36,13 @@ helm test [RELEASE] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index c2882265e..f18bcf6a7 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -5,33 +5,61 @@ upgrade a release ### Synopsis +This command upgrades a release to a specified version of a chart and/or updates chart values. -This command upgrades a release to a new version of a chart. +Required arguments are release and chart. The chart argument can be one of: + - a chart reference('stable/mariadb'); use '--version' and '--devel' flags for versions other than latest, + - a path to a chart directory, + - a packaged chart, + - a fully qualified URL. -The upgrade arguments must be a release and chart. The chart -argument can be either: a chart reference('stable/mariadb'), a path to a chart directory, -a packaged chart, or a fully qualified URL. For chart references, the latest -version will be specified unless the '--version' flag is set. +To customize the chart values, use any of + - '--values'/'-f' to pass in a yaml file holding settings, + - '--set' to provide one or more key=val pairs directly, + - '--set-string' to provide key=val forcing val to be stored as a string, + - '--set-file' to provide key=path to read a single large value from a file at path. -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, to force string -values, use '--set-string'. +To edit or append to the existing customized values, add the + '--reuse-values' flag, otherwise any existing customized values are ignored. -You can specify the '--values'/'-f' flag multiple times. The priority will be given to the -last (right-most) file specified. For example, if both myvalues.yaml and override.yaml -contained a key called 'Test', the value set in override.yaml would take precedence: +If no chart value arguments are provided on the command line, any existing customized values are carried +forward. If you want to revert to just the values provided in the chart, use the '--reset-values' flag. + +You can specify any of the chart value flags multiple times. The priority will be given to the last +(right-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key +called 'Test', the value set in override.yaml would take precedence: $ helm upgrade -f myvalues.yaml -f override.yaml redis ./redis -You can specify the '--set' flag multiple times. The priority will be given to the -last (right-most) set specified. For example, if both 'bar' and 'newbar' values are -set for a key called 'foo', the 'newbar' value would take precedence: +Note that the key name provided to the '--set', '--set-string' and '--set-file' flags can reference +structure elements. Examples: + - mybool=TRUE + - livenessProbe.timeoutSeconds=10 + - metrics.annotations[0]=hey,metrics.annotations[1]=ho + +which sets the top level key mybool to true, the nested timeoutSeconds to 10, and two array values, respectively. + +Note that the value side of the key=val provided to '--set' and '--set-string' flags will pass through +shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with +special characters in unexpected ways, for example + + $ helm upgrade --set pwd=3jk$o2,z=f\30.e redis ./redis + +results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaluation and argument delimiters, +and use backslash to escape yaml special characters: - $ helm upgrade --set foo=bar --set foo=newbar redis ./redis + $ helm upgrade --set pwd='3jk$o2z=f\\30.e' redis ./redis + +which results in the expected "pwd: 3jk$o2z=f\30.e". If a single quote occurs in your value then follow +your shell convention for escaping it; for example in bash: + + $ helm upgrade --set pwd='3jk$o2z=f\\30with'\''quote' + +which results in "pwd: 3jk$o2z=f\30with'quote". ``` -helm upgrade [RELEASE] [CHART] +helm upgrade [RELEASE] [CHART] [flags] ``` ### Options @@ -39,9 +67,11 @@ helm upgrade [RELEASE] [CHART] ``` --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file + --description string specify the description to use for the upgrade, rather than the default --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an upgrade --force force resource update through delete/recreate if needed + -h, --help help for upgrade -i, --install if a release by this name doesn't already exist, run an install --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring that contains public signing keys (default "~/.gnupg/pubring.gpg") @@ -53,11 +83,13 @@ helm upgrade [RELEASE] [CHART] --reset-values when upgrading, reset the values to the ones built into the chart --reuse-values when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored. --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --timeout int time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) (default 300) --tls enable TLS for request --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") --tls-verify enable TLS for request and verify remote --username string chart repository username where to locate the requested chart @@ -74,11 +106,13 @@ helm upgrade [RELEASE] [CHART] --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 4-Apr-2018 +###### Auto generated by spf13/cobra on 24-Aug-2018 diff --git a/docs/helm/helm_verify.md b/docs/helm/helm_verify.md index bc5343937..30ed43679 100644 --- a/docs/helm/helm_verify.md +++ b/docs/helm/helm_verify.md @@ -5,7 +5,6 @@ verify that a chart at the given path has been signed and is valid ### Synopsis - Verify that the given chart has a valid provenance file. Provenance files provide crytographic verification that a chart has not been @@ -23,6 +22,7 @@ helm verify [flags] PATH ### Options ``` + -h, --help help for verify --keyring string keyring containing public keys (default "~/.gnupg/pubring.gpg") ``` @@ -33,11 +33,13 @@ helm verify [flags] PATH --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 1-Aug-2018 diff --git a/docs/helm/helm_version.md b/docs/helm/helm_version.md index 1f48cceba..33d33cf12 100644 --- a/docs/helm/helm_version.md +++ b/docs/helm/helm_version.md @@ -5,7 +5,6 @@ print the client/server version information ### Synopsis - Show the client and server versions for Helm and tiller. This will print a representation of the client and server versions of Helm and @@ -24,21 +23,23 @@ use '--server'. ``` -helm version +helm version [flags] ``` ### Options ``` - -c, --client client version only - -s, --server server version only - --short print the version number - --template string template for version string format - --tls enable TLS for request - --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") - --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") - --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") - --tls-verify enable TLS for request and verify remote + -c, --client client version only + -h, --help help for version + -s, --server server version only + --short print the version number + --template string template for version string format + --tls enable TLS for request + --tls-ca-cert string path to TLS CA certificate file (default "$HELM_HOME/ca.pem") + --tls-cert string path to TLS certificate file (default "$HELM_HOME/cert.pem") + --tls-hostname string the server name used to verify the hostname on the returned certificates from the server + --tls-key string path to TLS key file (default "$HELM_HOME/key.pem") + --tls-verify enable TLS for request and verify remote ``` ### Options inherited from parent commands @@ -48,11 +49,13 @@ helm version --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm") --host string address of Tiller. Overrides $HELM_HOST --kube-context string name of the kubeconfig context to use + --kubeconfig string absolute path to the kubeconfig file to use --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300) --tiller-namespace string namespace of Tiller (default "kube-system") ``` ### SEE ALSO + * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 10-Aug-2018 diff --git a/docs/install.md b/docs/install.md index 17905a805..e0e3db56d 100755 --- a/docs/install.md +++ b/docs/install.md @@ -13,17 +13,26 @@ releases. ### From the Binary Releases -Every [release](https://github.com/kubernetes/helm/releases) of Helm +Every [release](https://github.com/helm/helm/releases) of Helm provides binary releases for a variety of OSes. These binary versions can be manually downloaded and installed. -1. Download your [desired version](https://github.com/kubernetes/helm/releases) +1. Download your [desired version](https://github.com/helm/helm/releases) 2. Unpack it (`tar -zxvf helm-v2.0.0-linux-amd64.tgz`) 3. Find the `helm` binary in the unpacked directory, and move it to its desired destination (`mv linux-amd64/helm /usr/local/bin/helm`) From there, you should be able to run the client: `helm help`. +### From Snap (Linux) + +The Snap package for Helm is maintained by +[Snapcrafters](https://github.com/snapcrafters/helm). + +``` +$ sudo snap install helm +``` + ### From Homebrew (macOS) Members of the Kubernetes community have contributed a Helm formula build to @@ -48,18 +57,18 @@ choco install kubernetes-helm ## From Script Helm now has an installer script that will automatically grab the latest version -of the Helm client and [install it locally](https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get). +of the Helm client and [install it locally](https://raw.githubusercontent.com/helm/helm/master/scripts/get). You can fetch that script, and then execute it locally. It's well documented so that you can read through it and understand what it is doing before you run it. ``` -$ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh +$ curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh $ chmod 700 get_helm.sh $ ./get_helm.sh ``` -Yes, you can `curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash` that if you want to live on the edge. +Yes, you can `curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash` that if you want to live on the edge. ### From Canary Builds @@ -87,7 +96,7 @@ You must have a working Go environment with $ cd $GOPATH $ mkdir -p src/k8s.io $ cd src/k8s.io -$ git clone https://github.com/kubernetes/helm.git +$ git clone https://github.com/helm/helm.git $ cd helm $ make bootstrap build ``` @@ -104,6 +113,12 @@ Tiller, the server portion of Helm, typically runs inside of your Kubernetes cluster. But for development, it can also be run locally, and configured to talk to a remote Kubernetes cluster. +### Special Note for RBAC Users + +Most cloud providers enable a feature called Role-Based Access Control - RBAC for short. If your cloud provider enables this feature, you will need to create a service account for Tiller with the right roles and permissions to access resources. + +Check the [Kubernetes Distribution Guide](kubernetes_distros.md) to see if there's any further points of interest on using Helm with your cloud provider. Also check out the guide on [Tiller and Role-Based Access Control](rbac.md) for more information on how to run Tiller in an RBAC-enabled Kubernetes cluster. + ### Easy In-Cluster Installation The easiest way to install `tiller` into the cluster is simply to run @@ -122,6 +137,8 @@ You can explicitly tell `helm init` to... - Install a particular image (version) with `--tiller-image` - Install to a particular cluster with `--kube-context` - Install into a particular namespace with `--tiller-namespace` +- Install Tiller with a Service Account with `--service-account` (for [RBAC enabled clusters](securing_installation.md#rbac)) +- Install Tiller without mounting a service account with `--automount-service-account false` Once Tiller is installed, running `helm version` should show you both the client and server version. (If it shows only the client version, diff --git a/docs/install_faq.md b/docs/install_faq.md index f2eae5b48..d4840417f 100644 --- a/docs/install_faq.md +++ b/docs/install_faq.md @@ -4,7 +4,7 @@ This section tracks some of the more frequently encountered issues with installi or getting started with Helm. **We'd love your help** making this document better. To add, correct, or remove -information, [file an issue](https://github.com/kubernetes/helm/issues) or +information, [file an issue](https://github.com/helm/helm/issues) or send us a pull request. ## Downloading @@ -94,8 +94,8 @@ recommends reading this: Here are a few resolved issues that may help you get started: -- https://github.com/kubernetes/helm/issues/1371 -- https://github.com/kubernetes/helm/issues/966 +- https://github.com/helm/helm/issues/1371 +- https://github.com/helm/helm/issues/966 **Q: Trying to use Helm, I get the error "lookup XXXXX on 8.8.8.8:53: no such host"** @@ -113,7 +113,7 @@ follows. On each of the control plane nodes: 3) Remove the k8s api server container (kubelet will recreate it) 4) Then `systemctl restart docker` (or reboot the node) for it to pick up the /etc/resolv.conf changes -See this issue for more information: https://github.com/kubernetes/helm/issues/1455 +See this issue for more information: https://github.com/helm/helm/issues/1455 **Q: On GKE (Google Container Engine) I get "No SSH tunnels currently open"** diff --git a/docs/kubernetes_distros.md b/docs/kubernetes_distros.md index 8b80519ec..bb14043da 100644 --- a/docs/kubernetes_distros.md +++ b/docs/kubernetes_distros.md @@ -18,8 +18,9 @@ Hyperkube you may need to do some manual configuration. ## GKE -Google's GKE hosted Kubernetes platform is known to work with Helm, and requires -no additional configuration. +Google's GKE hosted Kubernetes platform enables RBAC by default. You will need to create a service account for tiller, and use the --service-account flag when initializing the helm server. + +See [Tiller and role-based access control](https://docs.helm.sh/using_helm/#role-based-access-control) for more information. ## Ubuntu with 'kubeadm' @@ -48,4 +49,3 @@ Helm Client and Helm Server (Tiller) are pre-installed with [Platform9 Managed K Helm (both client and server) has been tested and is working on Mesospheres DC/OS 1.11 Kubernetes platform, and requires no additional configuration. - diff --git a/docs/logos/helm-blue-vector.svg b/docs/logos/helm-blue-vector.svg new file mode 100644 index 000000000..45f2c2f86 --- /dev/null +++ b/docs/logos/helm-blue-vector.svg @@ -0,0 +1,43 @@ + + + + +logo +Created with Sketch. + + + + + + diff --git a/docs/logos/helm-white-vector.svg b/docs/logos/helm-white-vector.svg new file mode 100644 index 000000000..0f09be31e --- /dev/null +++ b/docs/logos/helm-white-vector.svg @@ -0,0 +1,43 @@ + + + + +logo white +Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/logos/helm.svg b/docs/logos/helm.svg new file mode 100644 index 000000000..2d8858e93 --- /dev/null +++ b/docs/logos/helm.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/man/man1/helm_serve.1 b/docs/man/man1/helm_serve.1 index a4a9c51da..f43f5ab05 100644 --- a/docs/man/man1/helm_serve.1 +++ b/docs/man/man1/helm_serve.1 @@ -29,7 +29,7 @@ Google Cloud Storage for production use. .PP See -\[la]https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories\[ra] +\[la]https://github.com/helm/helm/blob/master/docs/chart_repository.md#hosting-chart-repositories\[ra] for more information on hosting chart repositories in a production setting. diff --git a/docs/man/man1/helm_upgrade.1 b/docs/man/man1/helm_upgrade.1 index 24bba7c85..602c3136f 100644 --- a/docs/man/man1/helm_upgrade.1 +++ b/docs/man/man1/helm_upgrade.1 @@ -1,6 +1,4 @@ -.TH "HELM" "1" "May 2017" "Auto generated by spf13/cobra" "" -.nh -.ad l +.TH "HELM" "1" "Aug 2018" "Auto generated by spf13/cobra" "" "" .SH NAME @@ -10,27 +8,39 @@ helm\-upgrade \- upgrade a release .SH SYNOPSIS .PP -\fBhelm upgrade [RELEASE] [CHART]\fP +\fBhelm upgrade [RELEASE] [CHART] [flags]\fP .SH DESCRIPTION .PP -This command upgrades a release to a new version of a chart. +This command upgrades a release to a specified version of a chart and/or updates chart values. .PP -The upgrade arguments must be a release and chart. The chart -argument can be either: a chart reference('stable/mariadb'), a path to a chart directory, -a packaged chart, or a fully qualified URL. For chart references, the latest -version will be specified unless the '\-\-version' flag is set. +Required arguments are release and chart. The chart argument can be one of: + \- a chart reference('stable/mariadb'); use '\-\-version' and '\-\-devel' flags for versions other than latest, + \- a path to a chart directory, + \- a packaged chart, + \- a fully qualified URL. .PP -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. +To customize the chart values, use any of + \- '\-\-values'/'\-f' to pass in a yaml file holding settings, + \- '\-\-set' to provide one or more key=val pairs directly, + \- '\-\-set\-string' to provide key=val forcing val to be stored as a string, + \- '\-\-set\-file' to provide key=path to read a single large value from a file at path. .PP -You can specify the '\-\-values'/'\-f' flag multiple times. The priority will be given to the -last (right\-most) file specified. For example, if both myvalues.yaml and override.yaml -contained a key called 'Test', the value set in override.yaml would take precedence: +To edit or append to the existing customized values, add the + '\-\-reuse\-values' flag, otherwise any existing customized values are ignored. + +.PP +If no chart value arguments are provided on the command line, any existing customized values are carried +forward. If you want to revert to just the values provided in the chart, use the '\-\-reset\-values' flag. + +.PP +You can specify any of the chart value flags multiple times. The priority will be given to the last +(right\-most) value specified. For example, if both myvalues.yaml and override.yaml contained a key +called 'Test', the value set in override.yaml would take precedence: .PP .RS @@ -42,19 +52,58 @@ $ helm upgrade \-f myvalues.yaml \-f override.yaml redis ./redis .RE .PP -You can specify the '\-\-set' flag multiple times. The priority will be given to the -last (right\-most) set specified. For example, if both 'bar' and 'newbar' values are -set for a key called 'foo', the 'newbar' value would take precedence: +Note that the key name provided to the '\-\-set', '\-\-set\-string' and '\-\-set\-file' flags can reference +structure elements. Examples: + \- mybool=TRUE + \- livenessProbe.timeoutSeconds=10 + \- metrics.annotations[0]=hey,metrics.annotations[1]=ho + +.PP +which sets the top level key mybool to true, the nested timeoutSeconds to 10, and two array values, respectively. + +.PP +Note that the value side of the key=val provided to '\-\-set' and '\-\-set\-string' flags will pass through +shell evaluation followed by yaml type parsing to produce the final value. This may alter inputs with +special characters in unexpected ways, for example + +.PP +.RS + +.nf +$ helm upgrade \-\-set pwd=3jk$o2,z=f\\30.e redis ./redis + +.fi +.RE + +.PP +results in "pwd: 3jk" and "z: f30.e". Use single quotes to avoid shell evaluation and argument delimiters, +and use backslash to escape yaml special characters: + +.PP +.RS + +.nf +$ helm upgrade \-\-set pwd='3jk$o2z=f\\\\30.e' redis ./redis + +.fi +.RE + +.PP +which results in the expected "pwd: 3jk$o2z=f\\30.e". If a single quote occurs in your value then follow +your shell convention for escaping it; for example in bash: .PP .RS .nf -$ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis +$ helm upgrade \-\-set pwd='3jk$o2z=f\\\\30with'\\''quote' .fi .RE +.PP +which results in "pwd: 3jk$o2z=f\\30with'quote". + .SH OPTIONS .PP @@ -65,9 +114,13 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis \fB\-\-cert\-file\fP="" identify HTTPS client using this SSL certificate file +.PP +\fB\-\-description\fP="" + specify the description to use for the upgrade, rather than the default + .PP \fB\-\-devel\fP[=false] - use development versions, too. Equivalent to version '>0.0.0\-a'. If \-\-version is set, this is ignored. + use development versions, too. Equivalent to version '>0.0.0\-0'. If \-\-version is set, this is ignored. .PP \fB\-\-dry\-run\fP[=false] @@ -77,6 +130,10 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis \fB\-\-force\fP[=false] force resource update through delete/recreate if needed +.PP +\fB\-h\fP, \fB\-\-help\fP[=false] + help for upgrade + .PP \fB\-i\fP, \fB\-\-install\fP[=false] if a release by this name doesn't already exist, run an install @@ -86,17 +143,21 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis identify HTTPS client using this SSL key file .PP -\fB\-\-keyring\fP="~/.gnupg/pubring.gpg" +\fB\-\-keyring\fP="/Users/grapevine/.gnupg/pubring.gpg" path to the keyring that contains public signing keys .PP -\fB\-\-namespace\fP="default" - namespace to install the release into (only used if \-\-install is set) +\fB\-\-namespace\fP="" + namespace to install the release into (only used if \-\-install is set). Defaults to the current kube config namespace .PP \fB\-\-no\-hooks\fP[=false] disable pre/post upgrade hooks +.PP +\fB\-\-password\fP="" + chart repository password where to locate the requested chart + .PP \fB\-\-recreate\-pods\fP[=false] performs pods restart for the resource if applicable @@ -111,15 +172,23 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis .PP \fB\-\-reuse\-values\fP[=false] - when upgrading, reuse the last release's values, and merge in any new values. If '\-\-reset\-values' is specified, this is ignored. + when upgrading, reuse the last release's values and merge in any overrides from the command line via \-\-set and \-f. If '\-\-reset\-values' is specified, this is ignored. .PP \fB\-\-set\fP=[] set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) +.PP +\fB\-\-set\-file\fP=[] + set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) + +.PP +\fB\-\-set\-string\fP=[] + set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) + .PP \fB\-\-timeout\fP=300 - time in seconds to wait for any individual kubernetes operation (like Jobs for hooks) + time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks) .PP \fB\-\-tls\fP[=false] @@ -133,6 +202,10 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis \fB\-\-tls\-cert\fP="$HELM\_HOME/cert.pem" path to TLS certificate file +.PP +\fB\-\-tls\-hostname\fP="" + the server name used to verify the hostname on the returned certificates from the server + .PP \fB\-\-tls\-key\fP="$HELM\_HOME/key.pem" path to TLS key file @@ -141,6 +214,10 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis \fB\-\-tls\-verify\fP[=false] enable TLS for request and verify remote +.PP +\fB\-\-username\fP="" + chart repository username where to locate the requested chart + .PP \fB\-f\fP, \fB\-\-values\fP=[] specify values in a YAML file or a URL(can specify multiple) @@ -164,20 +241,28 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis enable verbose output .PP -\fB\-\-home\fP="~/.helm" +\fB\-\-home\fP="/Users/grapevine/.helm" location of your Helm config. Overrides $HELM\_HOME .PP -\fB\-\-host\fP="localhost:44134" - address of tiller. Overrides $HELM\_HOST +\fB\-\-host\fP="" + address of Tiller. Overrides $HELM\_HOST .PP \fB\-\-kube\-context\fP="" name of the kubeconfig context to use +.PP +\fB\-\-kubeconfig\fP="" + absolute path to the kubeconfig file to use + +.PP +\fB\-\-tiller\-connection\-timeout\fP=300 + the duration (in seconds) Helm will wait to establish a connection to tiller + .PP \fB\-\-tiller\-namespace\fP="kube\-system" - namespace of tiller + namespace of Tiller .SH SEE ALSO @@ -187,4 +272,4 @@ $ helm upgrade \-\-set foo=bar \-\-set foo=newbar redis ./redis .SH HISTORY .PP -19\-May\-2017 Auto generated by spf13/cobra +24\-Aug\-2018 Auto generated by spf13/cobra diff --git a/docs/provenance.md b/docs/provenance.md index 331074e8c..3a19fcd07 100644 --- a/docs/provenance.md +++ b/docs/provenance.md @@ -22,11 +22,18 @@ Prerequisites: - A valid PGP keypair in a binary (not ASCII-armored) format - The `helm` command line tool -- GnuPG command line tools (optional) +- GnuPG >=2.1 command line tools (optional) - Keybase command line tools (optional) **NOTE:** If your PGP private key has a passphrase, you will be prompted to enter -that passphrase for any commands that support the `--sign` option. +that passphrase for any commands that support the `--sign` option. You can set the +HELM_KEY_PASSPHRASE environment variable to that passphrase in case you don't want +to be prompted to enter the passphrase. + +**NOTE:** The keyfile format for GnuPG changed in version 2.1. Prior to that release +it was unnecessary to export keys out of GnuPG, and you could instead point Helm +at your `*.gpg` files. With 2.1, the new `.kbx` format was introduced, and this +format is not supported by Helm. Creating a new chart is the same as before: @@ -42,10 +49,10 @@ the name under which the signing key is known and the keyring containing the cor $ helm package --sign --key 'helm signing key' --keyring path/to/keyring.secret mychart ``` -**TIP:** for GnuPG users, your secret keyring is in `~/.gnupg/secring.gpg`. You can +**TIP:** for GnuPG users, your secret keyring is in `~/.gnupg/secring.kbx`. You can use `gpg --list-secret-keys` to list the keys you have. -**Warning:** the GnuPG v2 store your secret keyring using a new format 'kbx' on the default location '~/.gnupg/pubring.kbx'. Please use the following command to convert your keyring to the legacy gpg format: +**Warning:** the GnuPG v2.1 store your secret keyring using a new format 'kbx' on the default location '~/.gnupg/pubring.kbx'. Please use the following command to convert your keyring to the legacy gpg format: ``` $ gpg --export-secret-keys >~/.gnupg/secring.gpg @@ -95,24 +102,16 @@ Prerequisites: The first step is to import your keybase keys into your local GnuPG keyring: ``` -$ keybase pgp export -s | gpg --import +$ keybase pgp export -s > secring.gpg ``` -This will convert your Keybase key into the OpenPGP format, and then import it -locally into your `~/.gnupg/secring.gpg` file. - -You can double check by running `gpg --list-secret-keys`. +This will convert your Keybase key into the OpenPGP format, and then place it +locally into your `secring.gpg` file. -``` -$ gpg --list-secret-keys 1 ↵ -/Users/mattbutcher/.gnupg/secring.gpg -------------------------------------- -sec 2048R/1FC18762 2016-07-25 -uid technosophos (keybase.io/technosophos) -ssb 2048R/D125E546 2016-07-25 -``` +> Tip: If you need to add a Keybase key to an existing keyring, you will need to +> do `keybase pgp export -s | gpg --import && gpg --export-secret-keys --outfile secring.gpg` -Note that your secret key will have an identifier string: +Your secret key will have an identifier string: ``` technosophos (keybase.io/technosophos) diff --git a/docs/quickstart.md b/docs/quickstart.md index 52a7c800f..ef3cb460e 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -12,7 +12,7 @@ The following prerequisites are required for a successful and properly secured u ### Install Kubernetes or have access to a cluster -- You must have Kubernetes installed. For the latest release of Helm, we recommend the latest stable release of Kubernetes, which in most cases is the second-latest minor release. +- You must have Kubernetes installed. For the latest release of Helm, we recommend the latest stable release of Kubernetes, which in most cases is the second-latest minor release. - You should also have a local configured copy of `kubectl`. NOTE: Kubernetes versions prior to 1.6 have limited or no support for role-based access controls (RBAC). @@ -43,7 +43,7 @@ to [configure a service account and rules](rbac.md) before proceeding. ## Install Helm Download a binary release of the Helm client. You can use tools like -`homebrew`, or look at [the official releases page](https://github.com/kubernetes/helm/releases). +`homebrew`, or look at [the official releases page](https://github.com/helm/helm/releases). For more details, or for other options, see [the installation guide](install.md). @@ -65,7 +65,7 @@ This will install Tiller into the Kubernetes cluster you saw with **TIP:** When you want to upgrade Tiller, just run `helm init --upgrade`. -By default, when Tiller is installed,it does not have authentication enabled. +By default, when Tiller is installed, it does not have authentication enabled. To learn more about configuring strong TLS authentication for Tiller, consult [the Tiller TLS guide](tiller_ssl.md). @@ -78,11 +78,68 @@ of the official `stable` charts. ```console $ helm repo update # Make sure we get the latest list of charts $ helm install stable/mysql -Released smiling-penguin +NAME: wintering-rodent +LAST DEPLOYED: Thu Oct 18 14:21:18 2018 +NAMESPACE: default +STATUS: DEPLOYED + +RESOURCES: +==> v1/Secret +NAME AGE +wintering-rodent-mysql 0s + +==> v1/ConfigMap +wintering-rodent-mysql-test 0s + +==> v1/PersistentVolumeClaim +wintering-rodent-mysql 0s + +==> v1/Service +wintering-rodent-mysql 0s + +==> v1beta1/Deployment +wintering-rodent-mysql 0s + +==> v1/Pod(related) + +NAME READY STATUS RESTARTS AGE +wintering-rodent-mysql-6986fd6fb-988x7 0/1 Pending 0 0s + + +NOTES: +MySQL can be accessed via port 3306 on the following DNS name from within your cluster: +wintering-rodent-mysql.default.svc.cluster.local + +To get your root password run: + + MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default wintering-rodent-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) + +To connect to your database: + +1. Run an Ubuntu pod that you can use as a client: + + kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il + +2. Install the mysql client: + + $ apt-get update && apt-get install mysql-client -y + +3. Connect using the mysql cli, then provide your password: + $ mysql -h wintering-rodent-mysql -p + +To connect to your database directly from outside the K8s cluster: + MYSQL_HOST=127.0.0.1 + MYSQL_PORT=3306 + + # Execute the following command to route the connection: + kubectl port-forward svc/wintering-rodent-mysql 3306 + + mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} + ``` In the example above, the `stable/mysql` chart was released, and the name of -our new release is `smiling-penguin`. You get a simple idea of the +our new release is `wintering-rodent`. You get a simple idea of the features of this MySQL chart by running `helm inspect stable/mysql`. Whenever you install a chart, a new release is created. So one chart can @@ -99,8 +156,8 @@ It's easy to see what has been released using Helm: ```console $ helm ls -NAME VERSION UPDATED                   STATUS   CHART -smiling-penguin 1 Wed Sep 28 12:59:46 2016 DEPLOYED mysql-0.1.0 +NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE +wintering-rodent 1 Thu Oct 18 15:06:58 2018 DEPLOYED mysql-0.10.1 5.7.14 default ``` The `helm list` function will show you a list of all deployed releases. @@ -110,17 +167,48 @@ The `helm list` function will show you a list of all deployed releases. To uninstall a release, use the `helm delete` command: ```console -$ helm delete smiling-penguin -Removed smiling-penguin +$ helm delete wintering-rodent +release "wintering-rodent" deleted ``` -This will uninstall `smiling-penguin` from Kubernetes, but you will +This will uninstall `wintering-rodent` from Kubernetes, but you will still be able to request information about that release: ```console -$ helm status smiling-penguin -Status: DELETED -... +$ helm status wintering-rodent +LAST DEPLOYED: Thu Oct 18 14:21:18 2018 +NAMESPACE: default +STATUS: DELETED + +NOTES: +MySQL can be accessed via port 3306 on the following DNS name from within your cluster: +wintering-rodent-mysql.default.svc.cluster.local + +To get your root password run: + + MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default wintering-rodent-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) + +To connect to your database: + +1. Run an Ubuntu pod that you can use as a client: + + kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il + +2. Install the mysql client: + + $ apt-get update && apt-get install mysql-client -y + +3. Connect using the mysql cli, then provide your password: + $ mysql -h wintering-rodent-mysql -p + +To connect to your database directly from outside the K8s cluster: + MYSQL_HOST=127.0.0.1 + MYSQL_PORT=3306 + + # Execute the following command to route the connection: + kubectl port-forward svc/wintering-rodent-mysql 3306 + + mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} ``` Because Helm tracks your releases even after you've deleted them, you diff --git a/docs/rbac.md b/docs/rbac.md index 2a3dfe7a0..4b39ecdc6 100644 --- a/docs/rbac.md +++ b/docs/rbac.md @@ -14,11 +14,6 @@ Once you have satisfied the pre-requisite and have a service account with the co ### Example: Service account with cluster-admin role -```console -$ kubectl create serviceaccount tiller --namespace kube-system -serviceaccount "tiller" created -``` - In `rbac-config.yaml`: ```yaml @@ -28,7 +23,7 @@ metadata: name: tiller namespace: kube-system --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: tiller @@ -66,12 +61,12 @@ Define a Role that allows Tiller to manage all resources in `tiller-world` like ```yaml kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-manager namespace: tiller-world rules: -- apiGroups: ["", "extensions", "apps"] +- apiGroups: ["", "batch", "extensions", "apps"] resources: ["*"] verbs: ["*"] ``` @@ -85,7 +80,7 @@ In `rolebinding-tiller.yaml`, ```yaml kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-binding namespace: tiller-world @@ -142,12 +137,12 @@ Define a Role that allows Tiller to manage all resources in `myorg-users` like i ```yaml kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-manager namespace: myorg-users rules: -- apiGroups: ["", "extensions", "apps"] +- apiGroups: ["", "batch", "extensions", "apps"] resources: ["*"] verbs: ["*"] ``` @@ -161,7 +156,7 @@ Bind the service account to that role. In `rolebinding-tiller.yaml`, ```yaml kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-binding namespace: myorg-users @@ -184,7 +179,7 @@ We'll also need to grant Tiller access to read configmaps in myorg-system so it ```yaml kind: Role -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: namespace: myorg-system name: tiller-manager @@ -203,7 +198,7 @@ And the respective role binding. In `rolebinding-tiller-myorg-system.yaml`: ```yaml kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 metadata: name: tiller-binding namespace: myorg-system @@ -239,7 +234,7 @@ metadata: name: helm namespace: helm-world --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: tiller-user @@ -258,7 +253,7 @@ rules: verbs: - list --- -apiVersion: rbac.authorization.k8s.io/v1beta1 +apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: tiller-user-binding diff --git a/docs/related.md b/docs/related.md index 997e3f01d..11ecbf672 100644 --- a/docs/related.md +++ b/docs/related.md @@ -2,47 +2,59 @@ The Helm community has produced many extra tools, plugins, and documentation about Helm. We love to hear about these projects. If you have anything you'd like to -add to this list, please open an [issue](https://github.com/kubernetes/helm/issues) -or [pull request](https://github.com/kubernetes/helm/pulls). +add to this list, please open an [issue](https://github.com/helm/helm/issues) +or [pull request](https://github.com/helm/helm/pulls). ## Article, Blogs, How-Tos, and Extra Documentation -- [Using Helm to Deploy to Kubernetes](https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/) -- [Honestbee's Helm Chart Conventions](https://gist.github.com/so0k/f927a4b60003cedd101a0911757c605a) -- [Deploying Kubernetes Applications with Helm](http://cloudacademy.com/blog/deploying-kubernetes-applications-with-helm/) -- [Releasing backward-incompatible changes: Kubernetes, Jenkins, Prometheus Operator, Helm and Traefik](https://medium.com/@enxebre/releasing-backward-incompatible-changes-kubernetes-jenkins-plugin-prometheus-operator-helm-self-6263ca61a1b1#.e0c7elxhq) + +- [Awesome Helm](https://github.com/cdwv/awesome-helm) - List of awesome Helm resources - [CI/CD with Kubernetes, Helm & Wercker ](http://www.slideshare.net/Diacode/cicd-with-kubernetes-helm-wercker-madscalability) -- [The missing CI/CD Kubernetes component: Helm package manager](https://hackernoon.com/the-missing-ci-cd-kubernetes-component-helm-package-manager-1fe002aac680#.691sk2zhu) -- [The Workflow "Umbrella" Helm Chart](https://deis.com/blog/2017/workflow-chart-assembly) +- [Creating a Helm Plugin in 3 Steps](http://technosophos.com/2017/03/21/creating-a-helm-plugin.html) +- [Deploying Kubernetes Applications with Helm](http://cloudacademy.com/blog/deploying-kubernetes-applications-with-helm/) - [GitLab, Consumer Driven Contracts, Helm and Kubernetes](https://medium.com/@enxebre/gitlab-consumer-driven-contracts-helm-and-kubernetes-b7235a60a1cb#.xwp1y4tgi) +- [Honestbee's Helm Chart Conventions](https://gist.github.com/so0k/f927a4b60003cedd101a0911757c605a) +- [Releasing backward-incompatible changes: Kubernetes, Jenkins, Prometheus Operator, Helm and Traefik](https://medium.com/@enxebre/releasing-backward-incompatible-changes-kubernetes-jenkins-plugin-prometheus-operator-helm-self-6263ca61a1b1#.e0c7elxhq) +- [The Missing CI/CD Kubernetes Component: Helm package manager](https://hackernoon.com/the-missing-ci-cd-kubernetes-component-helm-package-manager-1fe002aac680#.691sk2zhu) +- [Using Helm to Deploy to Kubernetes](https://daemonza.github.io/2017/02/20/using-helm-to-deploy-to-kubernetes/) - [Writing a Helm Chart](https://www.influxdata.com/packaged-kubernetes-deployments-writing-helm-chart/) -- [Creating a Helm Plugin in 3 Steps](http://technosophos.com/2017/03/21/creating-a-helm-plugin.html) +- [A basic walk through Kubernetes Helm](https://github.com/muffin87/helm-tutorial) +- [Tillerless Helm v2](https://rimusz.net/tillerless-helm/) ## Video, Audio, and Podcast - [CI/CD with Jenkins, Kubernetes, and Helm](https://www.youtube.com/watch?v=NVoln4HdZOY): AKA "The Infamous Croc Hunter Video". -- [KubeCon2016: Delivering Kubernetes-Native Applications by Michelle Noorali](https://www.youtube.com/watch?v=zBc1goRfk3k&index=49&list=PLj6h78yzYM2PqgIGU1Qmi8nY7dqn9PCr4) - [Helm with Michelle Noorali and Matthew Butcher](https://gcppodcast.com/post/episode-50-helm-with-michelle-noorali-and-matthew-butcher/): The official Google CloudPlatform Podcast interviews Michelle and Matt about Helm. +- [KubeCon2016: Delivering Kubernetes-Native Applications by Michelle Noorali](https://www.youtube.com/watch?v=zBc1goRfk3k&index=49&list=PLj6h78yzYM2PqgIGU1Qmi8nY7dqn9PCr4) ## Helm Plugins -- [helm-tiller](https://github.com/adamreese/helm-tiller) - Additional commands to work with Tiller -- [Technosophos's Helm Plugins](https://github.com/technosophos/helm-plugins) - Plugins for GitHub, Keybase, and GPG -- [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side -- [Helm Value Store](https://github.com/skuid/helm-value-store) - Plugin for working with Helm deployment values -- [Helm Diff](https://github.com/databus23/helm-diff) - Preview `helm upgrade` as a coloured diff -- [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment -- [helm-last](https://github.com/adamreese/helm-last) - Plugin to show the latest release -- [helm-nuke](https://github.com/adamreese/helm-nuke) - Plugin to destroy all releases -- [helm-local](https://github.com/adamreese/helm-local) - Plugin to run Tiller as a local daemon - [App Registry](https://github.com/app-registry/helm-plugin) - Plugin to manage charts via the [App Registry specification](https://github.com/app-registry/spec) -- [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely +- [Helm Diff](https://github.com/databus23/helm-diff) - Preview `helm upgrade` as a coloured diff +- [Helm Value Store](https://github.com/skuid/helm-value-store) - Plugin for working with Helm deployment values +- [Technosophos's Helm Plugins](https://github.com/technosophos/helm-plugins) - Plugins for GitHub, Keybase, and GPG +- [helm-convert](https://github.com/ContainerSolutions/helm-convert) - Plugin to convert charts into Kustomize compatible packages +- [helm-cos](https://github.com/imroc/helm-cos) - Plugin to manage repositories on Tencent Cloud Object Storage - [helm-edit](https://github.com/mstrzele/helm-edit) - Plugin for editing release's values +- [helm-env](https://github.com/adamreese/helm-env) - Plugin to show current environment +- [helm-export](https://github.com/maorfr/helm-export) - Plugin to export releases from namespace to a file (disaster recovery) - [helm-gcs](https://github.com/nouney/helm-gcs) - Plugin to manage repositories on Google Cloud Storage - [helm-github](https://github.com/sagansystems/helm-github) - Plugin to install Helm Charts from Github repositories -- [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query -- [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp - [helm-hashtag](https://github.com/balboah/helm-hashtag) - Plugin for tracking docker tag hash digests as values +- [helm-import](https://github.com/maorfr/helm-import) - Plugin for importing releases from (exported) file to a namespace (disaster recovery) +- [helm-inject](https://github.com/maorfr/helm-inject) - Plugin for injecting additional configurations during release upgrade +- [helm-k8comp](https://github.com/cststack/k8comp) - Plugin to create Helm Charts from hiera using k8comp +- [helm-last](https://github.com/adamreese/helm-last) - Plugin to show the latest release +- [helm-local](https://github.com/adamreese/helm-local) - Plugin to run Tiller as a local daemon +- [helm-logs](https://github.com/maorfr/helm-logs) - Plugin to view changed releases over time +- [helm-monitor](https://github.com/ContainerSolutions/helm-monitor) - Plugin to monitor a release and rollback based on Prometheus/ElasticSearch query +- [helm-nuke](https://github.com/adamreese/helm-nuke) - Plugin to destroy all releases +- [helm-restore](https://github.com/maorfr/helm-restore) - Plugin to restore the last deployed release to its original state +- [helm-secrets](https://github.com/futuresimple/helm-secrets) - Plugin to manage and store secrets safely +- [helm-stop](https://github.com/IBM/helm-stop) - Plugin for stopping a release pods +- [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side +- [helm-tiller](https://github.com/adamreese/helm-tiller) - Additional commands to work with Tiller - [helm-unittest](https://github.com/lrills/helm-unittest) - Plugin for unit testing chart locally with YAML +- [Tillerless Helm v2](https://github.com/rimusz/helm-tiller) - Helm plugin for using Tiller locally and in CI/CD pipelines We also encourage GitHub authors to use the [helm-plugin](https://github.com/search?q=topic%3Ahelm-plugin&type=Repositories) tag on their plugin repositories. @@ -52,33 +64,34 @@ tag on their plugin repositories. Tools layered on top of Helm or Tiller. - [AppsCode Swift](https://github.com/appscode/swift) - Ajax friendly Helm Tiller Proxy using [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) -- [Quay App Registry](https://coreos.com/blog/quay-application-registry-for-kubernetes.html) - Open Kubernetes application registry, including a Helm access client -- [Chartify](https://github.com/appscode/chartify) - Generate Helm charts from existing Kubernetes resources. -- [VIM-Kubernetes](https://github.com/andrewstuart/vim-kubernetes) - VIM plugin for Kubernetes and Helm -- [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." -- [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API -- [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts +- [Armada](https://github.com/att-comdev/armada) - Manage prefixed releases throughout various Kubernetes namespaces, and removes completed jobs for complex deployments. Used by the [Openstack-Helm](https://github.com/openstack/openstack-helm) team. - [Autohelm](https://github.com/reactiveops/autohelm) - Autohelm is _another_ simple declarative spec for deploying helm charts. Written in python and supports git urls as a source for helm charts. -- [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). -- [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory -- [Drone.io Helm Plugin](http://plugins.drone.io/ipedrazas/drone-helm/) - Run Helm inside of the Drone CI/CD system +- [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage +- [Chartify](https://github.com/appscode/chartify) - Generate Helm charts from existing Kubernetes resources. +- [Codefresh](https://codefresh.io) - Kubernetes native CI/CD and management platform with UI dashboards for managing Helm charts and releases - [Cog](https://github.com/ohaiwalt/cog-helm) - Helm chart to deploy Cog on Kubernetes -- [Monocular](https://github.com/helm/monocular) - Web UI for Helm Chart repositories +- [Drone.io Helm Plugin](http://plugins.drone.io/ipedrazas/drone-helm/) - Run Helm inside of the Drone CI/CD system - [Helm Chart Publisher](https://github.com/luizbafilho/helm-chart-publisher) - HTTP API for publishing Helm Charts in an easy way -- [Armada](https://github.com/att-comdev/armada) - Manage prefixed releases throughout various Kubernetes namespaces, and removes completed jobs for complex deployments. Used by the [Openstack-Helm](https://github.com/openstack/openstack-helm) team. -- [ChartMuseum](https://github.com/chartmuseum/chartmuseum) - Helm Chart Repository with support for Amazon S3 and Google Cloud Storage - [Helm.NET](https://github.com/qmfrederik/helm) - A .NET client for Tiller's API -- [Codefresh](https://codefresh.io) - Kubernetes native CI/CD and management platform with UI dashboards for managing Helm charts and releases +- [Helmfile](https://github.com/roboll/helmfile) - Helmfile is a declarative spec for deploying helm charts +- [Helmsman](https://github.com/Praqma/helmsman) - Helmsman is a helm-charts-as-code tool which enables installing/upgrading/protecting/moving/deleting releases from version controlled desired state files (described in a simple TOML format). +- [Landscaper](https://github.com/Eneco/landscaper/) - "Landscaper takes a set of Helm Chart references with values (a desired state), and realizes this in a Kubernetes cluster." +- [Monocular](https://github.com/helm/monocular) - Web UI for Helm Chart repositories +- [Orca](https://github.com/maorfr/orca) - Advanced CI\CD tool for Kubernetes and Helm made simple. +- [Quay App Registry](https://coreos.com/blog/quay-application-registry-for-kubernetes.html) - Open Kubernetes application registry, including a Helm access client +- [Rudder](https://github.com/AcalephStorage/rudder) - RESTful (JSON) proxy for Tiller's API +- [Schelm](https://github.com/databus23/schelm) - Render a Helm manifest to a directory +- [VIM-Kubernetes](https://github.com/andrewstuart/vim-kubernetes) - VIM plugin for Kubernetes and Helm ## Helm Included Platforms, distributions, and services that include Helm support. -- [Kubernetic](https://kubernetic.com/) - Kubernetes Desktop Client - [Cabin](http://www.skippbox.com/cabin/) - Mobile App for Managing Kubernetes -- [Qstack](https://qstack.com) - [Fabric8](https://fabric8.io) - Integrated development platform for Kubernetes - [Jenkins X](http://jenkins-x.io/) - open source automated CI/CD for Kubernetes which uses Helm for [promoting](http://jenkins-x.io/about/features/#promotion) applications through [environments via GitOps](http://jenkins-x.io/about/features/#environments) +- [Kubernetic](https://kubernetic.com/) - Kubernetes Desktop Client +- [Qstack](https://qstack.com) ## Misc diff --git a/docs/release_checklist.md b/docs/release_checklist.md index d678e7748..9213b4c1f 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -2,9 +2,36 @@ **IMPORTANT**: If your experience deviates from this document, please document the changes to keep it up-to-date. +## Release Meetings +As part of the release process, two of the weekly developer calls will be co-opted +as "release meetings." + +### Start of the Release Cycle +The first developer call after a release will be used as the release meeting to +start the next release cycle. During this meeting, the following items must be +identified: + +- Release date +- Goals/Objectives for this release +- The release manager (basically whoever is going to cut the release) +- Any other important details for the community + +All of this information should be added to the GitHub milestone for the given +release. This should give the community and maintainers a clear set of guidelines +to follow when choosing whether or not to add issues and PRs to a given release. + +### End (almost) of the Release Cycle +The developer call closest to two weeks before the scheduled release date will +be used to review any remaining PRs that should be pulled into the release. This +is the place to debate whether or not we should wait before cutting a release and +any other concerns. At the end of this meeting, if the release date has not been +pushed out, the first RC should be cut. Subsequent developer calls in between this +meeting and the release date should have some time set aside to see if any bugs +were found. Once the release date is reached, the final release can be cut + ## A Maintainer's Guide to Releasing Helm -So you're in charge of a new release for helm? Cool. Here's what to do... +So you're in charge of a new release for Helm? Cool. Here's what to do... ![TODO: Nothing](images/nothing.png) @@ -12,20 +39,20 @@ Just kidding! :trollface: All releases will be of the form vX.Y.Z where X is the major version number, Y is the minor version number and Z is the patch release number. This project strictly follows [semantic versioning](http://semver.org/) so following this step is critical. -It is important to note that this document assumes that the git remote in your repository that corresponds to "https://github.com/kubernetes/helm" is named "upstream". If yours is not (for example, if you've chosen to name it "origin" or something similar instead), be sure to adjust the listed snippets for your local environment accordingly. If you are not sure what your upstream remote is named, use a command like `git remote -v` to find out. +It is important to note that this document assumes that the git remote in your repository that corresponds to "https://github.com/helm/helm" is named "upstream". If yours is not (for example, if you've chosen to name it "origin" or something similar instead), be sure to adjust the listed snippets for your local environment accordingly. If you are not sure what your upstream remote is named, use a command like `git remote -v` to find out. If you don't have an upstream remote, you can add one easily using something like: ```shell -git remote add upstream git@github.com:kubernetes/helm.git +git remote add upstream git@github.com:helm/helm.git ``` In this doc, we are going to reference a few environment variables as well, which you may want to set for convenience. For major/minor releases, use the following: ```shell export RELEASE_NAME=vX.Y.0 -export RELEASE_BRANCH_NAME="release-$RELEASE_NAME" -export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc1" +export RELEASE_BRANCH_NAME="release-X.Y" +export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc.1" ``` If you are creating a patch release, you may want to use the following instead: @@ -34,7 +61,7 @@ If you are creating a patch release, you may want to use the following instead: export PREVIOUS_PATCH_RELEASE=vX.Y.Z export RELEASE_NAME=vX.Y.Z+1 export RELEASE_BRANCH_NAME="release-X.Y" -export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc1" +export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc.1" ``` ## 1. Create the Release Branch @@ -94,8 +121,6 @@ index 2109a0a..6f5a1a4 100644 BuildMetadata = "unreleased" ``` -For patch releases, the old version number will be the latest patch release, so just bump the patch number, incrementing Z by one. - ```shell git add . git commit -m "bump version to $RELEASE_CANDIDATE_NAME" @@ -109,7 +134,7 @@ In order for others to start testing, we can now push the release branch upstrea git push upstream $RELEASE_BRANCH_NAME ``` -Make sure to check [helm on CircleCI](https://circleci.com/gh/kubernetes/helm) and make sure the release passed CI before proceeding. +Make sure to check [helm on CircleCI](https://circleci.com/gh/helm/helm) and make sure the release passed CI before proceeding. If anyone is available, let others peer-review the branch before continuing to ensure that all the proper changes have been made and all of the commits for the release are there. @@ -141,7 +166,7 @@ wget https://kubernetes-helm.storage.googleapis.com/helm-$RELEASE_CANDIDATE_NAME windows/amd64, using PowerShell: ```shell -PS C:\> Invoke-WebRequest -Uri "https://kubernetes-helm.storage.googleapis.com/helm-$RELEASE_CANDIDATE_NAME-windows-amd64.tar.gz" -OutFile "helm-$ReleaseCandidateName-windows-amd64.tar.gz" +PS C:\> Invoke-WebRequest -Uri "https://kubernetes-helm.storage.googleapis.com/helm-$RELEASE_CANDIDATE_NAME-windows-amd64.zip" -OutFile "helm-$ReleaseCandidateName-windows-amd64.zip" ``` Then, unpack and move the binary to somewhere on your $PATH, or move it somewhere and add it to your $PATH (e.g. /usr/local/bin/helm for linux/macOS, C:\Program Files\helm\helm.exe for Windows). @@ -163,7 +188,7 @@ You will also want to update the release version number and the CHANGELOG as we After that, tag it and notify users of the new release candidate: ```shell -export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc2" +export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc.2" git tag --sign --annotate "${RELEASE_CANDIDATE_NAME}" --message "Helm release ${RELEASE_CANDIDATE_NAME}" git push upstream $RELEASE_CANDIDATE_NAME ``` @@ -193,25 +218,30 @@ An example release note for a minor release would look like this: Helm vX.Y.Z is a feature release. This release, we focused on . Users are encouraged to upgrade for the best experience. -The community keeps growing, and we'd love to see you there. +The community keeps growing, and we'd love to see you there! -- Join the discussion in [Kubernetes Slack](https://slack.k8s.io/): +- Join the discussion in [Kubernetes Slack](https://kubernetes.slack.com): - `#helm-users` for questions and just to hang out - `#helm-dev` for discussing PRs, code, and bugs -- Hang out at the Public Developer Call: Thursday, 9:30 Pacific via [Zoom](https://zoom.us/j/4526666954) +- Hang out at the Public Developer Call: Thursday, 9:30 Pacific via [Zoom](https://zoom.us/j/696660622) - Test, debug, and contribute charts: [GitHub/kubernetes/charts](https://github.com/kubernetes/charts) ## Installation and Upgrading Download Helm X.Y. The common platform binaries are here: -- [OSX](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz) -- [Linux](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz) -- [Windows](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.tar.gz) +- [MacOS amd64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-darwin-amd64.tar.gz.sha256)) +- [Linux amd64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-amd64.tar.gz.sha256)) +- [Linux arm](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm.tar.gz.sha256)) +- [Linux arm64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm64.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-arm64.tar.gz.sha256)) +- [Linux i386](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-386.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-386.tar.gz.sha256)) +- [Linux ppc64le](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-ppc64le.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-ppc64le.tar.gz.sha256)) +- [Linux s390x](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-s390x.tar.gz) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-linux-s390x.tar.gz.sha256)) +- [Windows amd64](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.zip) ([checksum](https://storage.googleapis.com/kubernetes-helm/helm-vX.Y.Z-windows-amd64.zip.sha256)) Once you have the client installed, upgrade Tiller with `helm init --upgrade`. -The [Quickstart Guide](https://docs.helm.sh/using_helm/#quickstart-guide) will get you going from there. For **upgrade instructions** or detailed installation notes, check the [install guide](https://docs.helm.sh/using_helm/#installing-helm). You can also use a [script to install](https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get) on any system with `bash`. +The [Quickstart Guide](https://docs.helm.sh/using_helm/#quickstart-guide) will get you going from there. For **upgrade instructions** or detailed installation notes, check the [install guide](https://docs.helm.sh/using_helm/#installing-helm). You can also use a [script to install](https://raw.githubusercontent.com/helm/helm/master/scripts/get) on any system with `bash`. ## What's Next @@ -228,12 +258,12 @@ The changelog at the bottom of the release notes can be generated with this comm ```shell PREVIOUS_RELEASE=vX.Y.Z -git log --no-merges --pretty=format:'- %s %H (%aN)' $RELEASE_NAME $PREVIOUS_RELEASE +git log --no-merges --pretty=format:'- %s %H (%aN)' $PREVIOUS_RELEASE..$RELEASE_NAME ``` Once finished, go into GitHub and edit the release notes for the tagged release with the notes written here. -## 9. Evangelize +## 8. Evangelize Congratulations! You're done. Go grab yourself a $DRINK_OF_CHOICE. You've earned it. diff --git a/docs/securing_installation.md b/docs/securing_installation.md index 4083bf188..454e0cc12 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -34,7 +34,7 @@ There are four main areas to consider when securing a tiller installation: ### RBAC -Recent versions of Kubernetes employ a [role-based access control (or RBAC)](https://en.wikipedia.org/wiki/Role-based_access_control) system (as do modern operating systems) to help mitigate the damage that can done if credentials are misused or bugs exist. Even where an identity is hijacked, the identity has only so many permissions to a controlled space. This effectively adds a layer of security to limit the scope of any attack with that identity. +Recent versions of Kubernetes employ a [role-based access control (or RBAC)](https://en.wikipedia.org/wiki/Role-based_access_control) system (as do modern operating systems) to help mitigate the damage that can be done if credentials are misused or bugs exist. Even where an identity is hijacked, the identity has only so many permissions to a controlled space. This effectively adds a layer of security to limit the scope of any attack with that identity. Helm and Tiller are designed to install, remove, and modify logical applications that can contain many services interacting together. As a result, often its usefulness involves cluster-wide operations, which in a multitenant cluster means that great care must be taken with access to a cluster-wide Tiller installation to prevent improper activity. @@ -57,7 +57,7 @@ Shared and production clusters -- for the most part -- should use Helm 2.7.2 at For more information about the proper steps to configure Tiller and use Helm properly with TLS configured, see [Using SSL between Helm and Tiller](tiller_ssl.md). -When Helm clients are connecting from outside of the cluster, the security between the Helm client and the API server is managed by Kubernetes itself. You may want to ensure that this link is secure. Note that if you are using the TLS configuration recommended above, not even the Kubernetes API server has access to the unencrypted messages between the client and Tiller. +When Helm clients are connecting from outside of the cluster, the security between the Helm client and the API server is managed by Kubernetes itself. You may want to ensure that this link is secure. Note that if you are using the TLS configuration recommended above, not even the Kubernetes API server has access to the encrypted messages between the client and Tiller. ### Tiller's Release Information @@ -65,7 +65,7 @@ For historical reasons, Tiller stores its release information in ConfigMaps. We Secrets are the Kubernetes accepted mechanism for saving configuration data that is considered sensitive. While secrets don't themselves offer many protections, Kubernetes cluster management software often treats them differently than other objects. Thus, we suggest using secrets to store releases. -Enabling this feature currently requires setting the `--storage=secret` flag in the tiller-deploy deployment. This entails directly modifying the deployment or using `helm init --override=...`, as no helm init flag is currently available to do this for you. For more information, see [Using --override](install.md#using---override). +Enabling this feature currently requires setting the `--storage=secret` flag in the tiller-deploy deployment. This entails directly modifying the deployment or using `helm init --override 'spec.template.spec.containers[0].command'='{/tiller,--storage=secret}'`, as no helm init flag is currently available to do this for you. ### Thinking about Charts @@ -93,6 +93,7 @@ If these steps are followed, an example `helm init` command might look something ```bash $ helm init \ +--override 'spec.template.spec.containers[0].command'='{/tiller,--storage=secret}' \ --tiller-tls \ --tiller-tls-verify \ --tiller-tls-cert=cert.pem \ @@ -101,7 +102,7 @@ $ helm init \ --service-account=accountname ``` -This command will start Tiller with both strong authentication over gRPC, and a service account to which RBAC policies have been applied. +This command will start Tiller with strong authentication over gRPC, release information stored in a Kubernetes Secret, and a service account to which RBAC policies have been applied. diff --git a/docs/tiller_ssl.md b/docs/tiller_ssl.md index d7f0166c4..41e704653 100644 --- a/docs/tiller_ssl.md +++ b/docs/tiller_ssl.md @@ -148,10 +148,10 @@ $ openssl req -key helm.key.pem -new -sha256 -out helm.csr.pem (In rare cases, we've had to add the `-nodes` flag when generating the request.) -Now we sign each of these CSRs with the CA certificate we created: +Now we sign each of these CSRs with the CA certificate we created (adjust the days parameter to suit your requirements): ```console -$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem +$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem -days 365 Signature ok subject=/C=US/ST=CO/L=Boulder/O=Tiller Server/CN=tiller-server Getting CA Private Key @@ -161,7 +161,7 @@ Enter pass phrase for ca.key.pem: And again for the client certificate: ```console -$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in helm.csr.pem -out helm.cert.pem +$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in helm.csr.pem -out helm.cert.pem -days 365 ``` At this point, the important files for us are these: @@ -284,6 +284,30 @@ the host name that Helm connects to matches the host name on the certificate. In some cases this is awkward, since Helm will connect over localhost, or the FQDN is not available for public resolution. +*If I use `--tls-verify` on the client, I get `Error: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs`* + +By default, the Helm client connects to Tiller via tunnel (i.e. kube proxy) at 127.0.0.1. During the TLS handshake, +a target, usually provided as a hostname (e.g. example.com), is checked against the subject and subject alternative +names of the certificate (i.e. hostname verficiation). However, because of the tunnel, the target is an IP address. +Therefore, to validate the certificate, the IP address 127.0.0.1 must be listed as an IP subject alternative name +(IP SAN) in the Tiller certificate. + +For example, to list 127.0.0.1 as an IP SAN when generating the Tiller certificate: + +```console +$ echo subjectAltName=IP:127.0.0.1 > extfile.cnf +$ openssl x509 -req -CA ca.cert.pem -CAkey ca.key.pem -CAcreateserial -in tiller.csr.pem -out tiller.cert.pem -days 365 -extfile extfile.cnf +``` + +Alternatively, you can override the expected hostname of the tiller certificate using the `--tls-hostname` flag. + +*If I use `--tls-verify` on the client, I get `Error: x509: certificate has expired or is not yet valid`* + +Your helm certificate has expired, you need to sign a new certificate using your private key and the CA (and consider increasing the number of days) + +If your tiller certificate has expired, you'll need to sign a new certificate, base64 encode it and update the Tiller Secret: +`kubectl edit secret tiller-secret` + ## References https://github.com/denji/golang-tls diff --git a/docs/using_helm.md b/docs/using_helm.md index 6bf7bc40a..4b18e2cf2 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -43,7 +43,7 @@ carefully curated and maintained charts. This chart repository is named You can see which charts are available by running `helm search`: -``` +```console $ helm search NAME VERSION DESCRIPTION stable/drupal 0.3.2 One of the most versatile open source content m... @@ -56,7 +56,7 @@ stable/mysql 0.1.0 Chart for MySQL With no filter, `helm search` shows you all of the available charts. You can narrow down your results by searching with a filter: -``` +```console $ helm search mysql NAME VERSION DESCRIPTION stable/mysql 0.1.0 Chart for MySQL @@ -69,7 +69,7 @@ Why is `mariadb` in the list? Because its package description relates it to MySQL. We can use `helm inspect chart` to see this: -``` +```console $ helm inspect stable/mariadb Fetched stable/mariadb to mariadb-0.5.1.tgz description: Chart for MariaDB @@ -91,13 +91,13 @@ package you want to install, you can use `helm install` to install it. To install a new package, use the `helm install` command. At its simplest, it takes only one argument: The name of the chart. -``` +```console $ helm install stable/mariadb Fetched stable/mariadb-0.3.0 to /Users/mattbutcher/Code/Go/src/k8s.io/helm/mariadb-0.3.0.tgz -happy-panda -Last Deployed: Wed Sep 28 12:32:28 2016 -Namespace: default -Status: DEPLOYED +NAME: happy-panda +LAST DEPLOYED: Wed Sep 28 12:32:28 2016 +NAMESPACE: default +STATUS: DEPLOYED Resources: ==> extensions/Deployment @@ -139,7 +139,7 @@ may take a long time to install into the cluster. To keep track of a release's state, or to re-read configuration information, you can use `helm status`: -``` +```console $ helm status happy-panda Last Deployed: Wed Sep 28 12:32:28 2016 Namespace: default @@ -227,7 +227,7 @@ There are two ways to pass configuration data during install: - `--values` (or `-f`): Specify a YAML file with overrides. This can be specified multiple times and the rightmost file will take precedence -- `--set`: Specify overrides on the command line. +- `--set` (and its variants `--set-string` and `--set-file`): Specify overrides on the command line. If both are used, `--set` values are merged into `--values` with higher precedence. Overrides specified with `--set` are persisted in a configmap. Values that have been @@ -285,7 +285,7 @@ servers: ``` Sometimes you need to use special characters in your `--set` lines. You can use -a backslash to escape the characters; `--set name=value1\,value2` will become: +a backslash to escape the characters; `--set name="value1\,value2"` will become: ```yaml name: "value1,value2" @@ -304,6 +304,35 @@ Deeply nested data structures can be difficult to express using `--set`. Chart designers are encouraged to consider the `--set` usage when designing the format of a `values.yaml` file. +Helm will cast certain values specified with `--set` to integers. +For example, `--set foo=true` results Helm to cast `true` into an int64 value. +In case you want a string, use a `--set`'s variant named `--set-string`. `--set-string foo=true` results in a string value of `"true"`. + +`--set-file key=filepath` is another variant of `--set`. +It reads the file and use its content as a value. +An example use case of it is to inject a multi-line text into values without dealing with indentation in YAML. +Say you want to create a [brigade](https://github.com/Azure/brigade) project with certain value containing 5 lines JavaScript code, you might write a `values.yaml` like: + +```yaml +defaultScript: | + const { events, Job } = require("brigadier") + function run(e, project) { + console.log("hello default script") + } + events.on("run", run) +``` + +Being embedded in a YAML, this makes it harder for you to use IDE features and testing framework and so on that supports writing code. +Instead, you can use `--set-file defaultScript=brigade.js` with `brigade.js` containing: + +```javascript +const { events, Job } = require("brigadier") +function run(e, project) { + console.log("hello default script") +} +events.on("run", run) +``` + ### More Installation Methods The `helm install` command can install from several sources: @@ -392,14 +421,14 @@ is not a full list of cli flags. To see a description of all flags, just run When it is time to uninstall or delete a release from the cluster, use the `helm delete` command: -``` +```console $ helm delete happy-panda ``` This will remove the release from the cluster. You can see all of your currently deployed releases with the `helm list` command: -``` +```console $ helm list NAME VERSION UPDATED STATUS CHART inky-cat 1 Wed Sep 28 12:59:46 2016 DEPLOYED alpine-0.1.0 diff --git a/glide.lock b/glide.lock index a91c31b7b..c25f439bd 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 4023a1644d60060fbf2fdbbe5b73cbb4b957eb686ce925640d102db2d1858676 -updated: 2018-04-14T11:27:34.604716498-04:00 +hash: 30b1d3f31b7bd310a9434e081bae3d5dc18c0a79b3674c0adffccc8d602e9227 +updated: 2018-10-04T17:11:58.043264Z imports: - name: cloud.google.com/go version: 3b1ae45394a234c385be014e9a488f2bb6eef821 @@ -11,28 +11,36 @@ imports: - name: github.com/asaskevich/govalidator version: 7664702784775e51966f0885f5cd27435916517b - name: github.com/Azure/go-ansiterm - version: 19f72df4d05d31cbe1c56bfc8045c96babff6c7e + version: d6e3b3328b783f23731bc4d058875b0371ff8109 subpackages: - winterm - name: github.com/Azure/go-autorest - version: d4e6b95c12a08b4de2d48b45d5b4d594e5d32fab + version: bca49d5b51a50dc5bb17bbf6204c711c6dbded06 subpackages: - autorest - autorest/adal - autorest/azure - autorest/date + - version - name: github.com/beorn7/perks version: 3ac7bf7a47d159a033b107610db8a1b6575507a4 subpackages: - quantile - name: github.com/BurntSushi/toml - version: b26d9c308763d68093482582cea63d69be07a0f0 + version: 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 +- name: github.com/chai2010/gettext-go + version: c6fed771bfd517099caf0f7a961671fa8ed08723 + subpackages: + - gettext + - gettext/mo + - gettext/plural + - gettext/po - name: github.com/cpuguy83/go-md2man version: 71acacd42f85e5e82f70a55327789582a5200a90 subpackages: - md2man - name: github.com/cyphar/filepath-securejoin - version: 06bda8370f45268db985f7af15732444d94ed51c + version: a261ee33d7a517f054effbf451841abaafe3e0fd - name: github.com/davecgh/go-spew version: 782f4967f2dc4564575ca782fe2d04090b5faca8 subpackages: @@ -45,7 +53,7 @@ imports: - digestset - reference - name: github.com/docker/docker - version: 4f3616fb1c112e206b88cb7a9922bf49067a7756 + version: a9fbbdc8dd8794b20af358382ab780559bca589d subpackages: - api - api/types @@ -64,18 +72,15 @@ imports: - api/types/versions - api/types/volume - client - - pkg/ioutils - - pkg/jsonlog + - daemon/logger/jsonfilelog/jsonlog - pkg/jsonmessage - - pkg/longpath - pkg/mount - pkg/parsers + - pkg/parsers/operatingsystem - pkg/stdcopy - pkg/sysinfo - - pkg/system - pkg/term - pkg/term/windows - - pkg/tlsconfig - name: github.com/docker/go-connections version: 3ede32e2033de7505e6500d6c868c2b9ed9f169d subpackages: @@ -89,7 +94,7 @@ imports: subpackages: - spdy - name: github.com/evanphx/json-patch - version: 944e07253867aacae43c04b2e6a239005443f33a + version: 36442dbdb585210f8d5a1b45e67aa323c197d5c4 - name: github.com/exponent-io/jsonpath version: d6023ce2651d8eafb5c75bb0c7167536102ec9f5 - name: github.com/fatih/camelcase @@ -146,7 +151,7 @@ imports: - compiler - extensions - name: github.com/gophercloud/gophercloud - version: 6da026c32e2d622cc242d32984259c77237aefe1 + version: 781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d subpackages: - openstack - openstack/identity/v2/tenants @@ -169,16 +174,14 @@ imports: version: a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4 subpackages: - simplelru -- name: github.com/howeyc/gopass - version: bf9dde6d0d2c004a008c27aaee91170c786f6db8 - name: github.com/huandu/xstrings version: 3959339b333561bf62a38b424fd41517c2c90f40 - name: github.com/imdario/mergo - version: 6633656539c1639d9d78127b7d47c622b5d7b6dc + version: 9316a62528ac99aaecb4e47eadd6dc8aa6533d58 - name: github.com/inconshreveable/mousetrap version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/json-iterator/go - version: 13f86432b882000a51c6e610c620974462691a97 + version: f2b4162afba35581b6d4a50d3b8f34e33c144682 - name: github.com/mailru/easyjson version: 2f5df55504ebc322e4d52d34df6a1f5b503bf26d subpackages: @@ -190,17 +193,21 @@ imports: - name: github.com/Masterminds/semver version: 517734cc7d6470c0d07130e40fd40bdeb9bcd3fd - name: github.com/Masterminds/sprig - version: 6b2a58267f6a8b1dc8e2eb5519b984008fa85e8c + version: 15f9564e7e9cf0da02a48e0d25f12a7b83559aa6 - name: github.com/Masterminds/vcs version: 3084677c2c188840777bff30054f2b553729d329 - name: github.com/mattn/go-runewidth version: d6bea18f789704b5f83375793155289da36a3c7f - name: github.com/matttproud/golang_protobuf_extensions - version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a + version: c12348ce28de40eed0136aa2b644d0ee0650e56c subpackages: - pbutil - name: github.com/mitchellh/go-wordwrap version: ad45545899c7b13c020ea92b2072220eefad42b8 +- name: github.com/modern-go/concurrent + version: bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 +- name: github.com/modern-go/reflect2 + version: 05fbef0ca5da472bbf96c9322b84a53edc03c9fd - name: github.com/opencontainers/go-digest version: a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb - name: github.com/opencontainers/image-spec @@ -208,8 +215,6 @@ imports: subpackages: - specs-go - specs-go/v1 -- name: github.com/pborman/uuid - version: ca53cad383cad2479bbba7f7a1a05797ec1386e4 - name: github.com/peterbourgon/diskv version: 5f041e8faa004a95c88a202771f4cc3e991971e6 - name: github.com/pkg/errors @@ -244,15 +249,15 @@ imports: - name: github.com/sirupsen/logrus version: 89742aefa4b206dcf400792f3bd35b542998eb3b - name: github.com/spf13/cobra - version: f62e98d28ab7ad31d707ba837a966378465c7b57 + version: c439c4fa093711d42e1b01acb1235b52004753c1 subpackages: - doc - name: github.com/spf13/pflag - version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7 + version: 298182f68c66c05229eb03ac171abe6e309ee79a - name: github.com/technosophos/moniker - version: ab470f5e105a44d0c87ea21bacd6a335c4816d83 + version: a5dbd03a2245d554160e3ae6bfdcf969fe58b431 - name: golang.org/x/crypto - version: 81e90905daefcd6fd217b62423c0908922eadb30 + version: de0752318171da717af4ce24d0a2e8626afaeb11 subpackages: - cast5 - ed25519 @@ -286,7 +291,7 @@ imports: - jws - jwt - name: golang.org/x/sys - version: 43eea11bc92608addb41b8a406b0407495c106f6 + version: 95c6576299259db960f6c5b9b69ea52422860fce subpackages: - unix - windows @@ -353,15 +358,15 @@ imports: - name: gopkg.in/inf.v0 version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4 - name: gopkg.in/square/go-jose.v2 - version: f8f38de21b4dcd69d0413faf231983f5fd6634b1 + version: 89060dee6a84df9a4dae49f676f0c755037834f1 subpackages: - cipher - json - jwt - name: gopkg.in/yaml.v2 - version: 53feefa2559fb8dfa8d81baad31be332c97d6c77 + version: 670d4cfef0544295bc27a114dbac37980d83185a - name: k8s.io/api - version: c699ec51538f0cfd4afa8bfcfe1e0779cafbe666 + version: fd83cbc87e7632ccd8bbab63d2b673d4e0c631cc subpackages: - admission/v1beta1 - admissionregistration/v1alpha1 @@ -375,10 +380,12 @@ imports: - authorization/v1beta1 - autoscaling/v1 - autoscaling/v2beta1 + - autoscaling/v2beta2 - batch/v1 - batch/v1beta1 - batch/v2alpha1 - certificates/v1beta1 + - coordination/v1beta1 - core/v1 - events/v1beta1 - extensions/v1beta1 @@ -389,28 +396,29 @@ imports: - rbac/v1alpha1 - rbac/v1beta1 - scheduling/v1alpha1 + - scheduling/v1beta1 - settings/v1alpha1 - storage/v1 - storage/v1alpha1 - storage/v1beta1 - name: k8s.io/apiextensions-apiserver - version: 898b0eda132e1aeac43a459785144ee4bf9b0a2e + version: 05e89e265cc594459a3d33a63e779d94e6614c63 subpackages: - pkg/features - name: k8s.io/apimachinery - version: 54101a56dda9a0962bc48751c058eb4c546dcbb9 + version: 6dd46049f39503a1fc8d65de4bd566829e95faff subpackages: - pkg/api/equality - pkg/api/errors - pkg/api/meta + - pkg/api/meta/testrestmapper - pkg/api/resource - pkg/api/validation - - pkg/apimachinery - - pkg/apimachinery/announced - - pkg/apimachinery/registered + - pkg/api/validation/path - pkg/apis/meta/internalversion - pkg/apis/meta/v1 - pkg/apis/meta/v1/unstructured + - pkg/apis/meta/v1/unstructured/unstructuredscheme - pkg/apis/meta/v1/validation - pkg/apis/meta/v1beta1 - pkg/conversion @@ -438,13 +446,13 @@ imports: - pkg/util/intstr - pkg/util/json - pkg/util/mergepatch + - pkg/util/naming - pkg/util/net - pkg/util/rand - pkg/util/remotecommand - pkg/util/runtime - pkg/util/sets - pkg/util/strategicpatch - - pkg/util/uuid - pkg/util/validation - pkg/util/validation/field - pkg/util/wait @@ -455,7 +463,7 @@ imports: - third_party/forked/golang/netutil - third_party/forked/golang/reflect - name: k8s.io/apiserver - version: ea53f8588c655568158b4ff53f5ec6fa4ebfc332 + version: e85ad7b666fef0476185731329f4cff1536efff8 subpackages: - pkg/apis/audit - pkg/authentication/authenticator @@ -464,53 +472,19 @@ imports: - pkg/endpoints/request - pkg/features - pkg/util/feature - - pkg/util/flag +- name: k8s.io/cli-runtime + version: 79bf4e0b64544d8c490247abae089bea572ddae6 + subpackages: + - pkg/genericclioptions + - pkg/genericclioptions/printers + - pkg/genericclioptions/resource - name: k8s.io/client-go - version: 23781f4d6632d88e869066eaebb743857aa1ef9b + version: 1638f8970cefaa404ff3a62950f88b08292b2696 subpackages: - discovery - discovery/fake - dynamic - - informers - - informers/admissionregistration - - informers/admissionregistration/v1alpha1 - - informers/admissionregistration/v1beta1 - - informers/apps - - informers/apps/v1 - - informers/apps/v1beta1 - - informers/apps/v1beta2 - - informers/autoscaling - - informers/autoscaling/v1 - - informers/autoscaling/v2beta1 - - informers/batch - - informers/batch/v1 - - informers/batch/v1beta1 - - informers/batch/v2alpha1 - - informers/certificates - - informers/certificates/v1beta1 - - informers/core - - informers/core/v1 - - informers/events - - informers/events/v1beta1 - - informers/extensions - - informers/extensions/v1beta1 - - informers/internalinterfaces - - informers/networking - - informers/networking/v1 - - informers/policy - - informers/policy/v1beta1 - - informers/rbac - - informers/rbac/v1 - - informers/rbac/v1alpha1 - - informers/rbac/v1beta1 - - informers/scheduling - - informers/scheduling/v1alpha1 - - informers/settings - - informers/settings/v1alpha1 - - informers/storage - - informers/storage/v1 - - informers/storage/v1alpha1 - - informers/storage/v1beta1 + - dynamic/fake - kubernetes - kubernetes/fake - kubernetes/scheme @@ -536,6 +510,8 @@ imports: - kubernetes/typed/autoscaling/v1/fake - kubernetes/typed/autoscaling/v2beta1 - kubernetes/typed/autoscaling/v2beta1/fake + - kubernetes/typed/autoscaling/v2beta2 + - kubernetes/typed/autoscaling/v2beta2/fake - kubernetes/typed/batch/v1 - kubernetes/typed/batch/v1/fake - kubernetes/typed/batch/v1beta1 @@ -544,6 +520,8 @@ imports: - kubernetes/typed/batch/v2alpha1/fake - kubernetes/typed/certificates/v1beta1 - kubernetes/typed/certificates/v1beta1/fake + - kubernetes/typed/coordination/v1beta1 + - kubernetes/typed/coordination/v1beta1/fake - kubernetes/typed/core/v1 - kubernetes/typed/core/v1/fake - kubernetes/typed/events/v1beta1 @@ -562,6 +540,8 @@ imports: - kubernetes/typed/rbac/v1beta1/fake - kubernetes/typed/scheduling/v1alpha1 - kubernetes/typed/scheduling/v1alpha1/fake + - kubernetes/typed/scheduling/v1beta1 + - kubernetes/typed/scheduling/v1beta1/fake - kubernetes/typed/settings/v1alpha1 - kubernetes/typed/settings/v1alpha1/fake - kubernetes/typed/storage/v1 @@ -570,32 +550,9 @@ imports: - kubernetes/typed/storage/v1alpha1/fake - kubernetes/typed/storage/v1beta1 - kubernetes/typed/storage/v1beta1/fake - - listers/admissionregistration/v1alpha1 - - listers/admissionregistration/v1beta1 - - listers/apps/v1 - - listers/apps/v1beta1 - - listers/apps/v1beta2 - - listers/autoscaling/v1 - - listers/autoscaling/v2beta1 - - listers/batch/v1 - - listers/batch/v1beta1 - - listers/batch/v2alpha1 - - listers/certificates/v1beta1 - - listers/core/v1 - - listers/events/v1beta1 - - listers/extensions/v1beta1 - - listers/networking/v1 - - listers/policy/v1beta1 - - listers/rbac/v1 - - listers/rbac/v1alpha1 - - listers/rbac/v1beta1 - - listers/scheduling/v1alpha1 - - listers/settings/v1alpha1 - - listers/storage/v1 - - listers/storage/v1alpha1 - - listers/storage/v1beta1 - pkg/apis/clientauthentication - pkg/apis/clientauthentication/v1alpha1 + - pkg/apis/clientauthentication/v1beta1 - pkg/version - plugin/pkg/client/auth - plugin/pkg/client/auth/azure @@ -606,6 +563,7 @@ imports: - rest - rest/fake - rest/watch + - restmapper - scale - scale/scheme - scale/scheme/appsint @@ -628,24 +586,26 @@ imports: - tools/record - tools/reference - tools/remotecommand + - tools/watch - transport - transport/spdy - util/buffer - util/cert + - util/connrotation - util/exec - util/flowcontrol - util/homedir - util/integer - util/jsonpath - util/retry - - util/workqueue - name: k8s.io/kube-openapi - version: 50ae88d24ede7b8bad68e23c805b5d3da5c8abaf + version: 0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803 subpackages: - pkg/util/proto + - pkg/util/proto/testing - pkg/util/proto/validation - name: k8s.io/kubernetes - version: baab3992147260d47cb59b9c485a24fdeff2e457 + version: 54a352dda957bce0f88e49b65a6ee8bba8c0ba74 subpackages: - pkg/api/events - pkg/api/legacyscheme @@ -679,6 +639,7 @@ imports: - pkg/apis/autoscaling/install - pkg/apis/autoscaling/v1 - pkg/apis/autoscaling/v2beta1 + - pkg/apis/autoscaling/v2beta2 - pkg/apis/batch - pkg/apis/batch/install - pkg/apis/batch/v1 @@ -687,9 +648,9 @@ imports: - pkg/apis/certificates - pkg/apis/certificates/install - pkg/apis/certificates/v1beta1 - - pkg/apis/componentconfig - - pkg/apis/componentconfig/install - - pkg/apis/componentconfig/v1alpha1 + - pkg/apis/coordination + - pkg/apis/coordination/install + - pkg/apis/coordination/v1beta1 - pkg/apis/core - pkg/apis/core/helper - pkg/apis/core/helper/qos @@ -697,7 +658,6 @@ imports: - pkg/apis/core/pods - pkg/apis/core/v1 - pkg/apis/core/v1/helper - - pkg/apis/core/v1/helper/qos - pkg/apis/core/validation - pkg/apis/events - pkg/apis/events/install @@ -722,6 +682,7 @@ imports: - pkg/apis/scheduling - pkg/apis/scheduling/install - pkg/apis/scheduling/v1alpha1 + - pkg/apis/scheduling/v1beta1 - pkg/apis/settings - pkg/apis/settings/install - pkg/apis/settings/v1alpha1 @@ -733,71 +694,45 @@ imports: - pkg/apis/storage/v1beta1 - pkg/capabilities - pkg/client/clientset_generated/internalclientset - - pkg/client/clientset_generated/internalclientset/fake - pkg/client/clientset_generated/internalclientset/scheme - pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion - - pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/apps/internalversion - - pkg/client/clientset_generated/internalclientset/typed/apps/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion - - pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion - - pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion - - pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/batch/internalversion - - pkg/client/clientset_generated/internalclientset/typed/batch/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion - - pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion/fake + - pkg/client/clientset_generated/internalclientset/typed/coordination/internalversion - pkg/client/clientset_generated/internalclientset/typed/core/internalversion - - pkg/client/clientset_generated/internalclientset/typed/core/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/events/internalversion - - pkg/client/clientset_generated/internalclientset/typed/events/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion - - pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/networking/internalversion - - pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/policy/internalversion - - pkg/client/clientset_generated/internalclientset/typed/policy/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/rbac/internalversion - - pkg/client/clientset_generated/internalclientset/typed/rbac/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/scheduling/internalversion - - pkg/client/clientset_generated/internalclientset/typed/scheduling/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/settings/internalversion - - pkg/client/clientset_generated/internalclientset/typed/settings/internalversion/fake - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion - - pkg/client/clientset_generated/internalclientset/typed/storage/internalversion/fake - - pkg/client/conditions - - pkg/cloudprovider - pkg/controller - - pkg/controller/daemon - - pkg/controller/daemon/util - pkg/controller/deployment/util - - pkg/controller/history - - pkg/controller/statefulset - - pkg/controller/volume/events - - pkg/controller/volume/persistentvolume - - pkg/controller/volume/persistentvolume/metrics - pkg/credentialprovider - pkg/features - pkg/fieldpath + - pkg/generated - pkg/kubectl - pkg/kubectl/apps - - pkg/kubectl/categories + - pkg/kubectl/cmd/get - pkg/kubectl/cmd/templates - pkg/kubectl/cmd/testing - pkg/kubectl/cmd/util - pkg/kubectl/cmd/util/openapi - pkg/kubectl/cmd/util/openapi/testing - pkg/kubectl/cmd/util/openapi/validation - - pkg/kubectl/plugins - - pkg/kubectl/resource - pkg/kubectl/scheme - pkg/kubectl/util - pkg/kubectl/util/hash + - pkg/kubectl/util/i18n - pkg/kubectl/util/slice - pkg/kubectl/util/term - - pkg/kubectl/util/transport - pkg/kubectl/validation - pkg/kubelet/apis - pkg/kubelet/types @@ -806,42 +741,29 @@ imports: - pkg/printers/internalversion - pkg/registry/rbac/validation - pkg/scheduler/algorithm - - pkg/scheduler/algorithm/predicates - pkg/scheduler/algorithm/priorities/util - pkg/scheduler/api - - pkg/scheduler/schedulercache + - pkg/scheduler/cache - pkg/scheduler/util - - pkg/scheduler/volumebinder - pkg/security/apparmor - pkg/serviceaccount - pkg/util/file - - pkg/util/goroutinemap - - pkg/util/goroutinemap/exponentialbackoff - pkg/util/hash - pkg/util/interrupt - - pkg/util/io - pkg/util/labels - - pkg/util/metrics - - pkg/util/mount - pkg/util/net/sets - pkg/util/node - - pkg/util/nsenter - pkg/util/parsers - - pkg/util/pointer - pkg/util/slice - pkg/util/taints - pkg/version - - pkg/volume - - pkg/volume/util - - pkg/volume/util/fs - - pkg/volume/util/recyclerclient - - pkg/volume/util/types - name: k8s.io/utils - version: aedf551cdb8b0119df3a19c65fde413a13b34997 + version: 66066c83e385e385ccc3c964b44fd7dcd413d0ed subpackages: - clock - exec - exec/testing + - pointer - name: vbom.ml/util version: db5cfe13f5cc80a4990d98e2e1b0707a4d1a5394 subpackages: @@ -852,6 +774,7 @@ testImports: subpackages: - difflib - name: github.com/stretchr/testify - version: e3a8ff8ce36581f87a15341206f205b1da467059 + version: c679ae2cc0cb27ec3293fea7e254e47386f05d69 subpackages: - assert + - require diff --git a/glide.yaml b/glide.yaml index fc3dcc37d..37c3f857e 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,68 +1,64 @@ package: k8s.io/helm import: -- package: golang.org/x/net - subpackages: - - context -- package: github.com/spf13/cobra - version: f62e98d28ab7ad31d707ba837a966378465c7b57 -- package: github.com/spf13/pflag - version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7 -- package: github.com/Masterminds/vcs - version: ~1.11.0 + - package: golang.org/x/net + subpackages: + - context + - package: github.com/spf13/cobra + version: c439c4fa093711d42e1b01acb1235b52004753c1 + - package: github.com/spf13/pflag + version: ~1.0.1 + - package: github.com/Masterminds/vcs # Pin version of mergo that is compatible with both sprig and Kubernetes -- package: github.com/imdario/mergo - version: 6633656539c1639d9d78127b7d47c622b5d7b6dc -- package: github.com/Masterminds/sprig - version: ^2.14.1 -- package: github.com/ghodss/yaml -- package: github.com/Masterminds/semver - version: ~1.3.1 -- package: github.com/technosophos/moniker - version: ~0.2 -- package: github.com/golang/protobuf - version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 - subpackages: - - proto - - ptypes/any - - ptypes/timestamp -- package: google.golang.org/grpc - version: 1.7.2 -- package: github.com/gosuri/uitable -- package: github.com/asaskevich/govalidator - version: ^4.0.0 -- package: golang.org/x/crypto - subpackages: - - openpgp -# pin version of golang.org/x/sys that is compatible with golang.org/x/crypto -- package: golang.org/x/sys - version: 43eea11 - subpackages: - - unix - - windows -- package: github.com/gobwas/glob - version: ^0.2.1 -- package: github.com/evanphx/json-patch -- package: github.com/BurntSushi/toml - version: ~0.3.0 -- package: github.com/prometheus/client_golang - version: 0.8.0 -- package: github.com/grpc-ecosystem/go-grpc-prometheus + - package: github.com/imdario/mergo + version: v0.3.5 + - package: github.com/Masterminds/sprig + version: ^2.16.0 + - package: github.com/ghodss/yaml + - package: github.com/Masterminds/semver + version: ~1.3.1 + - package: github.com/technosophos/moniker + version: ~0.2 + - package: github.com/golang/protobuf + version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 + subpackages: + - proto + - ptypes/any + - ptypes/timestamp + - package: google.golang.org/grpc + version: 1.7.2 + - package: github.com/gosuri/uitable + - package: github.com/asaskevich/govalidator + version: ^4.0.0 + - package: golang.org/x/crypto + subpackages: + - openpgp + - ssh/terminal + - package: github.com/gobwas/glob + version: ^0.2.1 + - package: github.com/evanphx/json-patch + - package: github.com/BurntSushi/toml + version: ~0.3.0 + - package: github.com/prometheus/client_golang + version: 0.8.0 + - package: github.com/grpc-ecosystem/go-grpc-prometheus -- package: k8s.io/kubernetes - version: release-1.10 -- package: k8s.io/client-go - version: kubernetes-1.10.0 -- package: k8s.io/api - version: release-1.10 -- package: k8s.io/apimachinery - version: release-1.10 -- package: k8s.io/apiserver - version: release-1.10 -- package: github.com/cyphar/filepath-securejoin - version: ^0.2.1 + - package: k8s.io/kubernetes + version: release-1.12 + - package: k8s.io/client-go + version: kubernetes-1.12.0 + - package: k8s.io/api + version: kubernetes-1.12.0 + - package: k8s.io/apimachinery + version: kubernetes-1.12.0 + - package: k8s.io/apiserver + version: kubernetes-1.12.0 + - package: k8s.io/cli-runtime + version: kubernetes-1.12.0 + - package: github.com/cyphar/filepath-securejoin + version: ^0.2.1 testImports: -- package: github.com/stretchr/testify - version: ^1.1.4 - subpackages: - - assert + - package: github.com/stretchr/testify + version: ^1.1.4 + subpackages: + - assert diff --git a/pkg/chartutil/capabilities.go b/pkg/chartutil/capabilities.go index d26aa1707..d7e660b8a 100644 --- a/pkg/chartutil/capabilities.go +++ b/pkg/chartutil/capabilities.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/capabilities_test.go b/pkg/chartutil/capabilities_test.go index ac20f0038..1f7020a39 100644 --- a/pkg/chartutil/capabilities_test.go +++ b/pkg/chartutil/capabilities_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/chartfile.go b/pkg/chartutil/chartfile.go index c2879cdae..f997d15fe 100644 --- a/pkg/chartutil/chartfile.go +++ b/pkg/chartutil/chartfile.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/chartfile_test.go b/pkg/chartutil/chartfile_test.go index 5b36dc955..e55fbbd48 100755 --- a/pkg/chartutil/chartfile_test.go +++ b/pkg/chartutil/chartfile_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 30c6310b2..875083f7e 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -44,8 +44,12 @@ const ( ServiceName = "service.yaml" // NotesName is the name of the example NOTES.txt file. NotesName = "NOTES.txt" - // HelpersName is the name of the example NOTES.txt file. + // HelpersName is the name of the example helpers file. HelpersName = "_helpers.tpl" + // TemplatesTestsDir is the relative directory name for templates tests. + TemplatesTestsDir = "templates/tests" + // TestConnectionName is the name of the example connection test file. + TestConnectionName = "test-connection.yaml" ) const defaultValues = `# Default values for %s. @@ -71,7 +75,7 @@ ingress: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - path: / + paths: [] hosts: - chart-example.local tls: [] @@ -119,20 +123,21 @@ const defaultIgnore = `# Patterns to ignore when building packages. .project .idea/ *.tmproj +.vscode/ ` const defaultIngress = `{{- if .Values.ingress.enabled -}} {{- $fullName := include ".fullname" . -}} -{{- $ingressPath := .Values.ingress.path -}} +{{- $ingressPaths := .Values.ingress.paths -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: name: {{ $fullName }} labels: - app: {{ template ".name" . }} - chart: {{ template ".chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} {{- with .Values.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} @@ -153,34 +158,36 @@ spec: - host: {{ . | quote }} http: paths: - - path: {{ $ingressPath }} + {{- range $ingressPaths }} + - path: {{ . }} backend: serviceName: {{ $fullName }} servicePort: http + {{- end }} {{- end }} {{- end }} ` -const defaultDeployment = `apiVersion: apps/v1beta2 +const defaultDeployment = `apiVersion: apps/v1 kind: Deployment metadata: - name: {{ template ".fullname" . }} + name: {{ include ".fullname" . }} labels: - app: {{ template ".name" . }} - chart: {{ template ".chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: - app: {{ template ".name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ include ".name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: labels: - app: {{ template ".name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ include ".name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} spec: containers: - name: {{ .Chart.Name }} @@ -217,12 +224,12 @@ spec: const defaultService = `apiVersion: v1 kind: Service metadata: - name: {{ template ".fullname" . }} + name: {{ include ".fullname" . }} labels: - app: {{ template ".name" . }} - chart: {{ template ".chart" . }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} spec: type: {{ .Values.service.type }} ports: @@ -231,26 +238,28 @@ spec: protocol: TCP name: http selector: - app: {{ template ".name" . }} - release: {{ .Release.Name }} + app.kubernetes.io/name: {{ include ".name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} ` const defaultNotes = `1. Get the application URL by running these commands: {{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- range $host := .Values.ingress.hosts }} + {{- range $.Values.ingress.paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }} + {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template ".fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include ".fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ template ".fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template ".fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + You can watch the status of by running 'kubectl get svc -w {{ include ".fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include ".fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template ".name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include ".name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:80 {{- end }} @@ -290,6 +299,26 @@ Create chart name and version as used by the chart label. {{- end -}} ` +const defaultTestConnection = `apiVersion: v1 +kind: Pod +metadata: + name: "{{ include ".fullname" . }}-test-connection" + labels: + app.kubernetes.io/name: {{ include ".name" . }} + helm.sh/chart: {{ include ".chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include ".fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never +` + // CreateFrom creates a new chart, but scaffolds it from the src chart. func CreateFrom(chartfile *chart.Metadata, dest string, src string) error { schart, err := Load(src) @@ -354,7 +383,7 @@ func Create(chartfile *chart.Metadata, dir string) (string, error) { } } - for _, d := range []string{TemplatesDir, ChartsDir} { + for _, d := range []string{TemplatesDir, TemplatesTestsDir, ChartsDir} { if err := os.MkdirAll(filepath.Join(cdir, d), 0755); err != nil { return cdir, err } @@ -399,6 +428,11 @@ func Create(chartfile *chart.Metadata, dir string) (string, error) { path: filepath.Join(cdir, TemplatesDir, HelpersName), content: Transform(defaultHelpers, "", chartfile.Name), }, + { + // test-connection.yaml + path: filepath.Join(cdir, TemplatesTestsDir, TestConnectionName), + content: Transform(defaultTestConnection, "", chartfile.Name), + }, } for _, file := range files { diff --git a/pkg/chartutil/create_test.go b/pkg/chartutil/create_test.go index e9af83ad2..a0ddf8fa2 100644 --- a/pkg/chartutil/create_test.go +++ b/pkg/chartutil/create_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -75,6 +75,14 @@ func TestCreate(t *testing.T) { } } + for _, f := range []string{TestConnectionName} { + if fi, err := os.Stat(filepath.Join(dir, TemplatesTestsDir, f)); err != nil { + t.Errorf("Expected %s file: %s", f, err) + } else if fi.IsDir() { + t.Errorf("Expected %s to be a file.", f) + } + } + } func TestCreateFrom(t *testing.T) { diff --git a/pkg/chartutil/doc.go b/pkg/chartutil/doc.go index 1190d968d..cb3f5d1f1 100644 --- a/pkg/chartutil/doc.go +++ b/pkg/chartutil/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/expand.go b/pkg/chartutil/expand.go index 126e14e80..1d49b159f 100644 --- a/pkg/chartutil/expand.go +++ b/pkg/chartutil/expand.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/files.go b/pkg/chartutil/files.go index a09bb8f43..36391c3e8 100644 --- a/pkg/chartutil/files.go +++ b/pkg/chartutil/files.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -36,10 +36,8 @@ type Files map[string][]byte // Given an []*any.Any (the format for files in a chart.Chart), extract a map of files. func NewFiles(from []*any.Any) Files { files := map[string][]byte{} - if from != nil { - for _, f := range from { - files[f.TypeUrl] = f.Value - } + for _, f := range from { + files[f.TypeUrl] = f.Value } return files } diff --git a/pkg/chartutil/files_test.go b/pkg/chartutil/files_test.go index 731c82e6f..1488b7986 100644 --- a/pkg/chartutil/files_test.go +++ b/pkg/chartutil/files_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/load.go b/pkg/chartutil/load.go index c5246b8d7..b3daefac7 100644 --- a/pkg/chartutil/load.go +++ b/pkg/chartutil/load.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/load_test.go b/pkg/chartutil/load_test.go index 454500489..5cb15fbdc 100644 --- a/pkg/chartutil/load_test.go +++ b/pkg/chartutil/load_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/requirements.go b/pkg/chartutil/requirements.go index 6ef6508d9..566123122 100644 --- a/pkg/chartutil/requirements.go +++ b/pkg/chartutil/requirements.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/requirements_test.go b/pkg/chartutil/requirements_test.go index 24388f86c..0afde17e1 100644 --- a/pkg/chartutil/requirements_test.go +++ b/pkg/chartutil/requirements_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index bff32dde5..400b85e91 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import ( "io/ioutil" "os" "path/filepath" + "time" "github.com/ghodss/yaml" @@ -48,12 +49,12 @@ func SaveDir(c *chart.Chart, dest string) error { // Save values.yaml if c.Values != nil && len(c.Values.Raw) > 0 { vf := filepath.Join(outdir, ValuesfileName) - if err := ioutil.WriteFile(vf, []byte(c.Values.Raw), 0755); err != nil { + if err := ioutil.WriteFile(vf, []byte(c.Values.Raw), 0644); err != nil { return err } } - for _, d := range []string{TemplatesDir, ChartsDir} { + for _, d := range []string{TemplatesDir, ChartsDir, TemplatesTestsDir} { if err := os.MkdirAll(filepath.Join(outdir, d), 0755); err != nil { return err } @@ -62,7 +63,7 @@ func SaveDir(c *chart.Chart, dest string) error { // Save templates for _, f := range c.Templates { n := filepath.Join(outdir, f.Name) - if err := ioutil.WriteFile(n, f.Data, 0755); err != nil { + if err := ioutil.WriteFile(n, f.Data, 0644); err != nil { return err } } @@ -76,7 +77,7 @@ func SaveDir(c *chart.Chart, dest string) error { return err } - if err := ioutil.WriteFile(n, f.Value, 0755); err != nil { + if err := ioutil.WriteFile(n, f.Value, 0644); err != nil { return err } } @@ -205,9 +206,10 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error { func writeToTar(out *tar.Writer, name string, body []byte) error { // TODO: Do we need to create dummy parent directory names if none exist? h := &tar.Header{ - Name: name, - Mode: 0755, - Size: int64(len(body)), + Name: filepath.ToSlash(name), + Mode: 0755, + Size: int64(len(body)), + ModTime: time.Now(), } if err := out.WriteHeader(h); err != nil { return err diff --git a/pkg/chartutil/save_test.go b/pkg/chartutil/save_test.go index 5e1564299..0ec305e78 100644 --- a/pkg/chartutil/save_test.go +++ b/pkg/chartutil/save_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,10 +17,14 @@ limitations under the License. package chartutil import ( + "archive/tar" + "compress/gzip" + "io" "io/ioutil" "os" "strings" "testing" + "time" "github.com/golang/protobuf/ptypes/any" "k8s.io/helm/pkg/proto/hapi/chart" @@ -73,6 +77,82 @@ func TestSave(t *testing.T) { } } +func TestSavePreservesTimestamps(t *testing.T) { + // Test executes so quickly that if we don't subtract a second, the + // check will fail because `initialCreateTime` will be identical to the + // written timestamp for the files. + initialCreateTime := time.Now().Add(-1 * time.Second) + + tmp, err := ioutil.TempDir("", "helm-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tmp) + + c := &chart.Chart{ + Metadata: &chart.Metadata{ + Name: "ahab", + Version: "1.2.3.4", + }, + Values: &chart.Config{ + Raw: "ship: Pequod", + }, + Files: []*any.Any{ + {TypeUrl: "scheherazade/shahryar.txt", Value: []byte("1,001 Nights")}, + }, + } + + where, err := Save(c, tmp) + if err != nil { + t.Fatalf("Failed to save: %s", err) + } + + allHeaders, err := retrieveAllHeadersFromTar(where) + if err != nil { + t.Fatalf("Failed to parse tar: %v", err) + } + + for _, header := range allHeaders { + if header.ModTime.Before(initialCreateTime) { + t.Fatalf("File timestamp not preserved: %v", header.ModTime) + } + } +} + +// We could refactor `load.go` to use this `retrieveAllHeadersFromTar` function +// as well, so we are not duplicating components of the code which iterate +// through the tar. +func retrieveAllHeadersFromTar(path string) ([]*tar.Header, error) { + raw, err := os.Open(path) + if err != nil { + return nil, err + } + defer raw.Close() + + unzipped, err := gzip.NewReader(raw) + if err != nil { + return nil, err + } + defer unzipped.Close() + + tr := tar.NewReader(unzipped) + headers := []*tar.Header{} + for { + hd, err := tr.Next() + if err == io.EOF { + break + } + + if err != nil { + return nil, err + } + + headers = append(headers, hd) + } + + return headers, nil +} + func TestSaveDir(t *testing.T) { tmp, err := ioutil.TempDir("", "helm-") if err != nil { diff --git a/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100755 --- a/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml index 3835a3d0b..e06d19b90 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 }}" + release-is-upgrade: "{{ .Release.IsUpgrade }}" + release-is-install: "{{ .Release.IsInstall }}" kube-version/major: "{{ .Capabilities.KubeVersion.Major }}" kube-version/minor: "{{ .Capabilities.KubeVersion.Minor }}" kube-version/gitversion: "v{{ .Capabilities.KubeVersion.Major }}.{{ .Capabilities.KubeVersion.Minor }}.0" diff --git a/pkg/chartutil/transform.go b/pkg/chartutil/transform.go index 7cbb754fb..fbee8e690 100644 --- a/pkg/chartutil/transform.go +++ b/pkg/chartutil/transform.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index 66a2658d5..1ea7edd8c 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index d9b03c21a..f54b25827 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 59b9d4d75..5e6287299 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -170,8 +170,11 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, ge if err != nil { return u, nil, err } - getter, err := getterConstructor(ref, "", "", "") - return u, getter, err + g, err := getterConstructor(ref, "", "", "") + if t, ok := g.(*getter.HttpGetter); ok { + t.SetCredentials(c.Username, c.Password) + } + return u, g, err } return u, nil, err } diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go index 80efa77e8..5967eee70 100644 --- a/pkg/downloader/chart_downloader_test.go +++ b/pkg/downloader/chart_downloader_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/doc.go b/pkg/downloader/doc.go index fb54936b8..c70b2f695 100644 --- a/pkg/downloader/doc.go +++ b/pkg/downloader/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 9ee1f6f6d..67f9dc7bf 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/manager_test.go b/pkg/downloader/manager_test.go index 1ff2a9c17..8c2377e47 100644 --- a/pkg/downloader/manager_test.go +++ b/pkg/downloader/manager_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml index 28d272ae2..8af354615 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.1.0 description: Deploy a basic Alpine Linux pod keywords: [] @@ -20,7 +20,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml index 1956e9f83..f51257233 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/malformed-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 1.2.3 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml index 14cdffece..7543a59f5 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 1.2.3 description: Deploy a basic Alpine Linux pod keywords: [] @@ -21,7 +21,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml b/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml index 1956e9f83..f51257233 100644 --- a/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml +++ b/pkg/downloader/testdata/helmhome/repository/cache/testing-querystring-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 1.2.3 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/downloader/testdata/signtest/alpine/Chart.yaml b/pkg/downloader/testdata/signtest/alpine/Chart.yaml index 6fbb27f18..fea865aa5 100644 --- a/pkg/downloader/testdata/signtest/alpine/Chart.yaml +++ b/pkg/downloader/testdata/signtest/alpine/Chart.yaml @@ -2,5 +2,5 @@ description: Deploy a basic Alpine Linux pod home: https://k8s.io/helm name: alpine sources: -- https://github.com/kubernetes/helm +- https://github.com/helm/helm version: 0.1.0 diff --git a/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml b/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml index 08cf3c2c1..c34fa8c47 100644 --- a/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml +++ b/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml @@ -3,7 +3,7 @@ kind: Pod metadata: name: {{.Release.Name}}-{{.Chart.Name}} labels: - heritage: {{.Release.Service}} + app.kubernetes.io/managed-by: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} annotations: diff --git a/pkg/engine/doc.go b/pkg/engine/doc.go index 53c4084b0..63c036605 100644 --- a/pkg/engine/doc.go +++ b/pkg/engine/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index 7a940fc84..b6cffc56b 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package engine import ( "bytes" "fmt" + "log" "path" "sort" "strings" @@ -39,6 +40,8 @@ type Engine struct { // a value that was not passed in. Strict bool CurrentTemplates map[string]renderable + // In LintMode, some 'required' template values may be missing, so don't fail + LintMode bool } // New creates a new Go template Engine instance. @@ -155,9 +158,19 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { // Add the 'required' function here funcMap["required"] = func(warn string, val interface{}) (interface{}, error) { if val == nil { + if e.LintMode { + // Don't fail on missing required values when linting + log.Printf("[INFO] Missing required value: %s", warn) + return val, nil + } return val, fmt.Errorf(warn) } else if _, ok := val.(string); ok { if val == "" { + if e.LintMode { + // Don't fail on missing required values when linting + log.Printf("[INFO] Missing required value: %s", warn) + return val, nil + } return val, fmt.Errorf(warn) } } diff --git a/pkg/engine/engine_test.go b/pkg/engine/engine_test.go index 8ffb3d87c..91a3fd795 100644 --- a/pkg/engine/engine_test.go +++ b/pkg/engine/engine_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/getter/doc.go b/pkg/getter/doc.go index fe51e4967..c53ef1ae0 100644 --- a/pkg/getter/doc.go +++ b/pkg/getter/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/getter.go b/pkg/getter/getter.go index ca018884a..c595fec69 100644 --- a/pkg/getter/getter.go +++ b/pkg/getter/getter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/getter/getter_test.go b/pkg/getter/getter_test.go index 6d38a0d28..d03c82686 100644 --- a/pkg/getter/getter_test.go +++ b/pkg/getter/getter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/httpgetter.go b/pkg/getter/httpgetter.go index 990cb8cc5..66ea82863 100644 --- a/pkg/getter/httpgetter.go +++ b/pkg/getter/httpgetter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -81,19 +81,17 @@ func newHTTPGetter(URL, CertFile, KeyFile, CAFile string) (Getter, error) { // NewHTTPGetter constructs a valid http/https client as HttpGetter func NewHTTPGetter(URL, CertFile, KeyFile, CAFile string) (*HttpGetter, error) { var client HttpGetter + tr := &http.Transport{ + DisableCompression: true, + Proxy: http.ProxyFromEnvironment, + } if (CertFile != "" && KeyFile != "") || CAFile != "" { tlsConf, err := tlsutil.NewTLSConfig(URL, CertFile, KeyFile, CAFile) if err != nil { return &client, fmt.Errorf("can't create TLS config: %s", err.Error()) } - client.client = &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: tlsConf, - Proxy: http.ProxyFromEnvironment, - }, - } - } else { - client.client = http.DefaultClient + tr.TLSClientConfig = tlsConf } + client.client = &http.Client{Transport: tr} return &client, nil } diff --git a/pkg/getter/httpgetter_test.go b/pkg/getter/httpgetter_test.go index ec730f401..fbe330390 100644 --- a/pkg/getter/httpgetter_test.go +++ b/pkg/getter/httpgetter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -16,21 +16,29 @@ limitations under the License. package getter import ( + "io" "net/http" + "net/http/httptest" + "os" "path/filepath" + "strconv" "testing" ) +type TestFileHandler struct{} + +func (h *TestFileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + HandleClient(w, r) +} + func TestHTTPGetter(t *testing.T) { g, err := newHTTPGetter("http://example.com", "", "", "") if err != nil { t.Fatal(err) } - if hg, ok := g.(*HttpGetter); !ok { + if _, ok := g.(*HttpGetter); !ok { t.Fatal("Expected newHTTPGetter to produce an HttpGetter") - } else if hg.client != http.DefaultClient { - t.Fatal("Expected newHTTPGetter to return a default HTTP client.") } // Test with SSL: @@ -58,3 +66,42 @@ func TestHTTPGetter(t *testing.T) { t.Fatal("Expected newHTTPGetter to return a non-default HTTP client") } } + +func HandleClient(writer http.ResponseWriter, request *http.Request) { + f, _ := os.Open("testdata/sssd-0.1.0.tgz") + defer f.Close() + + b := make([]byte, 512) + f.Read(b) + //Get the file size + FileStat, _ := f.Stat() + FileSize := strconv.FormatInt(FileStat.Size(), 10) + + //Simulating improper header values from bitbucket + writer.Header().Set("Content-Type", "application/x-tar") + writer.Header().Set("Content-Encoding", "gzip") + writer.Header().Set("Content-Length", FileSize) + + f.Seek(0, 0) + io.Copy(writer, f) + return +} + +func TestHTTPGetterTarDownload(t *testing.T) { + h := &TestFileHandler{} + server := httptest.NewServer(h) + defer server.Close() + + g, err := newHTTPGetter(server.URL, "", "", "") + if err != nil { + t.Fatal(err) + } + + data, _ := g.Get(server.URL) + mimeType := http.DetectContentType(data.Bytes()) + + expectedMimeType := "application/x-gzip" + if mimeType != expectedMimeType { + t.Fatalf("Expected response with MIME type %s, but got %s", expectedMimeType, mimeType) + } +} diff --git a/pkg/getter/plugingetter.go b/pkg/getter/plugingetter.go index c747eef7f..8f2099de0 100644 --- a/pkg/getter/plugingetter.go +++ b/pkg/getter/plugingetter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -69,6 +69,7 @@ func (p *pluginGetter) Get(href string) (*bytes.Buffer, error) { buf := bytes.NewBuffer(nil) prog.Stdout = buf prog.Stderr = os.Stderr + prog.Stdin = os.Stdin if err := prog.Run(); err != nil { if eerr, ok := err.(*exec.ExitError); ok { os.Stderr.Write(eerr.Stderr) diff --git a/pkg/getter/plugingetter_test.go b/pkg/getter/plugingetter_test.go index f1fe9bf29..9bfe6144d 100644 --- a/pkg/getter/plugingetter_test.go +++ b/pkg/getter/plugingetter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/getter/testdata/sssd-0.1.0.tgz b/pkg/getter/testdata/sssd-0.1.0.tgz new file mode 100644 index 000000000..2f34fece6 Binary files /dev/null and b/pkg/getter/testdata/sssd-0.1.0.tgz differ diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 3d246086f..fcd30c106 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -362,7 +362,7 @@ func (h *Client) list(ctx context.Context, req *rls.ListReleasesRequest) (*rls.L resp = r continue } - resp.Releases = append(resp.Releases, r.GetReleases()[0]) + resp.Releases = append(resp.Releases, r.GetReleases()...) } return resp, nil } diff --git a/pkg/helm/client_test.go b/pkg/helm/client_test.go index 95e044499..30d8e2002 100644 --- a/pkg/helm/client_test.go +++ b/pkg/helm/client_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index 2980e6dc9..6d40fb846 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,6 +32,19 @@ import ( "k8s.io/helm/pkg/helm/helmpath" ) +const ( + // DefaultTLSCaCert is the default value for HELM_TLS_CA_CERT + DefaultTLSCaCert = "$HELM_HOME/ca.pem" + // DefaultTLSCert is the default value for HELM_TLS_CERT + DefaultTLSCert = "$HELM_HOME/cert.pem" + // DefaultTLSKeyFile is the default value for HELM_TLS_KEY_FILE + DefaultTLSKeyFile = "$HELM_HOME/key.pem" + // DefaultTLSEnable is the default value for HELM_TLS_ENABLE + DefaultTLSEnable = false + // DefaultTLSVerify is the default value for HELM_TLS_VERIFY + DefaultTLSVerify = false +) + // DefaultHelmHome is the default HELM_HOME. var DefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") @@ -39,7 +52,7 @@ var DefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") type EnvSettings struct { // TillerHost is the host and port of Tiller. TillerHost string - // TillerConnectionTimeout is the duration (in seconds) helm will wait to establish a connection to tiller. + // TillerConnectionTimeout is the duration (in seconds) helm will wait to establish a connection to Tiller. TillerConnectionTimeout int64 // TillerNamespace is the namespace in which Tiller runs. TillerNamespace string @@ -49,6 +62,20 @@ type EnvSettings struct { Debug bool // KubeContext is the name of the kubeconfig context. KubeContext string + // KubeConfig is the path to an explicit kubeconfig file. This overwrites the value in $KUBECONFIG + KubeConfig string + // TLSEnable tells helm to communicate with Tiller via TLS + TLSEnable bool + // TLSVerify tells helm to communicate with Tiller via TLS and to verify remote certificates served by Tiller + TLSVerify bool + // TLSServerName tells helm to verify the hostname on the returned certificates from Tiller + TLSServerName string + // TLSCaCertFile is the path to a TLS CA certificate file + TLSCaCertFile string + // TLSCertFile is the path to a TLS certificate file + TLSCertFile string + // TLSKeyFile is the path to a TLS key file + TLSKeyFile string } // AddFlags binds flags to the given flagset. @@ -56,11 +83,22 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.StringVar((*string)(&s.Home), "home", DefaultHelmHome, "location of your Helm config. Overrides $HELM_HOME") fs.StringVar(&s.TillerHost, "host", "", "address of Tiller. Overrides $HELM_HOST") fs.StringVar(&s.KubeContext, "kube-context", "", "name of the kubeconfig context to use") + fs.StringVar(&s.KubeConfig, "kubeconfig", "", "absolute path to the kubeconfig file to use") fs.BoolVar(&s.Debug, "debug", false, "enable verbose output") fs.StringVar(&s.TillerNamespace, "tiller-namespace", "kube-system", "namespace of Tiller") fs.Int64Var(&s.TillerConnectionTimeout, "tiller-connection-timeout", int64(300), "the duration (in seconds) Helm will wait to establish a connection to tiller") } +// AddFlagsTLS adds the flags for supporting client side TLS to the given flagset. +func (s *EnvSettings) AddFlagsTLS(fs *pflag.FlagSet) { + fs.StringVar(&s.TLSServerName, "tls-hostname", s.TillerHost, "the server name used to verify the hostname on the returned certificates from the server") + fs.StringVar(&s.TLSCaCertFile, "tls-ca-cert", DefaultTLSCaCert, "path to TLS CA certificate file") + fs.StringVar(&s.TLSCertFile, "tls-cert", DefaultTLSCert, "path to TLS certificate file") + fs.StringVar(&s.TLSKeyFile, "tls-key", DefaultTLSKeyFile, "path to TLS key file") + fs.BoolVar(&s.TLSVerify, "tls-verify", DefaultTLSVerify, "enable TLS for request and verify remote") + fs.BoolVar(&s.TLSEnable, "tls", DefaultTLSEnable, "enable TLS for request") +} + // Init sets values from the environment. func (s *EnvSettings) Init(fs *pflag.FlagSet) { for name, envar := range envMap { @@ -68,12 +106,11 @@ func (s *EnvSettings) Init(fs *pflag.FlagSet) { } } -// PluginDirs is the path to the plugin directories. -func (s EnvSettings) PluginDirs() string { - if d, ok := os.LookupEnv("HELM_PLUGIN"); ok { - return d +// InitTLS sets TLS values from the environment. +func (s *EnvSettings) InitTLS(fs *pflag.FlagSet) { + for name, envar := range tlsEnvMap { + setFlagFromEnv(name, envar, fs) } - return s.Home.Plugins() } // envMap maps flag names to envvars @@ -84,6 +121,34 @@ var envMap = map[string]string{ "tiller-namespace": "TILLER_NAMESPACE", } +var tlsEnvMap = map[string]string{ + "tls-hostname": "HELM_TLS_HOSTNAME", + "tls-ca-cert": "HELM_TLS_CA_CERT", + "tls-cert": "HELM_TLS_CERT", + "tls-key": "HELM_TLS_KEY", + "tls-verify": "HELM_TLS_VERIFY", + "tls": "HELM_TLS_ENABLE", +} + +// PluginDirs is the path to the plugin directories. +func (s EnvSettings) PluginDirs() string { + if d, ok := os.LookupEnv("HELM_PLUGIN"); ok { + return d + } + return s.Home.Plugins() +} + +// HelmKeyPassphrase is the passphrase used to sign a helm chart. +func (s EnvSettings) HelmKeyPassphrase() string { + if d, ok := os.LookupEnv("HELM_KEY_PASSPHRASE"); ok { + return d + } + return "" +} + +// setFlagFromEnv looks up and sets a flag if the corresponding environment variable changed. +// if the flag with the corresponding name was set during fs.Parse(), then the environment +// variable is ignored. func setFlagFromEnv(name, envar string, fs *pflag.FlagSet) { if fs.Changed(name) { return diff --git a/pkg/helm/environment/environment_test.go b/pkg/helm/environment/environment_test.go index 8f0caa388..675582cf6 100644 --- a/pkg/helm/environment/environment_test.go +++ b/pkg/helm/environment/environment_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -35,49 +35,79 @@ func TestEnvSettings(t *testing.T) { envars map[string]string // expected values - home, host, ns, kcontext, plugins string - debug bool + home, host, ns, kcontext, kconfig, plugins string + debug, tlsverify bool }{ { - name: "defaults", - args: []string{}, - home: DefaultHelmHome, - plugins: helmpath.Home(DefaultHelmHome).Plugins(), - ns: "kube-system", + name: "defaults", + args: []string{}, + home: DefaultHelmHome, + plugins: helmpath.Home(DefaultHelmHome).Plugins(), + ns: "kube-system", + tlsverify: false, }, { - name: "with flags set", - args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns"}, - home: "/foo", - plugins: helmpath.Home("/foo").Plugins(), - host: "here", - ns: "myns", - debug: true, + name: "with flags set", + args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns", "--kubeconfig", "/bar"}, + home: "/foo", + plugins: helmpath.Home("/foo").Plugins(), + host: "here", + ns: "myns", + kconfig: "/bar", + debug: true, + tlsverify: false, }, { - name: "with envvars set", - args: []string{}, - envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns"}, - home: "/bar", - plugins: helmpath.Home("/bar").Plugins(), - host: "there", - ns: "yourns", - debug: true, + name: "with envvars set", + args: []string{}, + envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns"}, + home: "/bar", + plugins: helmpath.Home("/bar").Plugins(), + host: "there", + ns: "yourns", + debug: true, + tlsverify: false, }, { - name: "with flags and envvars set", - args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns"}, - envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns", "HELM_PLUGIN": "glade"}, - home: "/foo", - plugins: "glade", - host: "here", - ns: "myns", - debug: true, + name: "with TLS envvars set", + args: []string{}, + envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns", "HELM_TLS_VERIFY": "1"}, + home: "/bar", + plugins: helmpath.Home("/bar").Plugins(), + host: "there", + ns: "yourns", + debug: true, + tlsverify: true, }, + { + name: "with flags and envvars set", + args: []string{"--home", "/foo", "--host=here", "--debug", "--tiller-namespace=myns"}, + envars: map[string]string{"HELM_HOME": "/bar", "HELM_HOST": "there", "HELM_DEBUG": "1", "TILLER_NAMESPACE": "yourns", "HELM_PLUGIN": "glade"}, + home: "/foo", + plugins: "glade", + host: "here", + ns: "myns", + debug: true, + tlsverify: false, + }, + } + + allEnvvars := map[string]string{ + "HELM_DEBUG": "", + "HELM_HOME": "", + "HELM_HOST": "", + "TILLER_NAMESPACE": "", + "HELM_PLUGIN": "", + "HELM_TLS_HOSTNAME": "", + "HELM_TLS_CA_CERT": "", + "HELM_TLS_CERT": "", + "HELM_TLS_KEY": "", + "HELM_TLS_VERIFY": "", + "HELM_TLS_ENABLE": "", } - cleanup := resetEnv() - defer cleanup() + resetEnv(allEnvvars) + defer resetEnv(allEnvvars) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -89,9 +119,11 @@ func TestEnvSettings(t *testing.T) { settings := &EnvSettings{} settings.AddFlags(flags) + settings.AddFlagsTLS(flags) flags.Parse(tt.args) settings.Init(flags) + settings.InitTLS(flags) if settings.Home != helmpath.Home(tt.home) { t.Errorf("expected home %q, got %q", tt.home, settings.Home) @@ -111,17 +143,23 @@ func TestEnvSettings(t *testing.T) { if settings.KubeContext != tt.kcontext { t.Errorf("expected kube-context %q, got %q", tt.kcontext, settings.KubeContext) } + if settings.KubeConfig != tt.kconfig { + t.Errorf("expected kubeconfig %q, got %q", tt.kconfig, settings.KubeConfig) + } + if settings.TLSVerify != tt.tlsverify { + t.Errorf("expected tls-verify %t, got %t", tt.tlsverify, settings.TLSVerify) + } - cleanup() + resetEnv(tt.envars) }) } } -func resetEnv() func() { +func resetEnv(envars map[string]string) func() { origEnv := os.Environ() // ensure any local envvars do not hose us - for _, e := range envMap { + for e := range envars { os.Unsetenv(e) } diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 0a9e77c44..46be7d398 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,23 +17,29 @@ limitations under the License. package helm // import "k8s.io/helm/pkg/helm" import ( + "bytes" "errors" - "fmt" "math/rand" + "strings" "sync" "github.com/golang/protobuf/ptypes/timestamp" + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/manifest" "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" rls "k8s.io/helm/pkg/proto/hapi/services" "k8s.io/helm/pkg/proto/hapi/version" + "k8s.io/helm/pkg/renderutil" + storageerrors "k8s.io/helm/pkg/storage/errors" ) // FakeClient implements Interface type FakeClient struct { - Rels []*release.Release - Responses map[string]release.TestRun_Status - Opts options + Rels []*release.Release + Responses map[string]release.TestRun_Status + Opts options + RenderManifests bool } // Option returns the fake release client @@ -49,9 +55,28 @@ var _ Interface = (*FakeClient)(nil) // ListReleases lists the current releases func (c *FakeClient) ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error) { + reqOpts := c.Opts + for _, opt := range opts { + opt(&reqOpts) + } + req := &reqOpts.listReq + rels := c.Rels + count := int64(len(c.Rels)) + var next string + limit := req.GetLimit() + // TODO: Handle all other options. + if limit != 0 && limit < count { + rels = rels[:limit] + count = limit + next = c.Rels[limit].GetName() + } + resp := &rls.ListReleasesResponse{ - Count: int64(len(c.Rels)), - Releases: c.Rels, + Count: count, + Releases: rels, + } + if next != "" { + resp.Next = next } return resp, nil } @@ -69,6 +94,7 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts } releaseName := c.Opts.instReq.Name + releaseDescription := c.Opts.instReq.Description // Check to see if the release already exists. rel, err := c.ReleaseStatus(releaseName, nil) @@ -76,8 +102,25 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts return nil, errors.New("cannot re-use a name that is still in use") } - release := ReleaseMock(&MockReleaseOptions{Name: releaseName, Namespace: ns}) - c.Rels = append(c.Rels, release) + mockOpts := &MockReleaseOptions{ + Name: releaseName, + Chart: chart, + Config: c.Opts.instReq.Values, + Namespace: ns, + Description: releaseDescription, + } + + release := ReleaseMock(mockOpts) + + if c.RenderManifests { + if err := RenderReleaseMock(release, false); err != nil { + return nil, err + } + } + + if !c.Opts.dryRun { + c.Rels = append(c.Rels, release) + } return &rls.InstallReleaseResponse{ Release: release, @@ -95,7 +138,7 @@ func (c *FakeClient) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.U } } - return nil, fmt.Errorf("No such release: %s", rlsName) + return nil, storageerrors.ErrReleaseNotFound(rlsName) } // GetVersion returns a fake version @@ -113,14 +156,44 @@ func (c *FakeClient) UpdateRelease(rlsName string, chStr string, opts ...UpdateO } // UpdateReleaseFromChart returns an UpdateReleaseResponse containing the updated release, if it exists -func (c *FakeClient) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) { +func (c *FakeClient) UpdateReleaseFromChart(rlsName string, newChart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error) { + for _, opt := range opts { + opt(&c.Opts) + } // Check to see if the release already exists. rel, err := c.ReleaseContent(rlsName, nil) if err != nil { return nil, err } - return &rls.UpdateReleaseResponse{Release: rel.Release}, nil + mockOpts := &MockReleaseOptions{ + Name: rel.Release.Name, + Version: rel.Release.Version + 1, + Chart: newChart, + Config: c.Opts.updateReq.Values, + Namespace: rel.Release.Namespace, + Description: c.Opts.updateReq.Description, + } + + newRelease := ReleaseMock(mockOpts) + + if c.Opts.updateReq.ResetValues { + newRelease.Config = &chart.Config{Raw: "{}"} + } else if c.Opts.updateReq.ReuseValues { + // TODO: This should merge old and new values but does not. + } + + if c.RenderManifests { + if err := RenderReleaseMock(newRelease, true); err != nil { + return nil, err + } + } + + if !c.Opts.dryRun { + *rel.Release = *newRelease + } + + return &rls.UpdateReleaseResponse{Release: newRelease}, nil } // RollbackRelease returns nil, nil @@ -139,7 +212,7 @@ func (c *FakeClient) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.G }, nil } } - return nil, fmt.Errorf("No such release: %s", rlsName) + return nil, storageerrors.ErrReleaseNotFound(rlsName) } // ReleaseContent returns the configuration for the matching release name in the fake release client. @@ -151,7 +224,7 @@ func (c *FakeClient) ReleaseContent(rlsName string, opts ...ContentOption) (resp }, nil } } - return resp, fmt.Errorf("No such release: %s", rlsName) + return resp, storageerrors.ErrReleaseNotFound(rlsName) } // ReleaseHistory returns a release's revision history. @@ -206,14 +279,18 @@ metadata: // MockReleaseOptions allows for user-configurable options on mock release objects. type MockReleaseOptions struct { - Name string - Version int32 - Chart *chart.Chart - StatusCode release.Status_Code - Namespace string + Name string + Version int32 + Chart *chart.Chart + Config *chart.Config + StatusCode release.Status_Code + Namespace string + Description string } -// ReleaseMock creates a mock release object based on options set by MockReleaseOptions. This function should typically not be used outside of testing. +// ReleaseMock creates a mock release object based on options set by +// MockReleaseOptions. This function should typically not be used outside of +// testing. func ReleaseMock(opts *MockReleaseOptions) *release.Release { date := timestamp.Timestamp{Seconds: 242085845, Nanos: 0} @@ -232,6 +309,11 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { namespace = "default" } + description := opts.Description + if description == "" { + description = "Release mock" + } + ch := opts.Chart if opts.Chart == nil { ch = &chart.Chart{ @@ -245,6 +327,11 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { } } + config := opts.Config + if config == nil { + config = &chart.Config{Raw: `name: "value"`} + } + scode := release.Status_DEPLOYED if opts.StatusCode > 0 { scode = opts.StatusCode @@ -256,10 +343,10 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { FirstDeployed: &date, LastDeployed: &date, Status: &release.Status{Code: scode}, - Description: "Release mock", + Description: description, }, Chart: ch, - Config: &chart.Config{Raw: `name: "value"`}, + Config: config, Version: version, Namespace: namespace, Hooks: []*release.Hook{ @@ -275,3 +362,39 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { Manifest: MockManifest, } } + +// RenderReleaseMock will take a release (usually produced by helm.ReleaseMock) +// and will render the Manifest inside using the local mechanism (no tiller). +// (Compare to renderResources in pkg/tiller) +func RenderReleaseMock(r *release.Release, asUpgrade bool) error { + if r == nil || r.Chart == nil || r.Chart.Metadata == nil { + return errors.New("a release with a chart with metadata must be provided to render the manifests") + } + + renderOpts := renderutil.Options{ + ReleaseOptions: chartutil.ReleaseOptions{ + Name: r.Name, + Namespace: r.Namespace, + Time: r.Info.LastDeployed, + Revision: int(r.Version), + IsUpgrade: asUpgrade, + IsInstall: !asUpgrade, + }, + } + rendered, err := renderutil.Render(r.Chart, r.Config, renderOpts) + if err != nil { + return err + } + + b := bytes.NewBuffer(nil) + for _, m := range manifest.SplitManifests(rendered) { + // Remove empty manifests + if len(strings.TrimSpace(m.Content)) == 0 { + continue + } + b.WriteString("\n---\n# Source: " + m.Name + "\n") + b.WriteString(m.Content) + } + r.Manifest = b.String() + return nil +} diff --git a/pkg/helm/fake_test.go b/pkg/helm/fake_test.go index 9c0a53759..ecb0a2855 100644 --- a/pkg/helm/fake_test.go +++ b/pkg/helm/fake_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ limitations under the License. package helm import ( + "fmt" "reflect" "testing" @@ -25,6 +26,57 @@ import ( rls "k8s.io/helm/pkg/proto/hapi/services" ) +const cmInputTemplate = `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Release: +{{.Release | toYaml | indent 4}} +` +const cmOutputTemplate = ` +--- +# Source: installChart/templates/cm.yaml +kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Release: + IsInstall: %t + IsUpgrade: %t + Name: new-release + Namespace: default + Revision: %d + Service: Tiller + Time: + seconds: 242085845 + +` + +var installChart *chart.Chart + +func init() { + installChart = &chart.Chart{ + Metadata: &chart.Metadata{Name: "installChart"}, + Templates: []*chart.Template{ + {Name: "templates/cm.yaml", Data: []byte(cmInputTemplate)}, + }, + } +} + +func releaseWithChart(opts *MockReleaseOptions) *release.Release { + if opts.Chart == nil { + opts.Chart = installChart + } + return ReleaseMock(opts) +} + +func withManifest(r *release.Release, isUpgrade bool) *release.Release { + r.Manifest = fmt.Sprintf(cmOutputTemplate, !isUpgrade, isUpgrade, r.Version) + return r +} + func TestFakeClient_ReleaseStatus(t *testing.T) { releasePresent := ReleaseMock(&MockReleaseOptions{Name: "release-present"}) releaseNotPresent := ReleaseMock(&MockReleaseOptions{Name: "release-not-present"}) @@ -117,9 +169,9 @@ func TestFakeClient_ReleaseStatus(t *testing.T) { } func TestFakeClient_InstallReleaseFromChart(t *testing.T) { - installChart := &chart.Chart{} type fields struct { - Rels []*release.Release + Rels []*release.Release + RenderManifests bool } type args struct { ns string @@ -143,10 +195,27 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { opts: []InstallOption{ReleaseName("new-release")}, }, want: &rls.InstallReleaseResponse{ - Release: ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + Release: releaseWithChart(&MockReleaseOptions{Name: "new-release"}), }, relsAfter: []*release.Release{ - ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), + }, + wantErr: false, + }, + { + name: "Add release with description.", + fields: fields{ + Rels: []*release.Release{}, + }, + args: args{ + ns: "default", + opts: []InstallOption{ReleaseName("new-release"), InstallDescription("foo-bar")}, + }, + want: &rls.InstallReleaseResponse{ + Release: releaseWithChart(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), + }, + relsAfter: []*release.Release{ + releaseWithChart(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), }, wantErr: false, }, @@ -154,7 +223,7 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { name: "Try to add a release where the name already exists.", fields: fields{ Rels: []*release.Release{ - ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), }, }, args: args{ @@ -162,16 +231,35 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { opts: []InstallOption{ReleaseName("new-release")}, }, relsAfter: []*release.Release{ - ReleaseMock(&MockReleaseOptions{Name: "new-release"}), + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), }, want: nil, wantErr: true, }, + { + name: "Render the given chart.", + fields: fields{ + Rels: []*release.Release{}, + RenderManifests: true, + }, + args: args{ + ns: "default", + opts: []InstallOption{ReleaseName("new-release")}, + }, + want: &rls.InstallReleaseResponse{ + Release: withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release"}), false), + }, + relsAfter: []*release.Release{ + withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release"}), false), + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { c := &FakeClient{ - Rels: tt.fields.Rels, + Rels: tt.fields.Rels, + RenderManifests: tt.fields.RenderManifests, } got, err := c.InstallReleaseFromChart(installChart, tt.args.ns, tt.args.opts...) if (err != nil) != tt.wantErr { @@ -276,7 +364,84 @@ func TestFakeClient_DeleteRelease(t *testing.T) { } if !reflect.DeepEqual(c.Rels, tt.relsAfter) { - t.Errorf("FakeClient.InstallReleaseFromChart() rels = %v, expected %v", got, tt.relsAfter) + t.Errorf("FakeClient.InstallReleaseFromChart() rels = %v, expected %v", c.Rels, tt.relsAfter) + } + }) + } +} + +func TestFakeClient_UpdateReleaseFromChart(t *testing.T) { + type fields struct { + Rels []*release.Release + RenderManifests bool + } + type args struct { + release string + opts []UpdateOption + } + tests := []struct { + name string + fields fields + args args + want *rls.UpdateReleaseResponse + relsAfter []*release.Release + wantErr bool + }{ + { + name: "Update release.", + fields: fields{ + Rels: []*release.Release{ + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), + }, + }, + args: args{ + release: "new-release", + opts: []UpdateOption{}, + }, + want: &rls.UpdateReleaseResponse{ + Release: releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), + }, + relsAfter: []*release.Release{ + releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), + }, + }, + { + name: "Update and render given chart.", + fields: fields{ + Rels: []*release.Release{ + releaseWithChart(&MockReleaseOptions{Name: "new-release"}), + }, + RenderManifests: true, + }, + args: args{ + release: "new-release", + opts: []UpdateOption{}, + }, + want: &rls.UpdateReleaseResponse{ + Release: withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), true), + }, + relsAfter: []*release.Release{ + withManifest(releaseWithChart(&MockReleaseOptions{Name: "new-release", Version: 2}), true), + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + c := &FakeClient{ + Rels: tt.fields.Rels, + RenderManifests: tt.fields.RenderManifests, + } + got, err := c.UpdateReleaseFromChart(tt.args.release, installChart, tt.args.opts...) + if (err != nil) != tt.wantErr { + t.Errorf("FakeClient.UpdateReleaseFromChart() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("FakeClient.UpdateReleaseFromChart() =\n%v\nwant\n%v", got, tt.want) + } + if !reflect.DeepEqual(c.Rels, tt.relsAfter) { + t.Errorf("FakeClient.UpdateReleaseFromChart() rels =\n%v\nwant\n%v", c.Rels, tt.relsAfter) } }) } diff --git a/pkg/helm/helm_test.go b/pkg/helm/helm_test.go index 2b0436581..7fb794f54 100644 --- a/pkg/helm/helm_test.go +++ b/pkg/helm/helm_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,8 +18,10 @@ package helm // import "k8s.io/helm/pkg/helm" import ( "errors" + "os/exec" "path/filepath" "reflect" + "strings" "testing" "github.com/golang/protobuf/proto" @@ -361,3 +363,15 @@ func loadChart(t *testing.T, name string) *cpb.Chart { } return c } + +func TestDoesNotImportKubernetes(t *testing.T) { + cmd := exec.Command("go", "list", "-f", "{{.Deps}}", ".") + output, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("Failed to execute %s %s: %s", cmd.Path, strings.Join(cmd.Args, " "), err) + } + + if strings.Contains(string(output), "k8s.io/kubernetes") { + t.Fatal("k8s.io/helm/pkg/helm contains a dependency on k8s.io/kubernetes. See https://github.com/helm/helm/pull/4499 for more details.") + } +} diff --git a/pkg/helm/helmpath/helmhome.go b/pkg/helm/helmpath/helmhome.go index b5ec4909e..9608ea6dd 100644 --- a/pkg/helm/helmpath/helmhome.go +++ b/pkg/helm/helmpath/helmhome.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/helm/helmpath/helmhome_unix_test.go b/pkg/helm/helmpath/helmhome_unix_test.go index 494d0f6b4..ca9035554 100644 --- a/pkg/helm/helmpath/helmhome_unix_test.go +++ b/pkg/helm/helmpath/helmhome_unix_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/helm/helmpath/helmhome_windows_test.go b/pkg/helm/helmpath/helmhome_windows_test.go index e416bfd58..db1341421 100644 --- a/pkg/helm/helmpath/helmhome_windows_test.go +++ b/pkg/helm/helmpath/helmhome_windows_test.go @@ -1,4 +1,4 @@ -// Copyright 2016 The Kubernetes Authors All rights reserved. +// Copyright The Helm Authors. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/pkg/helm/interface.go b/pkg/helm/interface.go index 10c04c710..d09b6cf8f 100644 --- a/pkg/helm/interface.go +++ b/pkg/helm/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 045d45c1d..04d394254 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -264,6 +264,34 @@ func UpdateValueOverrides(raw []byte) UpdateOption { } } +// InstallDescription specifies the description for the release +func InstallDescription(description string) InstallOption { + return func(opts *options) { + opts.instReq.Description = description + } +} + +// UpgradeDescription specifies the description for the update +func UpgradeDescription(description string) UpdateOption { + return func(opts *options) { + opts.updateReq.Description = description + } +} + +// RollbackDescription specifies the description for the release +func RollbackDescription(description string) RollbackOption { + return func(opts *options) { + opts.rollbackReq.Description = description + } +} + +// DeleteDescription specifies the description for the release +func DeleteDescription(description string) DeleteOption { + return func(opts *options) { + opts.uninstallReq.Description = description + } +} + // DeleteDisableHooks will disable hooks for a deletion operation. func DeleteDisableHooks(disable bool) DeleteOption { return func(opts *options) { diff --git a/pkg/helm/portforwarder/pod.go b/pkg/helm/portforwarder/pod.go index 7c2355204..239eb2730 100644 --- a/pkg/helm/portforwarder/pod.go +++ b/pkg/helm/portforwarder/pod.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ func isPodReady(pod *v1.Pod) bool { return isPodReadyConditionTrue(pod.Status) } -// isPodReady retruns true if a pod is ready; false otherwise. +// isPodReadyConditionTrue returns true if a pod is ready; false otherwise. func isPodReadyConditionTrue(status v1.PodStatus) bool { condition := getPodReadyCondition(status) return condition != nil && condition.Status == v1.ConditionTrue diff --git a/pkg/helm/portforwarder/portforwarder.go b/pkg/helm/portforwarder/portforwarder.go index 878610d5f..e962eef7f 100644 --- a/pkg/helm/portforwarder/portforwarder.go +++ b/pkg/helm/portforwarder/portforwarder.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -54,6 +54,21 @@ func GetTillerPodName(client corev1.PodsGetter, namespace string) (string, error return pod.ObjectMeta.GetName(), nil } +// GetTillerPodImage fetches the image of tiller pod running in the given namespace. +func GetTillerPodImage(client corev1.PodsGetter, namespace string) (string, error) { + selector := tillerPodLabels.AsSelector() + pod, err := getFirstRunningPod(client, namespace, selector) + if err != nil { + return "", err + } + for _, c := range pod.Spec.Containers { + if c.Name == "tiller" { + return c.Image, nil + } + } + return "", fmt.Errorf("could not find a tiller pod") +} + func getFirstRunningPod(client corev1.PodsGetter, namespace string, selector labels.Selector) (*v1.Pod, error) { options := metav1.ListOptions{LabelSelector: selector.String()} pods, err := client.Pods(namespace).List(options) diff --git a/pkg/helm/portforwarder/portforwarder_test.go b/pkg/helm/portforwarder/portforwarder_test.go index e4c148991..f5efe3443 100644 --- a/pkg/helm/portforwarder/portforwarder_test.go +++ b/pkg/helm/portforwarder/portforwarder_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ func TestGetFirstPod(t *testing.T) { for _, tt := range tests { client := fake.NewSimpleClientset(&v1.PodList{Items: tt.pods}) - name, err := GetTillerPodName(client.Core(), v1.NamespaceDefault) + name, err := GetTillerPodName(client.CoreV1(), v1.NamespaceDefault) if (err != nil) != tt.err { t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err) } diff --git a/pkg/hooks/hooks.go b/pkg/hooks/hooks.go index 64118333d..5083672cd 100644 --- a/pkg/hooks/hooks.go +++ b/pkg/hooks/hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/ignore/doc.go b/pkg/ignore/doc.go index 7281c33a9..85cc91060 100644 --- a/pkg/ignore/doc.go +++ b/pkg/ignore/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/ignore/rules.go b/pkg/ignore/rules.go index 185d289bb..9a8e08327 100644 --- a/pkg/ignore/rules.go +++ b/pkg/ignore/rules.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/ignore/rules_test.go b/pkg/ignore/rules_test.go index 17b8bf403..a2f709097 100644 --- a/pkg/ignore/rules_test.go +++ b/pkg/ignore/rules_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 926174ef1..198f20f3c 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package kube // import "k8s.io/helm/pkg/kube" import ( "bytes" + "context" "encoding/json" goerrors "errors" "fmt" @@ -36,26 +37,24 @@ import ( apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/watch" - "k8s.io/client-go/tools/clientcmd" - batchinternal "k8s.io/kubernetes/pkg/apis/batch" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl" + "k8s.io/cli-runtime/pkg/genericclioptions" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" + "k8s.io/client-go/kubernetes/scheme" + watchtools "k8s.io/client-go/tools/watch" + "k8s.io/kubernetes/pkg/api/legacyscheme" + "k8s.io/kubernetes/pkg/kubectl/cmd/get" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - "k8s.io/kubernetes/pkg/kubectl/resource" "k8s.io/kubernetes/pkg/kubectl/validation" - "k8s.io/kubernetes/pkg/printers" ) -const ( - // MissingGetHeader is added to Get's output when a resource is not found. - MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n" -) +// MissingGetHeader is added to Get's output when a resource is not found. +const MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n" // ErrNoObjectsVisited indicates that during a visit operation, no matching objects were found. var ErrNoObjectsVisited = goerrors.New("no objects visited") @@ -63,18 +62,17 @@ var ErrNoObjectsVisited = goerrors.New("no objects visited") // Client represents a client capable of communicating with the Kubernetes API. type Client struct { cmdutil.Factory - // SchemaCacheDir is the path for loading cached schema. - SchemaCacheDir string - Log func(string, ...interface{}) } // New creates a new Client. -func New(config clientcmd.ClientConfig) *Client { +func New(getter genericclioptions.RESTClientGetter) *Client { + if getter == nil { + getter = genericclioptions.NewConfigFlags() + } return &Client{ - Factory: cmdutil.NewFactory(config), - SchemaCacheDir: clientcmd.RecommendedSchemaFile, - Log: nopLogger, + Factory: cmdutil.NewFactory(getter), + Log: nopLogger, } } @@ -87,7 +85,7 @@ type ResourceActorFunc func(*resource.Info) error // // Namespace will set the namespace. func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shouldWait bool) error { - client, err := c.ClientSet() + client, err := c.KubernetesClientSet() if err != nil { return err } @@ -111,8 +109,8 @@ func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shoul func (c *Client) newBuilder(namespace string, reader io.Reader) *resource.Result { return c.NewBuilder(). - Internal(). ContinueOnError(). + WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...). Schema(c.validator()). NamespaceParam(namespace). DefaultNamespace(). @@ -164,7 +162,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { return "", err } - var objPods = make(map[string][]core.Pod) + var objPods = make(map[string][]v1.Pod) missing := []string{} err = perform(infos, func(info *resource.Info) error { @@ -179,7 +177,15 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // versions per cluster, but this certainly won't hurt anything, so let's be safe. gvk := info.ResourceMapping().GroupVersionKind vk := gvk.Version + "/" + gvk.Kind - objs[vk] = append(objs[vk], info.AsInternal()) + internalObj, err := asInternal(info) + if err != nil { + c.Log("Warning: conversion to internal type failed: %v", err) + // Add the unstructured object in this situation. It will still get listed, just + // with less information. + objs[vk] = append(objs[vk], info.Object) + } else { + objs[vk] = append(objs[vk], internalObj) + } //Get the relation pods objPods, err = c.getSelectRelationPod(info, objPods) @@ -205,10 +211,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) { // an object type changes, so we can just rely on that. Problem is it doesn't seem to keep // track of tab widths. buf := new(bytes.Buffer) - p, err := cmdutil.PrinterForOptions(&printers.PrintOptions{}) - if err != nil { - return "", err - } + p, _ := get.NewHumanPrintFlags().ToPrinter("") for t, ot := range objs { if _, err = buf.WriteString("==> " + t + "\n"); err != nil { return "", err @@ -297,7 +300,7 @@ func (c *Client) Update(namespace string, originalReader, targetReader io.Reader for _, info := range original.Difference(target) { c.Log("Deleting %q in %s...", info.Name, info.Namespace) - if err := deleteResource(c, info); err != nil { + if err := deleteResource(info); err != nil { c.Log("Failed to delete %q, err: %s", info.Name, err) } } @@ -317,7 +320,7 @@ func (c *Client) Delete(namespace string, reader io.Reader) error { } return perform(infos, func(info *resource.Info) error { c.Log("Starting delete for %q %s", info.Name, info.Mapping.GroupVersionKind.Kind) - err := deleteResource(c, info) + err := deleteResource(info) return c.skipIfNotFound(err) }) } @@ -372,24 +375,18 @@ func perform(infos Result, fn ResourceActorFunc) error { } func createResource(info *resource.Info) error { - obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object) + obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object, nil) if err != nil { return err } return info.Refresh(obj, true) } -func deleteResource(c *Client, info *resource.Info) error { - reaper, err := c.Reaper(info.Mapping) - if err != nil { - // If there is no reaper for this resources, delete it. - if kubectl.IsNoSuchReaperError(err) { - return resource.NewHelper(info.Client, info.Mapping).Delete(info.Namespace, info.Name) - } - return err - } - c.Log("Using reaper for deleting %q", info.Name) - return reaper.Stop(info.Namespace, info.Name, 0, nil) +func deleteResource(info *resource.Info) error { + policy := metav1.DeletePropagationBackground + opts := &metav1.DeleteOptions{PropagationPolicy: &policy} + _, err := resource.NewHelper(info.Client, info.Mapping).DeleteWithOptions(info.Namespace, info.Name, opts) + return err } func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.PatchType, error) { @@ -411,7 +408,7 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P } // Get a versioned object - versionedObject, err := target.Versioned() + versionedObject := asVersioned(target) // Unstructured objects, such as CRDs, may not have an not registered error // returned from ConvertToVersion. Anything that's unstructured should @@ -448,14 +445,14 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, // send patch to server helper := resource.NewHelper(target.Client, target.Mapping) - obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch) + obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch, nil) if err != nil { kind := target.Mapping.GroupVersionKind.Kind log.Printf("Cannot patch %s: %q (%v)", kind, target.Name, err) if force { // Attempt to delete... - if err := deleteResource(c, target); err != nil { + if err := deleteResource(target); err != nil { return err } log.Printf("Deleted %s: %q", kind, target.Name) @@ -483,19 +480,18 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, return nil } - versioned := target.AsVersioned() + versioned := asVersioned(target) selector, ok := getSelectorFromObject(versioned) if !ok { return nil } - client, err := c.ClientSet() + client, err := c.KubernetesClientSet() if err != nil { return err } - pods, err := client.Core().Pods(target.Namespace).List(metav1.ListOptions{ - FieldSelector: fields.Everything().String(), + pods, err := client.CoreV1().Pods(target.Namespace).List(metav1.ListOptions{ LabelSelector: labels.Set(selector).AsSelector().String(), }) if err != nil { @@ -507,7 +503,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, c.Log("Restarting pod: %v/%v", pod.Namespace, pod.Name) // Delete each pod for get them restarted with changed spec. - if err := client.Core().Pods(pod.Namespace).Delete(pod.Name, metav1.NewPreconditionDeleteOptions(string(pod.UID))); err != nil { + if err := client.CoreV1().Pods(pod.Namespace).Delete(pod.Name, metav1.NewPreconditionDeleteOptions(string(pod.UID))); err != nil { return err } } @@ -571,7 +567,9 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err // In the future, we might want to add some special logic for types // like Ingress, Volume, etc. - _, err = watch.Until(timeout, w, func(e watch.Event) (bool, error) { + ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout) + defer cancel() + _, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) { switch e.Type { case watch.Added, watch.Modified: // For things like a secret or a config map, this is the best indicator @@ -601,15 +599,15 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err // // This operates on an event returned from a watcher. func (c *Client) waitForJob(e watch.Event, name string) (bool, error) { - o, ok := e.Object.(*batchinternal.Job) + o, ok := e.Object.(*batch.Job) if !ok { return true, fmt.Errorf("Expected %s to be a *batch.Job, got %T", name, e.Object) } for _, c := range o.Status.Conditions { - if c.Type == batchinternal.JobComplete && c.Status == core.ConditionTrue { + if c.Type == batch.JobComplete && c.Status == v1.ConditionTrue { return true, nil - } else if c.Type == batchinternal.JobFailed && c.Status == core.ConditionTrue { + } else if c.Type == batch.JobFailed && c.Status == v1.ConditionTrue { return true, fmt.Errorf("Job failed: %s", c.Reason) } } @@ -633,26 +631,26 @@ func scrubValidationError(err error) error { // WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase // and returns said phase (PodSucceeded or PodFailed qualify). -func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { +func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { infos, err := c.Build(namespace, reader) if err != nil { - return core.PodUnknown, err + return v1.PodUnknown, err } info := infos[0] kind := info.Mapping.GroupVersionKind.Kind if kind != "Pod" { - return core.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name) + return v1.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name) } if err := c.watchPodUntilComplete(timeout, info); err != nil { - return core.PodUnknown, err + return v1.PodUnknown, err } if err := info.Get(); err != nil { - return core.PodUnknown, err + return v1.PodUnknown, err } - status := info.Object.(*core.Pod).Status.Phase + status := info.Object.(*v1.Pod).Status.Phase return status, nil } @@ -664,7 +662,9 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf } c.Log("Watching pod %s for completion with timeout of %v", info.Name, timeout) - _, err = watch.Until(timeout, w, func(e watch.Event) (bool, error) { + ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout) + defer cancel() + _, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) { return isPodComplete(e) }) @@ -672,15 +672,15 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf } func isPodComplete(event watch.Event) (bool, error) { - o, ok := event.Object.(*core.Pod) + o, ok := event.Object.(*v1.Pod) if !ok { - return true, fmt.Errorf("expected a *core.Pod, got %T", event.Object) + return true, fmt.Errorf("expected a *v1.Pod, got %T", event.Object) } if event.Type == watch.Deleted { return false, fmt.Errorf("pod not found") } switch o.Status.Phase { - case core.PodFailed, core.PodSucceeded: + case v1.PodFailed, v1.PodSucceeded: return true, nil } return false, nil @@ -688,30 +688,22 @@ func isPodComplete(event watch.Event) (bool, error) { //get a kubernetes resources' relation pods // kubernetes resource used select labels to relate pods -func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) { +func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]v1.Pod) (map[string][]v1.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 := info.Versioned() - switch { - case runtime.IsNotRegisteredError(err): - return objPods, nil - case err != nil: - return objPods, err - } - + versioned := asVersioned(info) selector, ok := getSelectorFromObject(versioned) if !ok { return objPods, nil } - client, _ := c.ClientSet() + client, _ := c.KubernetesClientSet() - pods, err := client.Core().Pods(info.Namespace).List(metav1.ListOptions{ - FieldSelector: fields.Everything().String(), + pods, err := client.CoreV1().Pods(info.Namespace).List(metav1.ListOptions{ LabelSelector: labels.Set(selector).AsSelector().String(), }) if err != nil { @@ -719,15 +711,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] } for _, pod := range pods.Items { - if pod.APIVersion == "" { - pod.APIVersion = "v1" - } - - if pod.Kind == "" { - pod.Kind = "Pod" - } - vk := pod.GroupVersionKind().Version + "/" + pod.GroupVersionKind().Kind - + vk := "v1/Pod" if !isFoundPod(objPods[vk], pod) { objPods[vk] = append(objPods[vk], pod) } @@ -735,7 +719,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][] return objPods, nil } -func isFoundPod(podItem []core.Pod, pod core.Pod) bool { +func isFoundPod(podItem []v1.Pod, pod v1.Pod) bool { for _, value := range podItem { if (value.Namespace == pod.Namespace) && (value.Name == pod.Name) { return true @@ -743,3 +727,21 @@ func isFoundPod(podItem []core.Pod, pod core.Pod) bool { } return false } + +func asVersioned(info *resource.Info) runtime.Object { + converter := runtime.ObjectConvertor(scheme.Scheme) + groupVersioner := runtime.GroupVersioner(schema.GroupVersions(scheme.Scheme.PrioritizedVersionsAllGroups())) + if info.Mapping != nil { + groupVersioner = info.Mapping.GroupVersionKind.GroupVersion() + } + + if obj, err := converter.ConvertToVersion(info.Object, groupVersioner); err == nil { + return obj + } + return info.Object +} + +func asInternal(info *resource.Info) (runtime.Object, error) { + groupVersioner := info.Mapping.GroupVersionKind.GroupKind().WithVersion(runtime.APIVersionInternal).GroupVersion() + return legacyscheme.Scheme.ConvertToVersion(info.Object, groupVersioner) +} diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index 47049810a..de33881c8 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,58 +23,54 @@ import ( "net/http" "strings" "testing" - "time" - "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/client-go/dynamic" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" + "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest/fake" - "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl" cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing" - cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" - "k8s.io/kubernetes/pkg/kubectl/resource" - "k8s.io/kubernetes/pkg/kubectl/scheme" ) -var unstructuredSerializer = dynamic.ContentConfig().NegotiatedSerializer +var ( + codec = scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) + unstructuredSerializer = resource.UnstructuredPlusDefaultContentConfig().NegotiatedSerializer +) -func objBody(codec runtime.Codec, obj runtime.Object) io.ReadCloser { +func objBody(obj runtime.Object) io.ReadCloser { return ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj)))) } -func newPod(name string) core.Pod { - return newPodWithStatus(name, core.PodStatus{}, "") +func newPod(name string) v1.Pod { + return newPodWithStatus(name, v1.PodStatus{}, "") } -func newPodWithStatus(name string, status core.PodStatus, namespace string) core.Pod { - ns := core.NamespaceDefault +func newPodWithStatus(name string, status v1.PodStatus, namespace string) v1.Pod { + ns := v1.NamespaceDefault if namespace != "" { ns = namespace } - return core.Pod{ + return v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: ns, SelfLink: "/api/v1/namespaces/default/pods/" + name, }, - Spec: core.PodSpec{ - Containers: []core.Container{{ + Spec: v1.PodSpec{ + Containers: []v1.Container{{ Name: "app:v4", Image: "abc/app:v4", - Ports: []core.ContainerPort{{Name: "http", ContainerPort: 80}}, + Ports: []v1.ContainerPort{{Name: "http", ContainerPort: 80}}, }}, }, Status: status, } } -func newPodList(names ...string) core.PodList { - var list core.PodList +func newPodList(names ...string) v1.PodList { + var list v1.PodList for _, name := range names { list.Items = append(list.Items, newPod(name)) } @@ -94,28 +90,10 @@ func notFoundBody() *metav1.Status { func newResponse(code int, obj runtime.Object) (*http.Response, error) { header := http.Header{} header.Set("Content-Type", runtime.ContentTypeJSON) - body := ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), obj)))) + body := ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj)))) return &http.Response{StatusCode: code, Header: header, Body: body}, nil } -type fakeReaper struct { - name string -} - -func (r *fakeReaper) Stop(namespace, name string, timeout time.Duration, gracePeriod *metav1.DeleteOptions) error { - r.name = name - return nil -} - -type fakeReaperFactory struct { - cmdutil.Factory - reaper kubectl.Reaper -} - -func (f *fakeReaperFactory) Reaper(mapping *meta.RESTMapping) (kubectl.Reaper, error) { - return f.reaper, nil -} - type testClient struct { *Client *cmdtesting.TestFactory @@ -137,15 +115,15 @@ func TestUpdate(t *testing.T) { listA := newPodList("starfish", "otter", "squid") listB := newPodList("starfish", "otter", "dolphin") listC := newPodList("starfish", "otter", "dolphin") - listB.Items[0].Spec.Containers[0].Ports = []core.ContainerPort{{Name: "https", ContainerPort: 443}} - listC.Items[0].Spec.Containers[0].Ports = []core.ContainerPort{{Name: "https", ContainerPort: 443}} + listB.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}} + listC.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}} var actions []string tf := cmdtesting.NewTestFactory() defer tf.Cleanup() + tf.UnstructuredClient = &fake.RESTClient{ - GroupVersion: schema.GroupVersion{Version: "v1"}, NegotiatedSerializer: unstructuredSerializer, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { p, m := req.URL.Path, req.Method @@ -180,22 +158,22 @@ func TestUpdate(t *testing.T) { }), } - c := newTestClient() - reaper := &fakeReaper{} - rf := &fakeReaperFactory{Factory: tf, reaper: reaper} - c.Client.Factory = rf - codec := legacyscheme.Codecs.LegacyCodec(scheme.Versions...) - if err := c.Update(core.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil { + c := &Client{ + Factory: tf, + Log: nopLogger, + } + + if err := c.Update(v1.NamespaceDefault, objBody(&listA), objBody(&listB), false, false, 0, false); err != nil { t.Fatal(err) } // TODO: Find a way to test methods that use Client Set // Test with a wait - // if err := c.Update("test", objBody(codec, &listB), objBody(codec, &listC), false, 300, true); err != nil { + // if err := c.Update("test", objBody(&listB), objBody(&listC), false, 300, true); err != nil { // t.Fatal(err) // } // Test with a wait should fail // TODO: A way to make this not based off of an extremely short timeout? - // if err := c.Update("test", objBody(codec, &listC), objBody(codec, &listA), false, 2, true); err != nil { + // if err := c.Update("test", objBody(&listC), objBody(&listA), false, 2, true); err != nil { // t.Fatal(err) // } expectedActions := []string{ @@ -205,6 +183,7 @@ func TestUpdate(t *testing.T) { "/namespaces/default/pods/otter:GET", "/namespaces/default/pods/dolphin:GET", "/namespaces/default/pods:POST", + "/namespaces/default/pods/squid:DELETE", } if len(expectedActions) != len(actions) { t.Errorf("unexpected number of requests, expected %d, got %d", len(expectedActions), len(actions)) @@ -215,11 +194,6 @@ func TestUpdate(t *testing.T) { t.Errorf("expected %s request got %s", v, actions[k]) } } - - if reaper.name != "squid" { - t.Errorf("unexpected reaper: %#v", reaper) - } - } func TestBuild(t *testing.T) { diff --git a/pkg/kube/config.go b/pkg/kube/config.go index b6560486e..7504d9028 100644 --- a/pkg/kube/config.go +++ b/pkg/kube/config.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,10 +16,12 @@ limitations under the License. package kube // import "k8s.io/helm/pkg/kube" -import "k8s.io/client-go/tools/clientcmd" +import ( + "k8s.io/client-go/tools/clientcmd" +) // GetConfig returns a Kubernetes client config for a given context. -func GetConfig(context string) clientcmd.ClientConfig { +func GetConfig(context string, kubeconfig string) clientcmd.ClientConfig { rules := clientcmd.NewDefaultClientConfigLoadingRules() rules.DefaultClientConfig = &clientcmd.DefaultClientConfig @@ -28,5 +30,10 @@ func GetConfig(context string) clientcmd.ClientConfig { if context != "" { overrides.CurrentContext = context } + + if kubeconfig != "" { + rules.ExplicitPath = kubeconfig + } + return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides) } diff --git a/pkg/kube/log.go b/pkg/kube/log.go index fbe51823a..fc3683b1d 100644 --- a/pkg/kube/log.go +++ b/pkg/kube/log.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/namespace.go b/pkg/kube/namespace.go index 9d2793d87..064de3d17 100644 --- a/pkg/kube/namespace.go +++ b/pkg/kube/namespace.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,30 +17,42 @@ limitations under the License. package kube // import "k8s.io/helm/pkg/kube" import ( + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" ) -func createNamespace(client internalclientset.Interface, namespace string) error { - ns := &core.Namespace{ +func createNamespace(client kubernetes.Interface, namespace string) error { + ns := &v1.Namespace{ ObjectMeta: metav1.ObjectMeta{ Name: namespace, + Labels: map[string]string{ + "name": namespace, + }, }, } - _, err := client.Core().Namespaces().Create(ns) + _, err := client.CoreV1().Namespaces().Create(ns) return err } -func getNamespace(client internalclientset.Interface, namespace string) (*core.Namespace, error) { - return client.Core().Namespaces().Get(namespace, metav1.GetOptions{}) +func getNamespace(client kubernetes.Interface, namespace string) (*v1.Namespace, error) { + return client.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{}) } -func ensureNamespace(client internalclientset.Interface, namespace string) error { +func ensureNamespace(client kubernetes.Interface, namespace string) error { _, err := getNamespace(client, namespace) if err != nil && errors.IsNotFound(err) { - return createNamespace(client, namespace) + err = createNamespace(client, namespace) + + // If multiple commands which run `ensureNamespace` are run in + // parallel, then protect against the race condition in which + // the namespace did not exist when `getNamespace` was executed, + // but did exist when `createNamespace` was executed. If that + // happens, we can just proceed as normal. + if errors.IsAlreadyExists(err) { + return nil + } } return err } diff --git a/pkg/kube/namespace_test.go b/pkg/kube/namespace_test.go index eb96557d0..3b6141434 100644 --- a/pkg/kube/namespace_test.go +++ b/pkg/kube/namespace_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import ( "testing" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" + "k8s.io/client-go/kubernetes/fake" ) func TestEnsureNamespace(t *testing.T) { @@ -31,7 +31,7 @@ func TestEnsureNamespace(t *testing.T) { if err := ensureNamespace(client, "foo"); err != nil { t.Fatalf("unexpected error: %s", err) } - if _, err := client.Core().Namespaces().Get("foo", metav1.GetOptions{}); err != nil { + if _, err := client.CoreV1().Namespaces().Get("foo", metav1.GetOptions{}); err != nil { t.Fatalf("unexpected error: %s", err) } } diff --git a/pkg/kube/result.go b/pkg/kube/result.go index 87c7e6ac1..cc222a66f 100644 --- a/pkg/kube/result.go +++ b/pkg/kube/result.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ limitations under the License. package kube // import "k8s.io/helm/pkg/kube" -import "k8s.io/kubernetes/pkg/kubectl/resource" +import "k8s.io/cli-runtime/pkg/genericclioptions/resource" // Result provides convenience methods for comparing collections of Infos. type Result []*resource.Info diff --git a/pkg/kube/result_test.go b/pkg/kube/result_test.go index 962e90426..c4cf989b8 100644 --- a/pkg/kube/result_test.go +++ b/pkg/kube/result_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,15 +19,14 @@ package kube // import "k8s.io/helm/pkg/kube" import ( "testing" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/kubernetes/pkg/api/testapi" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" ) func TestResult(t *testing.T) { - mapping, err := testapi.Default.RESTMapper().RESTMapping(schema.GroupKind{Kind: "Pod"}) - if err != nil { - t.Fatal(err) + mapping := &meta.RESTMapping{ + Resource: schema.GroupVersionResource{Group: "group", Version: "version", Resource: "pod"}, } info := func(name string) *resource.Info { diff --git a/pkg/kube/tunnel.go b/pkg/kube/tunnel.go index 08280f25d..f4eaa7e26 100644 --- a/pkg/kube/tunnel.go +++ b/pkg/kube/tunnel.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/tunnel_test.go b/pkg/kube/tunnel_test.go index 264200ddf..37fb296a3 100644 --- a/pkg/kube/tunnel_test.go +++ b/pkg/kube/tunnel_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/kube/wait.go b/pkg/kube/wait.go index 88f3c7d34..960409df9 100644 --- a/pkg/kube/wait.go +++ b/pkg/kube/wait.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" podutil "k8s.io/kubernetes/pkg/api/v1/pod" @@ -37,8 +36,8 @@ import ( // deployment holds associated replicaSets for a deployment type deployment struct { - replicaSets *extensions.ReplicaSet - deployment *extensions.Deployment + replicaSets *appsv1.ReplicaSet + deployment *appsv1.Deployment } // waitForResources polls to get the current status of all pods, PVCs, and Services @@ -56,11 +55,7 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { pvc := []v1.PersistentVolumeClaim{} deployments := []deployment{} for _, v := range created { - obj, err := v.Versioned() - if err != nil && !runtime.IsNotRegisteredError(err) { - return false, err - } - switch value := obj.(type) { + switch value := asVersioned(v).(type) { case *v1.ReplicationController: list, err := getPods(kcs, value.Namespace, value.Spec.Selector) if err != nil { @@ -74,12 +69,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } pods = append(pods, *pod) case *appsv1.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } @@ -89,12 +84,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } deployments = append(deployments, newDeployment) case *appsv1beta1.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } @@ -104,12 +99,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } deployments = append(deployments, newDeployment) case *appsv1beta2.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } @@ -119,12 +114,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { } deployments = append(deployments, newDeployment) case *extensions.Deployment: - currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) + currentDeployment, err := kcs.AppsV1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) if err != nil { return false, err } // Find RS associated with deployment - newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1()) + newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.AppsV1()) if err != nil || newReplicaSet == nil { return false, err } diff --git a/pkg/lint/lint.go b/pkg/lint/lint.go index 256eab906..aa8df5814 100644 --- a/pkg/lint/lint.go +++ b/pkg/lint/lint.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/lint_test.go b/pkg/lint/lint_test.go index d84faa10b..84dfbf508 100644 --- a/pkg/lint/lint_test.go +++ b/pkg/lint/lint_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/chartfile.go b/pkg/lint/rules/chartfile.go index 0dab0d250..12f028af1 100644 --- a/pkg/lint/rules/chartfile.go +++ b/pkg/lint/rules/chartfile.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/chartfile_test.go b/pkg/lint/rules/chartfile_test.go index 99dc4de0f..235e5fc4c 100644 --- a/pkg/lint/rules/chartfile_test.go +++ b/pkg/lint/rules/chartfile_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index a8b6a6757..192150737 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ func Templates(linter *support.Linter, values []byte, namespace string, strict b return } e := engine.New() + e.LintMode = true if strict { e.Strict = true } diff --git a/pkg/lint/rules/template_test.go b/pkg/lint/rules/template_test.go index cb1be94a2..41a7384e7 100644 --- a/pkg/lint/rules/template_test.go +++ b/pkg/lint/rules/template_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/rules/testdata/albatross/templates/svc.yaml b/pkg/lint/rules/testdata/albatross/templates/svc.yaml index 167148112..aea11d833 100644 --- a/pkg/lint/rules/testdata/albatross/templates/svc.yaml +++ b/pkg/lint/rules/testdata/albatross/templates/svc.yaml @@ -5,9 +5,9 @@ kind: Service metadata: name: "{{ .Values.name }}" labels: - heritage: {{ .Release.Service | quote }} - release: {{ .Release.Name | quote }} - chart: "{{.Chart.Name}}-{{.Chart.Version}}" + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" kubeVersion: {{ .Capabilities.KubeVersion.Major }} tillerVersion: {{ .Capabilities.TillerVersion }} spec: diff --git a/pkg/lint/rules/values.go b/pkg/lint/rules/values.go index 9b97598f0..4781cc176 100644 --- a/pkg/lint/rules/values.go +++ b/pkg/lint/rules/values.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/support/doc.go b/pkg/lint/support/doc.go index 4cf7272e4..ede608906 100644 --- a/pkg/lint/support/doc.go +++ b/pkg/lint/support/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/lint/support/message.go b/pkg/lint/support/message.go index 6a878031a..5efbc7a61 100644 --- a/pkg/lint/support/message.go +++ b/pkg/lint/support/message.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package support import "fmt" -// Severity indicatest the severity of a Message. +// Severity indicates the severity of a Message. const ( // UnknownSev indicates that the severity of the error is unknown, and should not stop processing. UnknownSev = iota diff --git a/pkg/lint/support/message_test.go b/pkg/lint/support/message_test.go index 4a9c33c34..55675eeee 100644 --- a/pkg/lint/support/message_test.go +++ b/pkg/lint/support/message_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/manifest/doc.go b/pkg/manifest/doc.go new file mode 100644 index 000000000..c2f127cda --- /dev/null +++ b/pkg/manifest/doc.go @@ -0,0 +1,23 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/*Package manifest contains tools for working with kubernetes manifests. + +Much like other parts of helm, it does not generally require that the manifests +be correct yaml, so these functions can be run on broken manifests to aid in +user debugging +*/ +package manifest // import "k8s.io/helm/pkg/manifest" diff --git a/pkg/manifest/splitter.go b/pkg/manifest/splitter.go new file mode 100644 index 000000000..7081e7aa7 --- /dev/null +++ b/pkg/manifest/splitter.go @@ -0,0 +1,46 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package manifest + +import ( + "regexp" + "strings" + + "k8s.io/helm/pkg/releaseutil" +) + +var ( + kindRegex = regexp.MustCompile("kind:(.*)\n") +) + +// SplitManifests takes a map of rendered templates and splits them into the +// detected manifests. +func SplitManifests(templates map[string]string) []Manifest { + var listManifests []Manifest + // extract kind and name + for k, v := range templates { + match := kindRegex.FindStringSubmatch(v) + h := "Unknown" + if len(match) == 2 { + h = strings.TrimSpace(match[1]) + } + m := Manifest{Name: k, Content: v, Head: &releaseutil.SimpleHead{Kind: h}} + listManifests = append(listManifests, m) + } + + return listManifests +} diff --git a/pkg/manifest/types.go b/pkg/manifest/types.go new file mode 100644 index 000000000..4c748c9e5 --- /dev/null +++ b/pkg/manifest/types.go @@ -0,0 +1,28 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package manifest + +import ( + "k8s.io/helm/pkg/releaseutil" +) + +// Manifest represents a manifest file, which has a name and some content. +type Manifest struct { + Name string + Content string + Head *releaseutil.SimpleHead +} diff --git a/pkg/plugin/cache/cache.go b/pkg/plugin/cache/cache.go index a1d3224c8..d846126f1 100644 --- a/pkg/plugin/cache/cache.go +++ b/pkg/plugin/cache/cache.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/hooks.go b/pkg/plugin/hooks.go index b5ca032ac..70ce5d122 100644 --- a/pkg/plugin/hooks.go +++ b/pkg/plugin/hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/base.go b/pkg/plugin/installer/base.go index 0664dae76..15ce3cbcf 100644 --- a/pkg/plugin/installer/base.go +++ b/pkg/plugin/installer/base.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/doc.go b/pkg/plugin/installer/doc.go index a2a66f3e1..0089e33f8 100644 --- a/pkg/plugin/installer/doc.go +++ b/pkg/plugin/installer/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/http_installer.go b/pkg/plugin/installer/http_installer.go index b5c205de6..fd58b88ca 100644 --- a/pkg/plugin/installer/http_installer.go +++ b/pkg/plugin/installer/http_installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/http_installer_test.go b/pkg/plugin/installer/http_installer_test.go index bab5f7a92..73af75e8c 100644 --- a/pkg/plugin/installer/http_installer_test.go +++ b/pkg/plugin/installer/http_installer_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/installer.go b/pkg/plugin/installer/installer.go index 02aee9f46..76c751d50 100644 --- a/pkg/plugin/installer/installer.go +++ b/pkg/plugin/installer/installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/local_installer.go b/pkg/plugin/installer/local_installer.go index 3cf6bb422..f39086a6e 100644 --- a/pkg/plugin/installer/local_installer.go +++ b/pkg/plugin/installer/local_installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/local_installer_test.go b/pkg/plugin/installer/local_installer_test.go index 6a7c957d6..fb5fa2675 100644 --- a/pkg/plugin/installer/local_installer_test.go +++ b/pkg/plugin/installer/local_installer_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/vcs_installer.go b/pkg/plugin/installer/vcs_installer.go index 0a373a971..4b502dae4 100644 --- a/pkg/plugin/installer/vcs_installer.go +++ b/pkg/plugin/installer/vcs_installer.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/installer/vcs_installer_test.go b/pkg/plugin/installer/vcs_installer_test.go index d6eb32c1b..548a7a49a 100644 --- a/pkg/plugin/installer/vcs_installer_test.go +++ b/pkg/plugin/installer/vcs_installer_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index b3458c2d8..07fcc700a 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/plugin/plugin_test.go b/pkg/plugin/plugin_test.go index 5ddbf15f3..338d949f8 100644 --- a/pkg/plugin/plugin_test.go +++ b/pkg/plugin/plugin_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 43c8ddcce..813f15c33 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -66,17 +66,20 @@ const ( ListSort_UNKNOWN ListSort_SortBy = 0 ListSort_NAME ListSort_SortBy = 1 ListSort_LAST_RELEASED ListSort_SortBy = 2 + ListSort_CHART_NAME ListSort_SortBy = 3 ) var ListSort_SortBy_name = map[int32]string{ 0: "UNKNOWN", 1: "NAME", 2: "LAST_RELEASED", + 3: "CHART_NAME", } var ListSort_SortBy_value = map[string]int32{ "UNKNOWN": 0, "NAME": 1, "LAST_RELEASED": 2, + "CHART_NAME": 3, } func (x ListSort_SortBy) String() string { @@ -110,7 +113,7 @@ func (ListSort_SortOrder) EnumDescriptor() ([]byte, []int) { return fileDescript // // Releases can be retrieved in chunks by setting limit and offset. // -// Releases can be sorted according to a few pre-determined sort stategies. +// Releases can be sorted according to a few pre-determined sort strategies. type ListReleasesRequest struct { // Limit is the maximum number of releases to be returned. Limit int64 `protobuf:"varint,1,opt,name=limit" json:"limit,omitempty"` @@ -376,8 +379,10 @@ type UpdateReleaseRequest struct { ReuseValues bool `protobuf:"varint,10,opt,name=reuse_values,json=reuseValues" json:"reuse_values,omitempty"` // Force resource update through delete/recreate if needed. Force bool `protobuf:"varint,11,opt,name=force" json:"force,omitempty"` + // Description, if set, will set the description for the updated release + Description string `protobuf:"bytes,12,opt,name=description" json:"description,omitempty"` // Render subchart notes if enabled - SubNotes bool `protobuf:"varint,12,opt,name=subNotes" json:"subNotes,omitempty"` + SubNotes bool `protobuf:"varint,13,opt,name=subNotes" json:"subNotes,omitempty"` } func (m *UpdateReleaseRequest) Reset() { *m = UpdateReleaseRequest{} } @@ -469,6 +474,13 @@ func (m *UpdateReleaseRequest) GetSubNotes() bool { return false } +func (m *UpdateReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // UpdateReleaseResponse is the response to an update request. type UpdateReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -504,6 +516,8 @@ type RollbackReleaseRequest struct { Wait bool `protobuf:"varint,7,opt,name=wait" json:"wait,omitempty"` // Force resource update through delete/recreate if needed. Force bool `protobuf:"varint,8,opt,name=force" json:"force,omitempty"` + // Description, if set, will set the description for the rollback + Description string `protobuf:"bytes,9,opt,name=description" json:"description,omitempty"` } func (m *RollbackReleaseRequest) Reset() { *m = RollbackReleaseRequest{} } @@ -567,6 +581,13 @@ func (m *RollbackReleaseRequest) GetForce() bool { return false } +func (m *RollbackReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // RollbackReleaseResponse is the response to an update request. type RollbackReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -600,9 +621,9 @@ type InstallReleaseRequest struct { Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"` // DisableHooks causes the server to skip running any hooks for the install. DisableHooks bool `protobuf:"varint,5,opt,name=disable_hooks,json=disableHooks" json:"disable_hooks,omitempty"` - // Namepace is the kubernetes namespace of the release. + // Namespace is the kubernetes namespace of the release. Namespace string `protobuf:"bytes,6,opt,name=namespace" json:"namespace,omitempty"` - // ReuseName requests that Tiller re-uses a name, instead of erroring out. + // Reuse_name requests that Tiller re-uses a name, instead of erroring out. ReuseName bool `protobuf:"varint,7,opt,name=reuse_name,json=reuseName" json:"reuse_name,omitempty"` // timeout specifies the max amount of time any kubernetes client command can run. Timeout int64 `protobuf:"varint,8,opt,name=timeout" json:"timeout,omitempty"` @@ -610,7 +631,9 @@ type InstallReleaseRequest struct { // before marking the release as successful. It will wait for as long as timeout Wait bool `protobuf:"varint,9,opt,name=wait" json:"wait,omitempty"` DisableCrdHook bool `protobuf:"varint,10,opt,name=disable_crd_hook,json=disableCrdHook" json:"disable_crd_hook,omitempty"` - SubNotes bool `protobuf:"varint,11,opt,name=subNotes" json:"subNotes,omitempty"` + // Description, if set, will set the description for the installed release + Description string `protobuf:"bytes,11,opt,name=description" json:"description,omitempty"` + SubNotes bool `protobuf:"varint,12,opt,name=subNotes" json:"subNotes,omitempty"` } func (m *InstallReleaseRequest) Reset() { *m = InstallReleaseRequest{} } @@ -688,6 +711,7 @@ func (m *InstallReleaseRequest) GetDisableCrdHook() bool { return false } + func (m *InstallReleaseRequest) GetSubNotes() bool { if m != nil { return m.SubNotes @@ -695,6 +719,13 @@ func (m *InstallReleaseRequest) GetSubNotes() bool { return false } +func (m *InstallReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // InstallReleaseResponse is the response from a release installation. type InstallReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -722,6 +753,8 @@ type UninstallReleaseRequest struct { Purge bool `protobuf:"varint,3,opt,name=purge" json:"purge,omitempty"` // timeout specifies the max amount of time any kubernetes client command can run. Timeout int64 `protobuf:"varint,4,opt,name=timeout" json:"timeout,omitempty"` + // Description, if set, will set the description for the uninnstalled release + Description string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"` } func (m *UninstallReleaseRequest) Reset() { *m = UninstallReleaseRequest{} } @@ -757,6 +790,13 @@ func (m *UninstallReleaseRequest) GetTimeout() int64 { return 0 } +func (m *UninstallReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // UninstallReleaseResponse represents a successful response to an uninstall request. type UninstallReleaseResponse struct { // Release is the release that was marked deleted. @@ -1393,84 +1433,85 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1257 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdf, 0x6f, 0xe3, 0xc4, - 0x13, 0xaf, 0xf3, 0x3b, 0x93, 0x36, 0xdf, 0x74, 0x9b, 0xb6, 0xae, 0xbf, 0x07, 0x2a, 0x46, 0x70, - 0xb9, 0x83, 0x4b, 0x21, 0xf0, 0x82, 0x84, 0x90, 0x7a, 0xb9, 0xa8, 0x2d, 0x94, 0x9c, 0xe4, 0x5c, - 0x0f, 0x09, 0x01, 0x91, 0x9b, 0x6c, 0x5a, 0x73, 0x8e, 0x1d, 0xbc, 0xeb, 0x72, 0x7d, 0xe5, 0x8d, - 0xff, 0x8a, 0xff, 0x83, 0x57, 0xde, 0xf9, 0x13, 0x40, 0xde, 0x1f, 0xae, 0xd7, 0xb5, 0x5b, 0xd3, - 0x97, 0x78, 0x77, 0x67, 0x76, 0x66, 0xf6, 0xf3, 0x99, 0x9d, 0x9d, 0x80, 0x71, 0x69, 0xaf, 0x9c, - 0x03, 0x82, 0x83, 0x2b, 0x67, 0x86, 0xc9, 0x01, 0x75, 0x5c, 0x17, 0x07, 0xfd, 0x55, 0xe0, 0x53, - 0x1f, 0x75, 0x23, 0x59, 0x5f, 0xca, 0xfa, 0x5c, 0x66, 0xec, 0xb0, 0x1d, 0xb3, 0x4b, 0x3b, 0xa0, - 0xfc, 0x97, 0x6b, 0x1b, 0xbb, 0xc9, 0x75, 0xdf, 0x5b, 0x38, 0x17, 0x42, 0xc0, 0x5d, 0x04, 0xd8, - 0xc5, 0x36, 0xc1, 0xf2, 0xab, 0x6c, 0x92, 0x32, 0xc7, 0x5b, 0xf8, 0x42, 0xf0, 0x7f, 0x45, 0x40, - 0x31, 0xa1, 0xd3, 0x20, 0xf4, 0x84, 0x70, 0x4f, 0x11, 0x12, 0x6a, 0xd3, 0x90, 0x28, 0xce, 0xae, - 0x70, 0x40, 0x1c, 0xdf, 0x93, 0x5f, 0x2e, 0x33, 0xff, 0x28, 0xc1, 0xd6, 0xa9, 0x43, 0xa8, 0xc5, - 0x37, 0x12, 0x0b, 0xff, 0x12, 0x62, 0x42, 0x51, 0x17, 0xaa, 0xae, 0xb3, 0x74, 0xa8, 0xae, 0xed, - 0x6b, 0xbd, 0xb2, 0xc5, 0x27, 0x68, 0x07, 0x6a, 0xfe, 0x62, 0x41, 0x30, 0xd5, 0x4b, 0xfb, 0x5a, - 0xaf, 0x69, 0x89, 0x19, 0xfa, 0x0a, 0xea, 0xc4, 0x0f, 0xe8, 0xf4, 0xfc, 0x5a, 0x2f, 0xef, 0x6b, - 0xbd, 0xf6, 0xe0, 0x83, 0x7e, 0x16, 0x4e, 0xfd, 0xc8, 0xd3, 0xc4, 0x0f, 0x68, 0x3f, 0xfa, 0x79, - 0x7e, 0x6d, 0xd5, 0x08, 0xfb, 0x46, 0x76, 0x17, 0x8e, 0x4b, 0x71, 0xa0, 0x57, 0xb8, 0x5d, 0x3e, - 0x43, 0x47, 0x00, 0xcc, 0xae, 0x1f, 0xcc, 0x71, 0xa0, 0x57, 0x99, 0xe9, 0x5e, 0x01, 0xd3, 0x2f, - 0x23, 0x7d, 0xab, 0x49, 0xe4, 0x10, 0x7d, 0x09, 0xeb, 0x1c, 0x92, 0xe9, 0xcc, 0x9f, 0x63, 0xa2, - 0xd7, 0xf6, 0xcb, 0xbd, 0xf6, 0x60, 0x8f, 0x9b, 0x92, 0xf0, 0x4f, 0x38, 0x68, 0x43, 0x7f, 0x8e, - 0xad, 0x16, 0x57, 0x8f, 0xc6, 0x04, 0x3d, 0x82, 0xa6, 0x67, 0x2f, 0x31, 0x59, 0xd9, 0x33, 0xac, - 0xd7, 0x59, 0x84, 0x37, 0x0b, 0xe6, 0x4f, 0xd0, 0x90, 0xce, 0xcd, 0x01, 0xd4, 0xf8, 0xd1, 0x50, - 0x0b, 0xea, 0x67, 0xe3, 0x6f, 0xc6, 0x2f, 0xbf, 0x1b, 0x77, 0xd6, 0x50, 0x03, 0x2a, 0xe3, 0xc3, - 0x6f, 0x47, 0x1d, 0x0d, 0x6d, 0xc2, 0xc6, 0xe9, 0xe1, 0xe4, 0xd5, 0xd4, 0x1a, 0x9d, 0x8e, 0x0e, - 0x27, 0xa3, 0x17, 0x9d, 0x92, 0xf9, 0x2e, 0x34, 0xe3, 0x98, 0x51, 0x1d, 0xca, 0x87, 0x93, 0x21, - 0xdf, 0xf2, 0x62, 0x34, 0x19, 0x76, 0x34, 0xf3, 0x77, 0x0d, 0xba, 0x2a, 0x45, 0x64, 0xe5, 0x7b, - 0x04, 0x47, 0x1c, 0xcd, 0xfc, 0xd0, 0x8b, 0x39, 0x62, 0x13, 0x84, 0xa0, 0xe2, 0xe1, 0xb7, 0x92, - 0x21, 0x36, 0x8e, 0x34, 0xa9, 0x4f, 0x6d, 0x97, 0xb1, 0x53, 0xb6, 0xf8, 0x04, 0x7d, 0x0a, 0x0d, - 0x71, 0x74, 0xa2, 0x57, 0xf6, 0xcb, 0xbd, 0xd6, 0x60, 0x5b, 0x05, 0x44, 0x78, 0xb4, 0x62, 0x35, - 0xf3, 0x08, 0x76, 0x8f, 0xb0, 0x8c, 0x84, 0xe3, 0x25, 0x33, 0x26, 0xf2, 0x6b, 0x2f, 0x31, 0x0b, - 0x26, 0xf2, 0x6b, 0x2f, 0x31, 0xd2, 0xa1, 0x2e, 0xd2, 0x8d, 0x85, 0x53, 0xb5, 0xe4, 0xd4, 0xa4, - 0xa0, 0xdf, 0x36, 0x24, 0xce, 0x95, 0x65, 0xe9, 0x43, 0xa8, 0x44, 0x37, 0x81, 0x99, 0x69, 0x0d, - 0x90, 0x1a, 0xe7, 0x89, 0xb7, 0xf0, 0x2d, 0x26, 0x57, 0xa9, 0x2a, 0xa7, 0xa9, 0x3a, 0x4e, 0x7a, - 0x1d, 0xfa, 0x1e, 0xc5, 0x1e, 0x7d, 0x58, 0xfc, 0xa7, 0xb0, 0x97, 0x61, 0x49, 0x1c, 0xe0, 0x00, - 0xea, 0x22, 0x34, 0x66, 0x2d, 0x17, 0x57, 0xa9, 0x65, 0xfe, 0x53, 0x82, 0xee, 0xd9, 0x6a, 0x6e, - 0x53, 0x2c, 0x45, 0x77, 0x04, 0xf5, 0x18, 0xaa, 0xac, 0xa2, 0x08, 0x2c, 0x36, 0xb9, 0x6d, 0x5e, - 0x76, 0x86, 0xd1, 0xaf, 0xc5, 0xe5, 0xe8, 0x29, 0xd4, 0xae, 0x6c, 0x37, 0xc4, 0x84, 0x01, 0x11, - 0xa3, 0x26, 0x34, 0x59, 0x39, 0xb2, 0x84, 0x06, 0xda, 0x85, 0xfa, 0x3c, 0xb8, 0x8e, 0xea, 0x09, - 0xbb, 0x82, 0x0d, 0xab, 0x36, 0x0f, 0xae, 0xad, 0xd0, 0x43, 0xef, 0xc3, 0xc6, 0xdc, 0x21, 0xf6, - 0xb9, 0x8b, 0xa7, 0x97, 0xbe, 0xff, 0x86, 0xb0, 0x5b, 0xd8, 0xb0, 0xd6, 0xc5, 0xe2, 0x71, 0xb4, - 0x86, 0x8c, 0x28, 0x93, 0x66, 0x01, 0xb6, 0x29, 0xd6, 0x6b, 0x4c, 0x1e, 0xcf, 0x23, 0x0c, 0xa9, - 0xb3, 0xc4, 0x7e, 0x48, 0xd9, 0xd5, 0x29, 0x5b, 0x72, 0x8a, 0xde, 0x83, 0xf5, 0x00, 0x13, 0x4c, - 0xa7, 0x22, 0xca, 0x06, 0xdb, 0xd9, 0x62, 0x6b, 0xaf, 0x79, 0x58, 0x08, 0x2a, 0xbf, 0xda, 0x0e, - 0xd5, 0x9b, 0x4c, 0xc4, 0xc6, 0x7c, 0x5b, 0x48, 0xb0, 0xdc, 0x06, 0x72, 0x5b, 0x48, 0xb0, 0xd8, - 0xd6, 0x85, 0xea, 0xc2, 0x0f, 0x66, 0x58, 0x6f, 0x31, 0x19, 0x9f, 0x44, 0x51, 0x92, 0xf0, 0x7c, - 0xec, 0x53, 0x4c, 0xf4, 0x75, 0x1e, 0xa5, 0x9c, 0x9b, 0xc7, 0xb0, 0x9d, 0x22, 0xe0, 0xa1, 0x5c, - 0xfe, 0xa5, 0xc1, 0x8e, 0xe5, 0xbb, 0xee, 0xb9, 0x3d, 0x7b, 0x53, 0x80, 0xcd, 0x04, 0xf0, 0xa5, - 0xbb, 0x81, 0x2f, 0x67, 0x00, 0x9f, 0x48, 0xd0, 0x8a, 0x92, 0xa0, 0x0a, 0x25, 0xd5, 0x7c, 0x4a, - 0x6a, 0x2a, 0x25, 0x12, 0xef, 0x7a, 0x02, 0xef, 0x18, 0xcc, 0x46, 0x02, 0x4c, 0xf3, 0x6b, 0xd8, - 0xbd, 0x75, 0xca, 0x87, 0x42, 0xf6, 0x77, 0x09, 0xb6, 0x4f, 0x3c, 0x42, 0x6d, 0xd7, 0x4d, 0x21, - 0x16, 0xe7, 0xba, 0x56, 0x38, 0xd7, 0x4b, 0xff, 0x25, 0xd7, 0xcb, 0x0a, 0xe4, 0x92, 0x9f, 0x4a, - 0x82, 0x9f, 0x42, 0xf9, 0xaf, 0x54, 0x9d, 0x5a, 0xaa, 0xea, 0xa0, 0x77, 0x00, 0x78, 0xc2, 0x32, - 0xe3, 0x1c, 0xda, 0x26, 0x5b, 0x19, 0x8b, 0x22, 0x23, 0xd9, 0x68, 0x64, 0xb3, 0x91, 0xcc, 0xfe, - 0x1e, 0x74, 0x64, 0x3c, 0xb3, 0x60, 0xce, 0x62, 0x12, 0x37, 0xa0, 0x2d, 0xd6, 0x87, 0xc1, 0x3c, - 0x8a, 0x4a, 0x49, 0xf7, 0x56, 0x2a, 0xdd, 0x4f, 0x60, 0x27, 0x0d, 0xf8, 0x43, 0xc9, 0xfb, 0x4d, - 0x83, 0xdd, 0x33, 0xcf, 0xc9, 0xa4, 0x2f, 0x2b, 0xe1, 0x6f, 0x01, 0x5a, 0xca, 0x00, 0xb4, 0x0b, - 0xd5, 0x55, 0x18, 0x5c, 0x60, 0x41, 0x10, 0x9f, 0x24, 0x91, 0xaa, 0x28, 0x48, 0x99, 0x53, 0xd0, - 0x6f, 0xc7, 0xf0, 0xc0, 0x13, 0x45, 0x51, 0xc7, 0x6f, 0x4d, 0x93, 0xbf, 0x2b, 0xe6, 0x16, 0x6c, - 0x1e, 0x61, 0xfa, 0x9a, 0x5f, 0x2e, 0x71, 0x3c, 0x73, 0x04, 0x28, 0xb9, 0x78, 0xe3, 0x4f, 0x2c, - 0xa9, 0xfe, 0x64, 0xe3, 0x25, 0xf5, 0xa5, 0x96, 0xf9, 0x05, 0xb3, 0x7d, 0xec, 0x10, 0xea, 0x07, - 0xd7, 0x77, 0x41, 0xd7, 0x81, 0xf2, 0xd2, 0x7e, 0x2b, 0x9e, 0xa2, 0x68, 0x68, 0x1e, 0xb1, 0x08, - 0xe2, 0xad, 0x22, 0x82, 0xe4, 0xc3, 0xae, 0x15, 0x7b, 0xd8, 0x7f, 0x00, 0xf4, 0x0a, 0xc7, 0x3d, - 0xc6, 0x3d, 0x6f, 0xa2, 0x24, 0xa1, 0xa4, 0xa6, 0xab, 0x0e, 0xf5, 0x99, 0x8b, 0x6d, 0x2f, 0x5c, - 0x09, 0xda, 0xe4, 0xd4, 0xfc, 0x11, 0xb6, 0x14, 0xeb, 0x22, 0xce, 0xe8, 0x3c, 0xe4, 0x42, 0x58, - 0x8f, 0x86, 0xe8, 0x73, 0xa8, 0xf1, 0xc6, 0x8b, 0xd9, 0x6e, 0x0f, 0x1e, 0xa9, 0x71, 0x33, 0x23, - 0xa1, 0x27, 0x3a, 0x35, 0x4b, 0xe8, 0x0e, 0xfe, 0x6c, 0x40, 0x5b, 0xb6, 0x12, 0xbc, 0x2d, 0x44, - 0x0e, 0xac, 0x27, 0x7b, 0x26, 0xf4, 0x24, 0xbf, 0x6b, 0x4c, 0xb5, 0xbe, 0xc6, 0xd3, 0x22, 0xaa, - 0xfc, 0x04, 0xe6, 0xda, 0x27, 0x1a, 0x22, 0xd0, 0x49, 0xb7, 0x32, 0xe8, 0x59, 0xb6, 0x8d, 0x9c, - 0xde, 0xc9, 0xe8, 0x17, 0x55, 0x97, 0x6e, 0xd1, 0x15, 0xcb, 0x19, 0xb5, 0xff, 0x40, 0xf7, 0x9a, - 0x51, 0x5b, 0x1e, 0xe3, 0xa0, 0xb0, 0x7e, 0xec, 0xf7, 0x67, 0xd8, 0x50, 0xde, 0x49, 0x94, 0x83, - 0x56, 0x56, 0x37, 0x63, 0x7c, 0x54, 0x48, 0x37, 0xf6, 0xb5, 0x84, 0xb6, 0x5a, 0xa4, 0x50, 0x8e, - 0x81, 0xcc, 0xb7, 0xc3, 0xf8, 0xb8, 0x98, 0x72, 0xec, 0x8e, 0x40, 0x27, 0x5d, 0x43, 0xf2, 0x78, - 0xcc, 0xa9, 0x77, 0x79, 0x3c, 0xe6, 0x95, 0x26, 0x73, 0x0d, 0xd9, 0x00, 0x37, 0x25, 0x04, 0x3d, - 0xce, 0x25, 0x44, 0xad, 0x3c, 0x46, 0xef, 0x7e, 0xc5, 0xd8, 0xc5, 0x0a, 0xfe, 0x97, 0x7a, 0xa9, - 0x51, 0x0e, 0x34, 0xd9, 0x6d, 0x8b, 0xf1, 0xac, 0xa0, 0x76, 0xea, 0x50, 0xa2, 0x2a, 0xdd, 0x71, - 0x28, 0xb5, 0xe4, 0xdd, 0x71, 0xa8, 0x54, 0x81, 0x33, 0xd7, 0x90, 0x03, 0x6d, 0x2b, 0xf4, 0x84, - 0xeb, 0xa8, 0x2c, 0xa0, 0x9c, 0xdd, 0xb7, 0xab, 0x9a, 0xf1, 0xa4, 0x80, 0xe6, 0xcd, 0xfd, 0x7e, - 0x0e, 0xdf, 0x37, 0xa4, 0xea, 0x79, 0x8d, 0xfd, 0x6b, 0xfe, 0xec, 0xdf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xbd, 0x2a, 0xa3, 0x1f, 0x23, 0x10, 0x00, 0x00, + // 1276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0x44, + 0x14, 0x6e, 0xe2, 0xfc, 0x9e, 0x74, 0x43, 0x76, 0x36, 0xdb, 0x7a, 0xcd, 0x82, 0x82, 0x11, 0x6c, + 0x76, 0x61, 0x53, 0x08, 0xdc, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, 0xed, + 0x22, 0x21, 0x50, 0xe4, 0x26, 0x93, 0xd6, 0xac, 0x63, 0x07, 0xcf, 0xb8, 0x6c, 0x1f, 0x00, 0x24, + 0xde, 0x83, 0x07, 0xe1, 0x3d, 0x78, 0x0e, 0xee, 0x91, 0xe7, 0xc7, 0xf5, 0x38, 0x76, 0x6a, 0x7a, + 0xd3, 0x78, 0xe6, 0x9c, 0x39, 0x3f, 0xdf, 0x37, 0xe7, 0xcc, 0x29, 0x18, 0x97, 0xf6, 0xca, 0xd9, + 0x23, 0x38, 0xb8, 0x72, 0x66, 0x98, 0xec, 0x51, 0xc7, 0x75, 0x71, 0x30, 0x58, 0x05, 0x3e, 0xf5, + 0x51, 0x37, 0x92, 0x0d, 0xa4, 0x6c, 0xc0, 0x65, 0xc6, 0x0e, 0x3b, 0x31, 0xbb, 0xb4, 0x03, 0xca, + 0xff, 0x72, 0x6d, 0x63, 0x37, 0xb9, 0xef, 0x7b, 0x0b, 0xe7, 0x42, 0x08, 0xb8, 0x8b, 0x00, 0xbb, + 0xd8, 0x26, 0x58, 0xfe, 0x2a, 0x87, 0xa4, 0xcc, 0xf1, 0x16, 0xbe, 0x10, 0xbc, 0xab, 0x08, 0x28, + 0x26, 0x74, 0x1a, 0x84, 0x9e, 0x10, 0x3e, 0x52, 0x84, 0x84, 0xda, 0x34, 0x24, 0x8a, 0xb3, 0x2b, + 0x1c, 0x10, 0xc7, 0xf7, 0xe4, 0x2f, 0x97, 0x99, 0x7f, 0x97, 0xe1, 0xc1, 0xb1, 0x43, 0xa8, 0xc5, + 0x0f, 0x12, 0x0b, 0xff, 0x1a, 0x62, 0x42, 0x51, 0x17, 0xaa, 0xae, 0xb3, 0x74, 0xa8, 0x5e, 0xea, + 0x95, 0xfa, 0x9a, 0xc5, 0x17, 0x68, 0x07, 0x6a, 0xfe, 0x62, 0x41, 0x30, 0xd5, 0xcb, 0xbd, 0x52, + 0xbf, 0x69, 0x89, 0x15, 0xfa, 0x06, 0xea, 0xc4, 0x0f, 0xe8, 0xf4, 0xfc, 0x5a, 0xd7, 0x7a, 0xa5, + 0x7e, 0x7b, 0xf8, 0xd1, 0x20, 0x0b, 0xa7, 0x41, 0xe4, 0x69, 0xe2, 0x07, 0x74, 0x10, 0xfd, 0x79, + 0x71, 0x6d, 0xd5, 0x08, 0xfb, 0x8d, 0xec, 0x2e, 0x1c, 0x97, 0xe2, 0x40, 0xaf, 0x70, 0xbb, 0x7c, + 0x85, 0x0e, 0x00, 0x98, 0x5d, 0x3f, 0x98, 0xe3, 0x40, 0xaf, 0x32, 0xd3, 0xfd, 0x02, 0xa6, 0x5f, + 0x45, 0xfa, 0x56, 0x93, 0xc8, 0x4f, 0xf4, 0x35, 0x6c, 0x73, 0x48, 0xa6, 0x33, 0x7f, 0x8e, 0x89, + 0x5e, 0xeb, 0x69, 0xfd, 0xf6, 0xf0, 0x11, 0x37, 0x25, 0xe1, 0x9f, 0x70, 0xd0, 0x46, 0xfe, 0x1c, + 0x5b, 0x2d, 0xae, 0x1e, 0x7d, 0x13, 0xf4, 0x18, 0x9a, 0x9e, 0xbd, 0xc4, 0x64, 0x65, 0xcf, 0xb0, + 0x5e, 0x67, 0x11, 0xde, 0x6c, 0x98, 0x1e, 0x34, 0xa4, 0x73, 0xf3, 0x05, 0xd4, 0x78, 0x6a, 0xa8, + 0x05, 0xf5, 0xb3, 0x93, 0xef, 0x4e, 0x5e, 0xfd, 0x70, 0xd2, 0xd9, 0x42, 0x0d, 0xa8, 0x9c, 0xec, + 0x7f, 0x3f, 0xee, 0x94, 0xd0, 0x7d, 0xb8, 0x77, 0xbc, 0x3f, 0x39, 0x9d, 0x5a, 0xe3, 0xe3, 0xf1, + 0xfe, 0x64, 0xfc, 0xb2, 0x53, 0x46, 0x6d, 0x80, 0xd1, 0xe1, 0xbe, 0x75, 0x3a, 0x65, 0x2a, 0x9a, + 0xf9, 0x3e, 0x34, 0xe3, 0x1c, 0x50, 0x1d, 0xb4, 0xfd, 0xc9, 0x88, 0x9b, 0x78, 0x39, 0x9e, 0x8c, + 0x3a, 0x25, 0xf3, 0xcf, 0x12, 0x74, 0x55, 0xca, 0xc8, 0xca, 0xf7, 0x08, 0x8e, 0x38, 0x9b, 0xf9, + 0xa1, 0x17, 0x73, 0xc6, 0x16, 0x08, 0x41, 0xc5, 0xc3, 0x6f, 0x25, 0x63, 0xec, 0x3b, 0xd2, 0xa4, + 0x3e, 0xb5, 0x5d, 0xc6, 0x96, 0x66, 0xf1, 0x05, 0xfa, 0x1c, 0x1a, 0x02, 0x0a, 0xa2, 0x57, 0x7a, + 0x5a, 0xbf, 0x35, 0x7c, 0xa8, 0x02, 0x24, 0x3c, 0x5a, 0xb1, 0x9a, 0x79, 0x00, 0xbb, 0x07, 0x58, + 0x46, 0xc2, 0xf1, 0x93, 0x37, 0x28, 0xf2, 0x6b, 0x2f, 0x31, 0x0b, 0x26, 0xf2, 0x6b, 0x2f, 0x31, + 0xd2, 0xa1, 0x2e, 0xae, 0x1f, 0x0b, 0xa7, 0x6a, 0xc9, 0xa5, 0x49, 0x41, 0x5f, 0x37, 0x24, 0xf2, + 0xca, 0xb2, 0xf4, 0x31, 0x54, 0xa2, 0xca, 0x60, 0x66, 0x5a, 0x43, 0xa4, 0xc6, 0x79, 0xe4, 0x2d, + 0x7c, 0x8b, 0xc9, 0x55, 0xea, 0xb4, 0x34, 0x75, 0x87, 0x49, 0xaf, 0x23, 0xdf, 0xa3, 0xd8, 0xa3, + 0x77, 0x8b, 0xff, 0x18, 0x1e, 0x65, 0x58, 0x12, 0x09, 0xec, 0x41, 0x5d, 0x84, 0xc6, 0xac, 0xe5, + 0xe2, 0x2a, 0xb5, 0xcc, 0xdf, 0x35, 0xe8, 0x9e, 0xad, 0xe6, 0x36, 0xc5, 0x52, 0xb4, 0x21, 0xa8, + 0x27, 0x50, 0x65, 0x1d, 0x46, 0x60, 0x71, 0x9f, 0xdb, 0xe6, 0x6d, 0x68, 0x14, 0xfd, 0xb5, 0xb8, + 0x1c, 0x3d, 0x83, 0xda, 0x95, 0xed, 0x86, 0x98, 0x30, 0x20, 0x62, 0xd4, 0x84, 0x26, 0x6b, 0x4f, + 0x96, 0xd0, 0x40, 0xbb, 0x50, 0x9f, 0x07, 0xd7, 0x51, 0x7f, 0x61, 0x25, 0xd9, 0xb0, 0x6a, 0xf3, + 0xe0, 0xda, 0x0a, 0x3d, 0xf4, 0x21, 0xdc, 0x9b, 0x3b, 0xc4, 0x3e, 0x77, 0xf1, 0xf4, 0xd2, 0xf7, + 0xdf, 0x10, 0x56, 0x95, 0x0d, 0x6b, 0x5b, 0x6c, 0x1e, 0x46, 0x7b, 0xc8, 0x88, 0x6e, 0xd2, 0x2c, + 0xc0, 0x36, 0xc5, 0x7a, 0x8d, 0xc9, 0xe3, 0x75, 0x84, 0x21, 0x75, 0x96, 0xd8, 0x0f, 0x29, 0x2b, + 0x25, 0xcd, 0x92, 0x4b, 0xf4, 0x01, 0x6c, 0x07, 0x98, 0x60, 0x3a, 0x15, 0x51, 0x36, 0xd8, 0xc9, + 0x16, 0xdb, 0x7b, 0xcd, 0xc3, 0x42, 0x50, 0xf9, 0xcd, 0x76, 0xa8, 0xde, 0x64, 0x22, 0xf6, 0xcd, + 0x8f, 0x85, 0x04, 0xcb, 0x63, 0x20, 0x8f, 0x85, 0x04, 0x8b, 0x63, 0x5d, 0xa8, 0x2e, 0xfc, 0x60, + 0x86, 0xf5, 0x16, 0x93, 0xf1, 0x05, 0xea, 0x41, 0x6b, 0x8e, 0xc9, 0x2c, 0x70, 0x56, 0x34, 0x62, + 0x74, 0x9b, 0x61, 0x9a, 0xdc, 0x32, 0x0f, 0xe1, 0x61, 0x8a, 0x86, 0xbb, 0x32, 0xfa, 0x47, 0x19, + 0x76, 0x2c, 0xdf, 0x75, 0xcf, 0xed, 0xd9, 0x9b, 0x02, 0x9c, 0x26, 0xe0, 0x2f, 0x6f, 0x86, 0x5f, + 0xcb, 0x80, 0x3f, 0x71, 0x4d, 0x2b, 0xca, 0x35, 0x55, 0x88, 0xa9, 0xe6, 0x13, 0x53, 0x53, 0x89, + 0x91, 0xa8, 0xd7, 0x13, 0xa8, 0xc7, 0x90, 0x36, 0x36, 0x40, 0xda, 0x5c, 0x87, 0xf4, 0x5b, 0xd8, + 0x5d, 0xc3, 0xe1, 0xae, 0xa0, 0xfe, 0x5b, 0x86, 0x87, 0x47, 0x1e, 0xa1, 0xb6, 0xeb, 0xa6, 0x30, + 0x8d, 0x6b, 0xa2, 0x54, 0xb8, 0x26, 0xca, 0xff, 0xa7, 0x26, 0x34, 0x85, 0x14, 0xc9, 0x60, 0x25, + 0xc1, 0x60, 0xa1, 0x3a, 0x51, 0xba, 0x53, 0x2d, 0xd5, 0x9d, 0xd0, 0x7b, 0x00, 0xfc, 0x62, 0x33, + 0xe3, 0x1c, 0xfc, 0x26, 0xdb, 0x39, 0x11, 0xcd, 0x48, 0xf2, 0xd5, 0xc8, 0xe6, 0x2b, 0x59, 0x25, + 0x7d, 0xe8, 0xc8, 0x78, 0x66, 0xc1, 0x9c, 0xc5, 0x24, 0x2a, 0xa5, 0x2d, 0xf6, 0x47, 0xc1, 0x3c, + 0x8a, 0x2a, 0xcd, 0x61, 0x6b, 0x9d, 0xc3, 0x23, 0xd8, 0x49, 0xc3, 0x7e, 0x57, 0x0a, 0xff, 0x2a, + 0xc1, 0xee, 0x99, 0xe7, 0x64, 0x92, 0x98, 0x55, 0x18, 0x6b, 0xb0, 0x96, 0x33, 0x60, 0xed, 0x42, + 0x75, 0x15, 0x06, 0x17, 0x58, 0xd0, 0xc4, 0x17, 0x49, 0xbc, 0x2a, 0x2a, 0x5e, 0xa9, 0x8c, 0xab, + 0xeb, 0x19, 0x4f, 0x41, 0x5f, 0x8f, 0xf2, 0x8e, 0x39, 0x47, 0x79, 0xc5, 0x6f, 0x57, 0x93, 0xbf, + 0x53, 0xe6, 0x03, 0xb8, 0x7f, 0x80, 0xe9, 0x6b, 0x5e, 0xa6, 0x02, 0x00, 0x73, 0x0c, 0x28, 0xb9, + 0x79, 0xe3, 0x4f, 0x6c, 0xa9, 0xfe, 0xe4, 0x60, 0x27, 0xf5, 0xa5, 0x96, 0xf9, 0x15, 0xb3, 0x7d, + 0xe8, 0x10, 0xea, 0x07, 0xd7, 0x9b, 0xc0, 0xed, 0x80, 0xb6, 0xb4, 0xdf, 0x8a, 0xa7, 0x2d, 0xfa, + 0x34, 0x0f, 0x58, 0x04, 0xf1, 0x51, 0x11, 0x41, 0x72, 0x50, 0x28, 0x15, 0x1b, 0x14, 0x7e, 0x02, + 0x74, 0x8a, 0xe3, 0x99, 0xe5, 0x96, 0x37, 0x56, 0xd2, 0x54, 0x56, 0x69, 0xd2, 0xa1, 0x3e, 0x73, + 0xb1, 0xed, 0x85, 0x2b, 0x41, 0xac, 0x5c, 0x9a, 0x3f, 0xc3, 0x03, 0xc5, 0xba, 0x88, 0x33, 0xca, + 0x87, 0x5c, 0x08, 0xeb, 0xd1, 0x27, 0xfa, 0x12, 0x6a, 0x7c, 0xb0, 0x63, 0xb6, 0xdb, 0xc3, 0xc7, + 0x6a, 0xdc, 0xcc, 0x48, 0xe8, 0x89, 0x49, 0xd0, 0x12, 0xba, 0xc3, 0x7f, 0x1a, 0xd0, 0x96, 0xa3, + 0x09, 0x1f, 0x3b, 0x91, 0x03, 0xdb, 0xc9, 0x19, 0x0c, 0x3d, 0xcd, 0x9f, 0x4a, 0x53, 0xa3, 0xb5, + 0xf1, 0xac, 0x88, 0x2a, 0xcf, 0xc0, 0xdc, 0xfa, 0xac, 0x84, 0x08, 0x74, 0xd2, 0xa3, 0x11, 0x7a, + 0x9e, 0x6d, 0x23, 0x67, 0x16, 0x33, 0x06, 0x45, 0xd5, 0xa5, 0x5b, 0x74, 0xc5, 0xee, 0x8c, 0x3a, + 0xcf, 0xa0, 0x5b, 0xcd, 0xa8, 0x23, 0x94, 0xb1, 0x57, 0x58, 0x3f, 0xf6, 0xfb, 0x0b, 0xdc, 0x53, + 0x5e, 0x5c, 0x94, 0x83, 0x56, 0xd6, 0x74, 0x64, 0x7c, 0x52, 0x48, 0x37, 0xf6, 0xb5, 0x84, 0xb6, + 0xda, 0xc6, 0x50, 0x8e, 0x81, 0xcc, 0x37, 0xc6, 0xf8, 0xb4, 0x98, 0x72, 0xec, 0x8e, 0x40, 0x27, + 0xdd, 0x43, 0xf2, 0x78, 0xcc, 0xe9, 0x88, 0x79, 0x3c, 0xe6, 0xb5, 0x26, 0x73, 0x0b, 0xd9, 0x00, + 0x37, 0x2d, 0x04, 0x3d, 0xc9, 0x25, 0x44, 0xed, 0x3c, 0x46, 0xff, 0x76, 0xc5, 0xd8, 0xc5, 0x0a, + 0xde, 0x49, 0xbd, 0xe8, 0x28, 0x07, 0x9a, 0xec, 0x01, 0xc8, 0x78, 0x5e, 0x50, 0x3b, 0x95, 0x94, + 0xe8, 0x4a, 0x1b, 0x92, 0x52, 0x5b, 0xde, 0x86, 0xa4, 0x52, 0x0d, 0xce, 0xdc, 0x42, 0x0e, 0xb4, + 0xad, 0xd0, 0x13, 0xae, 0xa3, 0xb6, 0x80, 0x72, 0x4e, 0xaf, 0x77, 0x35, 0xe3, 0x69, 0x01, 0xcd, + 0x9b, 0xfa, 0x7e, 0x01, 0x3f, 0x36, 0xa4, 0xea, 0x79, 0x8d, 0xfd, 0x57, 0xfe, 0xc5, 0x7f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x38, 0x07, 0x4c, 0x12, 0x83, 0x10, 0x00, 0x00, } diff --git a/pkg/provenance/doc.go b/pkg/provenance/doc.go index dacfa9e69..bee484944 100644 --- a/pkg/provenance/doc.go +++ b/pkg/provenance/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/provenance/sign.go b/pkg/provenance/sign.go index ecd6612a3..5e23c2dda 100644 --- a/pkg/provenance/sign.go +++ b/pkg/provenance/sign.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/provenance/sign_test.go b/pkg/provenance/sign_test.go index 388941deb..d74e23887 100644 --- a/pkg/provenance/sign_test.go +++ b/pkg/provenance/sign_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/releasetesting/environment.go b/pkg/releasetesting/environment.go index 3b3d07933..ee078e182 100644 --- a/pkg/releasetesting/environment.go +++ b/pkg/releasetesting/environment.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( "log" "time" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" @@ -49,7 +49,7 @@ func (env *Environment) createTestPod(test *test) error { return nil } -func (env *Environment) getTestPodStatus(test *test) (core.PodPhase, error) { +func (env *Environment) getTestPodStatus(test *test) (v1.PodPhase, error) { b := bytes.NewBufferString(test.manifest) status, err := env.KubeClient.WaitAndGetCompletedPodPhase(env.Namespace, b, time.Duration(env.Timeout)*time.Second) if err != nil { diff --git a/pkg/releasetesting/environment_test.go b/pkg/releasetesting/environment_test.go index 0199b74eb..4403ab6a9 100644 --- a/pkg/releasetesting/environment_test.go +++ b/pkg/releasetesting/environment_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releasetesting/test_suite.go b/pkg/releasetesting/test_suite.go index 2e42400ce..8ba83fdb2 100644 --- a/pkg/releasetesting/test_suite.go +++ b/pkg/releasetesting/test_suite.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import ( "github.com/ghodss/yaml" "github.com/golang/protobuf/ptypes/timestamp" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" "k8s.io/helm/pkg/hooks" "k8s.io/helm/pkg/proto/hapi/release" @@ -90,7 +90,7 @@ func (ts *TestSuite) Run(env *Environment) error { } resourceCleanExit := true - status := core.PodUnknown + status := v1.PodUnknown if resourceCreated { status, err = env.getTestPodStatus(test) if err != nil { @@ -119,15 +119,15 @@ func (ts *TestSuite) Run(env *Environment) error { return nil } -func (t *test) assignTestResult(podStatus core.PodPhase) error { +func (t *test) assignTestResult(podStatus v1.PodPhase) error { switch podStatus { - case core.PodSucceeded: + case v1.PodSucceeded: if t.expectedSuccess { t.result.Status = release.TestRun_SUCCESS } else { t.result.Status = release.TestRun_FAILURE } - case core.PodFailed: + case v1.PodFailed: if !t.expectedSuccess { t.result.Status = release.TestRun_SUCCESS } else { diff --git a/pkg/releasetesting/test_suite_test.go b/pkg/releasetesting/test_suite_test.go index e6cc8bcf5..bf85e4207 100644 --- a/pkg/releasetesting/test_suite_test.go +++ b/pkg/releasetesting/test_suite_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import ( "golang.org/x/net/context" grpc "google.golang.org/grpc" "google.golang.org/grpc/metadata" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/proto/hapi/chart" @@ -134,7 +134,7 @@ func TestRun(t *testing.T) { } if result2.Status != release.TestRun_FAILURE { - t.Errorf("Expected test result to be successful, got: %v", result2.Status) + t.Errorf("Expected test result to be failure, got: %v", result2.Status) } } @@ -324,8 +324,8 @@ func newPodSucceededKubeClient() *podSucceededKubeClient { } } -func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodSucceeded, nil +func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodSucceeded, nil } type podFailedKubeClient struct { @@ -338,6 +338,6 @@ func newPodFailedKubeClient() *podFailedKubeClient { } } -func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodFailed, nil +func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodFailed, nil } diff --git a/pkg/releaseutil/filter.go b/pkg/releaseutil/filter.go index fdd2cc381..458da705f 100644 --- a/pkg/releaseutil/filter.go +++ b/pkg/releaseutil/filter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/filter_test.go b/pkg/releaseutil/filter_test.go index 590952363..802b1db7a 100644 --- a/pkg/releaseutil/filter_test.go +++ b/pkg/releaseutil/filter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/manifest.go b/pkg/releaseutil/manifest.go index a0449cc55..78c2979c4 100644 --- a/pkg/releaseutil/manifest.go +++ b/pkg/releaseutil/manifest.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/manifest_test.go b/pkg/releaseutil/manifest_test.go index 7906279ad..8e0793d5f 100644 --- a/pkg/releaseutil/manifest_test.go +++ b/pkg/releaseutil/manifest_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/releaseutil/sorter.go b/pkg/releaseutil/sorter.go index 1b744d72c..977f49398 100644 --- a/pkg/releaseutil/sorter.go +++ b/pkg/releaseutil/sorter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -75,3 +75,26 @@ func SortByRevision(list []*rspb.Release) { } sort.Sort(s) } + +// SortByChartName sorts the list of releases by a +// release's chart name in lexicographical order. +func SortByChartName(list []*rspb.Release) { + s := &sorter{list: list} + s.less = func(i, j int) bool { + chi := s.list[i].Chart + chj := s.list[j].Chart + + ni := "" + if chi != nil && chi.Metadata != nil { + ni = chi.Metadata.Name + } + + nj := "" + if chj != nil && chj.Metadata != nil { + nj = chj.Metadata.Name + } + + return ni < nj + } + sort.Sort(s) +} diff --git a/pkg/releaseutil/sorter_test.go b/pkg/releaseutil/sorter_test.go index 7d4e31e2e..4b784c0a0 100644 --- a/pkg/releaseutil/sorter_test.go +++ b/pkg/releaseutil/sorter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import ( "testing" "time" + "k8s.io/helm/pkg/proto/hapi/chart" rspb "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/timeconv" ) @@ -40,6 +41,11 @@ func tsRelease(name string, vers int32, dur time.Duration, code rspb.Status_Code Name: name, Version: vers, Info: info, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{ + Name: name, + }, + }, } } @@ -80,3 +86,13 @@ func TestSortByRevision(t *testing.T) { return vi < vj }) } + +func TestSortByChartName(t *testing.T) { + SortByChartName(releases) + + check(t, "ByChartName", func(i, j int) bool { + ni := releases[i].Chart.Metadata.Name + nj := releases[j].Chart.Metadata.Name + return ni < nj + }) +} diff --git a/pkg/renderutil/deps.go b/pkg/renderutil/deps.go new file mode 100644 index 000000000..72e4d12a1 --- /dev/null +++ b/pkg/renderutil/deps.go @@ -0,0 +1,50 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package renderutil + +import ( + "fmt" + "strings" + + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/proto/hapi/chart" +) + +// CheckDependencies will do a simple dependency check on the chart for local +// rendering +func CheckDependencies(ch *chart.Chart, reqs *chartutil.Requirements) error { + missing := []string{} + + deps := ch.GetDependencies() + for _, r := range reqs.Dependencies { + found := false + for _, d := range deps { + if d.Metadata.Name == r.Name { + found = true + break + } + } + if !found { + missing = append(missing, r.Name) + } + } + + if len(missing) > 0 { + return fmt.Errorf("found in requirements.yaml, but missing in charts/ directory: %s", strings.Join(missing, ", ")) + } + return nil +} diff --git a/pkg/renderutil/doc.go b/pkg/renderutil/doc.go new file mode 100644 index 000000000..38c3ae60d --- /dev/null +++ b/pkg/renderutil/doc.go @@ -0,0 +1,24 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +/*Package renderutil contains tools related to the local rendering of charts. + +Local rendering means rendering without the tiller; this is generally used for +local debugging and testing (see the `helm template` command for examples of +use). This package will not render charts exactly the same way as the tiller +will, but will be generally close enough for local debug purposes. +*/ +package renderutil // import "k8s.io/helm/pkg/renderutil" diff --git a/pkg/renderutil/render.go b/pkg/renderutil/render.go new file mode 100644 index 000000000..1996e1dc2 --- /dev/null +++ b/pkg/renderutil/render.go @@ -0,0 +1,88 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package renderutil + +import ( + "fmt" + + "github.com/Masterminds/semver" + + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/engine" + "k8s.io/helm/pkg/proto/hapi/chart" + tversion "k8s.io/helm/pkg/version" +) + +// Options are options for this simple local render +type Options struct { + ReleaseOptions chartutil.ReleaseOptions + KubeVersion string +} + +// Render chart templates locally and display the output. +// This does not require the Tiller. Any values that would normally be +// looked up or retrieved in-cluster will be faked locally. Additionally, none +// of the server-side testing of chart validity (e.g. whether an API is supported) +// is done. +// +// Note: a `nil` config passed here means "ignore the chart's default values"; +// if you want the normal behavior of merging the defaults with the new config, +// you should pass `&chart.Config{Raw: "{}"}, +func Render(c *chart.Chart, config *chart.Config, opts Options) (map[string]string, error) { + if req, err := chartutil.LoadRequirements(c); err == nil { + if err := CheckDependencies(c, req); err != nil { + return nil, err + } + } else if err != chartutil.ErrRequirementsNotFound { + return nil, fmt.Errorf("cannot load requirements: %v", err) + } + + err := chartutil.ProcessRequirementsEnabled(c, config) + if err != nil { + return nil, err + } + err = chartutil.ProcessRequirementsImportValues(c) + if err != nil { + return nil, err + } + + // Set up engine. + renderer := engine.New() + + caps := &chartutil.Capabilities{ + APIVersions: chartutil.DefaultVersionSet, + KubeVersion: chartutil.DefaultKubeVersion, + TillerVersion: tversion.GetVersionProto(), + } + + if opts.KubeVersion != "" { + kv, verErr := semver.NewVersion(opts.KubeVersion) + if verErr != nil { + return nil, fmt.Errorf("could not parse a kubernetes version: %v", verErr) + } + caps.KubeVersion.Major = fmt.Sprint(kv.Major()) + caps.KubeVersion.Minor = fmt.Sprint(kv.Minor()) + caps.KubeVersion.GitVersion = fmt.Sprintf("v%d.%d.0", kv.Major(), kv.Minor()) + } + + vals, err := chartutil.ToRenderValuesCaps(c, config, opts.ReleaseOptions, caps) + if err != nil { + return nil, err + } + + return renderer.Render(c, vals) +} diff --git a/pkg/renderutil/render_test.go b/pkg/renderutil/render_test.go new file mode 100644 index 000000000..e10ff883c --- /dev/null +++ b/pkg/renderutil/render_test.go @@ -0,0 +1,153 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package renderutil + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "k8s.io/helm/pkg/chartutil" + "k8s.io/helm/pkg/proto/hapi/chart" +) + +const cmTemplate = `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: +{{.Chart | toYaml | indent 4}} + Release: +{{.Release | toYaml | indent 4}} + Values: +{{.Values | toYaml | indent 4}} +` + +func TestRender(t *testing.T) { + + testChart := &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/cm.yaml", Data: []byte(cmTemplate)}, + }, + Values: &chart.Config{Raw: "meow: defaultmeow"}, + } + + newConfig := &chart.Config{Raw: "meow: newmeow"} + defaultConfig := &chart.Config{Raw: "{}"} + + tests := map[string]struct { + chart *chart.Chart + config *chart.Config + opts Options + want map[string]string + }{ + "BasicWithValues": { + chart: testChart, + config: newConfig, + opts: Options{}, + want: map[string]string{ + "hello/templates/cm.yaml": `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: + name: hello + + Release: + IsInstall: false + IsUpgrade: false + Name: "" + Namespace: "" + Revision: 0 + Service: Tiller + Time: null + + Values: + meow: newmeow + +`, + }, + }, + "BasicNoValues": { + chart: testChart, + config: defaultConfig, + opts: Options{}, + want: map[string]string{ + "hello/templates/cm.yaml": `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: + name: hello + + Release: + IsInstall: false + IsUpgrade: false + Name: "" + Namespace: "" + Revision: 0 + Service: Tiller + Time: null + + Values: + meow: defaultmeow + +`, + }, + }, + "SetSomeReleaseValues": { + chart: testChart, + config: defaultConfig, + opts: Options{ReleaseOptions: chartutil.ReleaseOptions{Name: "meow"}}, + want: map[string]string{ + "hello/templates/cm.yaml": `kind: ConfigMap +apiVersion: v1 +metadata: + name: example +data: + Chart: + name: hello + + Release: + IsInstall: false + IsUpgrade: false + Name: meow + Namespace: "" + Revision: 0 + Service: Tiller + Time: null + + Values: + meow: defaultmeow + +`, + }, + }, + } + + for testName, tt := range tests { + t.Run(testName, func(t *testing.T) { + got, err := Render(tt.chart, tt.config, tt.opts) + require.NoError(t, err) + require.Equal(t, tt.want, got) + }) + } +} diff --git a/pkg/repo/chartrepo.go b/pkg/repo/chartrepo.go index 438f66d7c..cd9d6c547 100644 --- a/pkg/repo/chartrepo.go +++ b/pkg/repo/chartrepo.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -270,5 +270,13 @@ func ResolveReferenceURL(baseURL, refURL string) (string, error) { return "", fmt.Errorf("failed to parse %s as URL: %v", refURL, err) } - return parsedBaseURL.ResolveReference(parsedRefURL).String(), nil + // if the base URL contains query string parameters, + // propagate them to the child URL but only if the + // refURL is relative to baseURL + resolvedURL := parsedBaseURL.ResolveReference(parsedRefURL) + if (resolvedURL.Hostname() == parsedBaseURL.Hostname()) && (resolvedURL.Port() == parsedBaseURL.Port()) { + resolvedURL.RawQuery = parsedBaseURL.RawQuery + } + + return resolvedURL.String(), nil } diff --git a/pkg/repo/chartrepo_test.go b/pkg/repo/chartrepo_test.go index 948ee12d3..19071872d 100644 --- a/pkg/repo/chartrepo_test.go +++ b/pkg/repo/chartrepo_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -287,6 +287,14 @@ func TestResolveReferenceURL(t *testing.T) { t.Errorf("%s", chartURL) } + chartURL, err = ResolveReferenceURL("http://localhost:8123/charts/?st=2018-08-06T22%3A59%3A04Z&se=2018-08-07T22%3A59%3A04Z&sp=rl&sv=2018-03-28&sr=c&sig=cyqM4%2F5G7HNk%2F3faaHSDMaWxFxefCglvZlYSnmQBwiY%3D", "nginx-0.2.0.tgz") + if err != nil { + t.Errorf("%s", err) + } + if chartURL != "http://localhost:8123/charts/nginx-0.2.0.tgz?st=2018-08-06T22%3A59%3A04Z&se=2018-08-07T22%3A59%3A04Z&sp=rl&sv=2018-03-28&sr=c&sig=cyqM4%2F5G7HNk%2F3faaHSDMaWxFxefCglvZlYSnmQBwiY%3D" { + t.Errorf("%s does not contain the query string of the base URL", chartURL) + } + chartURL, err = ResolveReferenceURL("http://localhost:8123", "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz") if err != nil { t.Errorf("%s", err) @@ -294,4 +302,12 @@ func TestResolveReferenceURL(t *testing.T) { if chartURL != "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz" { t.Errorf("%s", chartURL) } + + chartURL, err = ResolveReferenceURL("http://localhost:8123/?querystring", "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz") + if err != nil { + t.Errorf("%s", err) + } + if chartURL != "https://kubernetes-charts.storage.googleapis.com/nginx-0.2.0.tgz" { + t.Errorf("%s contains query string from base URL when it shouldn't", chartURL) + } } diff --git a/pkg/repo/doc.go b/pkg/repo/doc.go index fb8b3f4b2..19ccf267c 100644 --- a/pkg/repo/doc.go +++ b/pkg/repo/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 174ceea01..01bf4a8ca 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/index_test.go b/pkg/repo/index_test.go index ba426b174..2ce817ce3 100644 --- a/pkg/repo/index_test.go +++ b/pkg/repo/index_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/local.go b/pkg/repo/local.go index f13a4d0ac..caca1b9c2 100644 --- a/pkg/repo/local.go +++ b/pkg/repo/local.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/local_test.go b/pkg/repo/local_test.go index 1e5359dee..cf6cf2d11 100644 --- a/pkg/repo/local_test.go +++ b/pkg/repo/local_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index b5bba164e..fa550357a 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/repo_test.go b/pkg/repo/repo_test.go index 4b5bcdbf5..264e9bc3c 100644 --- a/pkg/repo/repo_test.go +++ b/pkg/repo/repo_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/repo/repotest/doc.go b/pkg/repo/repotest/doc.go index 34d4bc6b0..3bf98aa7e 100644 --- a/pkg/repo/repotest/doc.go +++ b/pkg/repo/repotest/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/repo/repotest/server.go b/pkg/repo/repotest/server.go index 8ea9103a0..36ab10d70 100644 --- a/pkg/repo/repotest/server.go +++ b/pkg/repo/repotest/server.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/repo/repotest/server_test.go b/pkg/repo/repotest/server_test.go index 61c056172..e4819fbf7 100644 --- a/pkg/repo/repotest/server_test.go +++ b/pkg/repo/repotest/server_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/resolver/resolver.go b/pkg/resolver/resolver.go index ec8ea2cce..8177df2d3 100644 --- a/pkg/resolver/resolver.go +++ b/pkg/resolver/resolver.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/resolver/resolver_test.go b/pkg/resolver/resolver_test.go index 78a0bc46c..689ffbc32 100644 --- a/pkg/resolver/resolver_test.go +++ b/pkg/resolver/resolver_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml b/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml index e2d438701..bfade3dbc 100644 --- a/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml +++ b/pkg/resolver/testdata/helmhome/repository/cache/kubernetes-charts-index.yaml @@ -7,7 +7,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.2.0 description: Deploy a basic Alpine Linux pod keywords: [] @@ -20,7 +20,7 @@ entries: checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d home: https://k8s.io/helm sources: - - https://github.com/kubernetes/helm + - https://github.com/helm/helm version: 0.1.0 description: Deploy a basic Alpine Linux pod keywords: [] diff --git a/pkg/rudder/client.go b/pkg/rudder/client.go index 219bb010a..093a0c360 100644 --- a/pkg/rudder/client.go +++ b/pkg/rudder/client.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/cfgmaps.go b/pkg/storage/driver/cfgmaps.go index 51fa8f8f6..5b511d811 100644 --- a/pkg/storage/driver/cfgmaps.go +++ b/pkg/storage/driver/cfgmaps.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,14 +22,15 @@ import ( "strings" "time" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kblabels "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/validation" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var _ Driver = (*ConfigMaps)(nil) @@ -40,13 +41,13 @@ const ConfigMapsDriverName = "ConfigMap" // ConfigMaps is a wrapper around an implementation of a kubernetes // ConfigMapsInterface. type ConfigMaps struct { - impl internalversion.ConfigMapInterface + impl corev1.ConfigMapInterface Log func(string, ...interface{}) } // NewConfigMaps initializes a new ConfigMaps wrapping an implementation of // the kubernetes ConfigMapsInterface. -func NewConfigMaps(impl internalversion.ConfigMapInterface) *ConfigMaps { +func NewConfigMaps(impl corev1.ConfigMapInterface) *ConfigMaps { return &ConfigMaps{ impl: impl, Log: func(_ string, _ ...interface{}) {}, @@ -65,7 +66,7 @@ func (cfgmaps *ConfigMaps) Get(key string) (*rspb.Release, error) { obj, err := cfgmaps.impl.Get(key, metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) } cfgmaps.Log("get: failed to get %q: %s", key, err) @@ -131,7 +132,7 @@ func (cfgmaps *ConfigMaps) Query(labels map[string]string) ([]*rspb.Release, err } if len(list.Items) == 0 { - return nil, ErrReleaseNotFound(labels["NAME"]) + return nil, storageerrors.ErrReleaseNotFound(labels["NAME"]) } var results []*rspb.Release @@ -164,7 +165,7 @@ func (cfgmaps *ConfigMaps) Create(key string, rls *rspb.Release) error { // push the configmap object out into the kubiverse if _, err := cfgmaps.impl.Create(obj); err != nil { if apierrors.IsAlreadyExists(err) { - return ErrReleaseExists(key) + return storageerrors.ErrReleaseExists(key) } cfgmaps.Log("create: failed to create: %s", err) @@ -202,7 +203,7 @@ func (cfgmaps *ConfigMaps) Delete(key string) (rls *rspb.Release, err error) { // fetch the release to check existence if rls, err = cfgmaps.Get(key); err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseExists(rls.Name) + return nil, storageerrors.ErrReleaseExists(rls.Name) } cfgmaps.Log("delete: failed to get release %q: %s", key, err) @@ -228,7 +229,7 @@ func (cfgmaps *ConfigMaps) Delete(key string) (rls *rspb.Release, err error) { // "OWNER" - owner of the configmap, currently "TILLER". // "NAME" - name of the release. // -func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.ConfigMap, error) { +func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*v1.ConfigMap, error) { const owner = "TILLER" // encode the release @@ -248,7 +249,7 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.Confi lbs.set("VERSION", strconv.Itoa(int(rls.Version))) // create and return configmap object - return &core.ConfigMap{ + return &v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: key, Labels: lbs.toMap(), diff --git a/pkg/storage/driver/cfgmaps_test.go b/pkg/storage/driver/cfgmaps_test.go index 7501ad9cb..d2e5e942e 100644 --- a/pkg/storage/driver/cfgmaps_test.go +++ b/pkg/storage/driver/cfgmaps_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -19,7 +19,7 @@ import ( "testing" "github.com/gogo/protobuf/proto" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" ) @@ -69,7 +69,7 @@ func TestUNcompressedConfigMapGet(t *testing.T) { } cfgmap.Data["release"] = base64.StdEncoding.EncodeToString(b) var mock MockConfigMapsInterface - mock.objects = map[string]*core.ConfigMap{key: cfgmap} + mock.objects = map[string]*v1.ConfigMap{key: cfgmap} cfgmaps := NewConfigMaps(&mock) // get release with key diff --git a/pkg/storage/driver/driver.go b/pkg/storage/driver/driver.go index e01d35d64..3bcbd4a7e 100644 --- a/pkg/storage/driver/driver.go +++ b/pkg/storage/driver/driver.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,18 +17,17 @@ limitations under the License. package driver // import "k8s.io/helm/pkg/storage/driver" import ( - "fmt" - rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var ( - // ErrReleaseNotFound indicates that a release is not found. - ErrReleaseNotFound = func(release string) error { return fmt.Errorf("release: %q not found", release) } - // ErrReleaseExists indicates that a release already exists. - ErrReleaseExists = func(release string) error { return fmt.Errorf("release: %q already exists", release) } - // ErrInvalidKey indicates that a release key could not be parsed. - ErrInvalidKey = func(release string) error { return fmt.Errorf("release: %q invalid key", release) } + // ErrReleaseNotFound has been deprecated; please use storageerrors.ErrReleaseNotFound instead. + ErrReleaseNotFound = storageerrors.ErrReleaseNotFound + // ErrReleaseExists has been deprecated; please use storageerrors.ErrReleaseExists instead. + ErrReleaseExists = storageerrors.ErrReleaseExists + // ErrInvalidKey has been deprecated; please use storageerrors.ErrInvalidKey instead. + ErrInvalidKey = storageerrors.ErrInvalidKey ) // Creator is the interface that wraps the Create method. diff --git a/pkg/storage/driver/labels.go b/pkg/storage/driver/labels.go index 8668d665b..eb7118fe5 100644 --- a/pkg/storage/driver/labels.go +++ b/pkg/storage/driver/labels.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/labels_test.go b/pkg/storage/driver/labels_test.go index af0bd24e5..e8d7fc90c 100644 --- a/pkg/storage/driver/labels_test.go +++ b/pkg/storage/driver/labels_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/memory.go b/pkg/storage/driver/memory.go index ceb0d67dd..700b87e08 100644 --- a/pkg/storage/driver/memory.go +++ b/pkg/storage/driver/memory.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import ( "sync" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var _ Driver = (*Memory)(nil) @@ -53,16 +54,16 @@ func (mem *Memory) Get(key string) (*rspb.Release, error) { case 2: name, ver := elems[0], elems[1] if _, err := strconv.Atoi(ver); err != nil { - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } if recs, ok := mem.cache[name]; ok { if r := recs.Get(key); r != nil { return r.rls, nil } } - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) default: - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } } @@ -131,7 +132,7 @@ func (mem *Memory) Update(key string, rls *rspb.Release) error { rs.Replace(key, newRecord(key, rls)) return nil } - return ErrReleaseNotFound(rls.Name) + return storageerrors.ErrReleaseNotFound(rls.Name) } // Delete deletes a release or returns ErrReleaseNotFound. @@ -141,12 +142,12 @@ func (mem *Memory) Delete(key string) (*rspb.Release, error) { elems := strings.Split(key, ".v") if len(elems) != 2 { - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } name, ver := elems[0], elems[1] if _, err := strconv.Atoi(ver); err != nil { - return nil, ErrInvalidKey(key) + return nil, storageerrors.ErrInvalidKey(key) } if recs, ok := mem.cache[name]; ok { if r := recs.Remove(key); r != nil { @@ -155,7 +156,7 @@ func (mem *Memory) Delete(key string) (*rspb.Release, error) { return r.rls, nil } } - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) } // wlock locks mem for writing diff --git a/pkg/storage/driver/memory_test.go b/pkg/storage/driver/memory_test.go index 1062071e7..4f45cf72b 100644 --- a/pkg/storage/driver/memory_test.go +++ b/pkg/storage/driver/memory_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/mock_test.go b/pkg/storage/driver/mock_test.go index 979d11cb6..363d9dd5d 100644 --- a/pkg/storage/driver/mock_test.go +++ b/pkg/storage/driver/mock_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,10 +20,11 @@ import ( "fmt" "testing" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" + "k8s.io/apimachinery/pkg/runtime/schema" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" ) @@ -76,14 +77,14 @@ func newTestFixtureCfgMaps(t *testing.T, releases ...*rspb.Release) *ConfigMaps // MockConfigMapsInterface mocks a kubernetes ConfigMapsInterface type MockConfigMapsInterface struct { - internalversion.ConfigMapInterface + corev1.ConfigMapInterface - objects map[string]*core.ConfigMap + objects map[string]*v1.ConfigMap } // Init initializes the MockConfigMapsInterface with the set of releases. func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Release) { - mock.objects = map[string]*core.ConfigMap{} + mock.objects = map[string]*v1.ConfigMap{} for _, rls := range releases { objkey := testKey(rls.Name, rls.Version) @@ -97,17 +98,17 @@ func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Releas } // Get returns the ConfigMap by name. -func (mock *MockConfigMapsInterface) Get(name string, options metav1.GetOptions) (*core.ConfigMap, error) { +func (mock *MockConfigMapsInterface) Get(name string, options metav1.GetOptions) (*v1.ConfigMap, error) { object, ok := mock.objects[name] if !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } return object, nil } // List returns the a of ConfigMaps. -func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*core.ConfigMapList, error) { - var list core.ConfigMapList +func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*v1.ConfigMapList, error) { + var list v1.ConfigMapList for _, cfgmap := range mock.objects { list.Items = append(list.Items, *cfgmap) } @@ -115,20 +116,20 @@ func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*core.Config } // Create creates a new ConfigMap. -func (mock *MockConfigMapsInterface) Create(cfgmap *core.ConfigMap) (*core.ConfigMap, error) { +func (mock *MockConfigMapsInterface) Create(cfgmap *v1.ConfigMap) (*v1.ConfigMap, error) { name := cfgmap.ObjectMeta.Name if object, ok := mock.objects[name]; ok { - return object, apierrors.NewAlreadyExists(core.Resource("tests"), name) + return object, apierrors.NewAlreadyExists(schema.GroupResource{Resource: "tests"}, name) } mock.objects[name] = cfgmap return cfgmap, nil } // Update updates a ConfigMap. -func (mock *MockConfigMapsInterface) Update(cfgmap *core.ConfigMap) (*core.ConfigMap, error) { +func (mock *MockConfigMapsInterface) Update(cfgmap *v1.ConfigMap) (*v1.ConfigMap, error) { name := cfgmap.ObjectMeta.Name if _, ok := mock.objects[name]; !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(v1.Resource("tests"), name) } mock.objects[name] = cfgmap return cfgmap, nil @@ -137,7 +138,7 @@ func (mock *MockConfigMapsInterface) Update(cfgmap *core.ConfigMap) (*core.Confi // Delete deletes a ConfigMap by name. func (mock *MockConfigMapsInterface) Delete(name string, opts *metav1.DeleteOptions) error { if _, ok := mock.objects[name]; !ok { - return apierrors.NewNotFound(core.Resource("tests"), name) + return apierrors.NewNotFound(v1.Resource("tests"), name) } delete(mock.objects, name) return nil @@ -154,14 +155,14 @@ func newTestFixtureSecrets(t *testing.T, releases ...*rspb.Release) *Secrets { // MockSecretsInterface mocks a kubernetes SecretsInterface type MockSecretsInterface struct { - internalversion.SecretInterface + corev1.SecretInterface - objects map[string]*core.Secret + objects map[string]*v1.Secret } // Init initializes the MockSecretsInterface with the set of releases. func (mock *MockSecretsInterface) Init(t *testing.T, releases ...*rspb.Release) { - mock.objects = map[string]*core.Secret{} + mock.objects = map[string]*v1.Secret{} for _, rls := range releases { objkey := testKey(rls.Name, rls.Version) @@ -175,17 +176,17 @@ func (mock *MockSecretsInterface) Init(t *testing.T, releases ...*rspb.Release) } // Get returns the Secret by name. -func (mock *MockSecretsInterface) Get(name string, options metav1.GetOptions) (*core.Secret, error) { +func (mock *MockSecretsInterface) Get(name string, options metav1.GetOptions) (*v1.Secret, error) { object, ok := mock.objects[name] if !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } return object, nil } // List returns the a of Secret. -func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*core.SecretList, error) { - var list core.SecretList +func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*v1.SecretList, error) { + var list v1.SecretList for _, secret := range mock.objects { list.Items = append(list.Items, *secret) } @@ -193,20 +194,20 @@ func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*core.SecretLis } // Create creates a new Secret. -func (mock *MockSecretsInterface) Create(secret *core.Secret) (*core.Secret, error) { +func (mock *MockSecretsInterface) Create(secret *v1.Secret) (*v1.Secret, error) { name := secret.ObjectMeta.Name if object, ok := mock.objects[name]; ok { - return object, apierrors.NewAlreadyExists(core.Resource("tests"), name) + return object, apierrors.NewAlreadyExists(schema.GroupResource{Resource: "tests"}, name) } mock.objects[name] = secret return secret, nil } // Update updates a Secret. -func (mock *MockSecretsInterface) Update(secret *core.Secret) (*core.Secret, error) { +func (mock *MockSecretsInterface) Update(secret *v1.Secret) (*v1.Secret, error) { name := secret.ObjectMeta.Name if _, ok := mock.objects[name]; !ok { - return nil, apierrors.NewNotFound(core.Resource("tests"), name) + return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } mock.objects[name] = secret return secret, nil @@ -215,7 +216,7 @@ func (mock *MockSecretsInterface) Update(secret *core.Secret) (*core.Secret, err // Delete deletes a Secret by name. func (mock *MockSecretsInterface) Delete(name string, opts *metav1.DeleteOptions) error { if _, ok := mock.objects[name]; !ok { - return apierrors.NewNotFound(core.Resource("tests"), name) + return apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name) } delete(mock.objects, name) return nil diff --git a/pkg/storage/driver/records.go b/pkg/storage/driver/records.go index ce72308a8..56d7d694f 100644 --- a/pkg/storage/driver/records.go +++ b/pkg/storage/driver/records.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import ( "github.com/golang/protobuf/proto" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) // records holds a list of in-memory release records @@ -38,7 +39,7 @@ func (rs *records) Add(r *record) error { } if rs.Exists(r.key) { - return ErrReleaseExists(r.key) + return storageerrors.ErrReleaseExists(r.key) } *rs = append(*rs, r) diff --git a/pkg/storage/driver/records_test.go b/pkg/storage/driver/records_test.go index 79380afb8..8063ab9dc 100644 --- a/pkg/storage/driver/records_test.go +++ b/pkg/storage/driver/records_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/driver/secrets.go b/pkg/storage/driver/secrets.go index e8f3984f6..b79a84272 100644 --- a/pkg/storage/driver/secrets.go +++ b/pkg/storage/driver/secrets.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,14 +22,15 @@ import ( "strings" "time" + "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kblabels "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/validation" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion" + corev1 "k8s.io/client-go/kubernetes/typed/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" + storageerrors "k8s.io/helm/pkg/storage/errors" ) var _ Driver = (*Secrets)(nil) @@ -40,13 +41,13 @@ const SecretsDriverName = "Secret" // Secrets is a wrapper around an implementation of a kubernetes // SecretsInterface. type Secrets struct { - impl internalversion.SecretInterface + impl corev1.SecretInterface Log func(string, ...interface{}) } // NewSecrets initializes a new Secrets wrapping an implmenetation of // the kubernetes SecretsInterface. -func NewSecrets(impl internalversion.SecretInterface) *Secrets { +func NewSecrets(impl corev1.SecretInterface) *Secrets { return &Secrets{ impl: impl, Log: func(_ string, _ ...interface{}) {}, @@ -65,7 +66,7 @@ func (secrets *Secrets) Get(key string) (*rspb.Release, error) { obj, err := secrets.impl.Get(key, metav1.GetOptions{}) if err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseNotFound(key) + return nil, storageerrors.ErrReleaseNotFound(key) } secrets.Log("get: failed to get %q: %s", key, err) @@ -131,7 +132,7 @@ func (secrets *Secrets) Query(labels map[string]string) ([]*rspb.Release, error) } if len(list.Items) == 0 { - return nil, ErrReleaseNotFound(labels["NAME"]) + return nil, storageerrors.ErrReleaseNotFound(labels["NAME"]) } var results []*rspb.Release @@ -164,7 +165,7 @@ func (secrets *Secrets) Create(key string, rls *rspb.Release) error { // push the secret object out into the kubiverse if _, err := secrets.impl.Create(obj); err != nil { if apierrors.IsAlreadyExists(err) { - return ErrReleaseExists(rls.Name) + return storageerrors.ErrReleaseExists(rls.Name) } secrets.Log("create: failed to create: %s", err) @@ -202,7 +203,7 @@ func (secrets *Secrets) Delete(key string) (rls *rspb.Release, err error) { // fetch the release to check existence if rls, err = secrets.Get(key); err != nil { if apierrors.IsNotFound(err) { - return nil, ErrReleaseExists(rls.Name) + return nil, storageerrors.ErrReleaseExists(rls.Name) } secrets.Log("delete: failed to get release %q: %s", key, err) @@ -228,7 +229,7 @@ func (secrets *Secrets) Delete(key string) (rls *rspb.Release, err error) { // "OWNER" - owner of the secret, currently "TILLER". // "NAME" - name of the release. // -func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*core.Secret, error) { +func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*v1.Secret, error) { const owner = "TILLER" // encode the release @@ -248,7 +249,7 @@ func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*core.Secret, lbs.set("VERSION", strconv.Itoa(int(rls.Version))) // create and return secret object - return &core.Secret{ + return &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: key, Labels: lbs.toMap(), diff --git a/pkg/storage/driver/secrets_test.go b/pkg/storage/driver/secrets_test.go index e6f62e702..0d7d1ad83 100644 --- a/pkg/storage/driver/secrets_test.go +++ b/pkg/storage/driver/secrets_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -19,7 +19,7 @@ import ( "testing" "github.com/gogo/protobuf/proto" - "k8s.io/kubernetes/pkg/apis/core" + "k8s.io/api/core/v1" rspb "k8s.io/helm/pkg/proto/hapi/release" ) @@ -69,7 +69,7 @@ func TestUNcompressedSecretGet(t *testing.T) { } secret.Data["release"] = []byte(base64.StdEncoding.EncodeToString(b)) var mock MockSecretsInterface - mock.objects = map[string]*core.Secret{key: secret} + mock.objects = map[string]*v1.Secret{key: secret} secrets := NewSecrets(&mock) // get release with key diff --git a/pkg/storage/driver/util.go b/pkg/storage/driver/util.go index 65fb17e7c..7807382b6 100644 --- a/pkg/storage/driver/util.go +++ b/pkg/storage/driver/util.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/storage/errors/errors.go b/pkg/storage/errors/errors.go new file mode 100644 index 000000000..38662d1ca --- /dev/null +++ b/pkg/storage/errors/errors.go @@ -0,0 +1,27 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package errors // import "k8s.io/helm/pkg/storage/errors" +import "fmt" + +var ( + // ErrReleaseNotFound indicates that a release is not found. + ErrReleaseNotFound = func(release string) error { return fmt.Errorf("release: %q not found", release) } + // ErrReleaseExists indicates that a release already exists. + ErrReleaseExists = func(release string) error { return fmt.Errorf("release: %q already exists", release) } + // ErrInvalidKey indicates that a release key could not be parsed. + ErrInvalidKey = func(release string) error { return fmt.Errorf("release: %q invalid key", release) } +) diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 4b39e0bb2..40fc558a1 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -163,7 +163,7 @@ func (s *Storage) History(name string) ([]*rspb.Release, error) { return s.Driver.Query(map[string]string{"NAME": name, "OWNER": "TILLER"}) } -// removeLeastRecent removes items from history until the lengh number of releases +// removeLeastRecent removes items from history until the length number of releases // does not exceed max. // // We allow max to be set explicitly so that calling functions can "make space" diff --git a/pkg/storage/storage_test.go b/pkg/storage/storage_test.go index fb2824de7..19d786ad9 100644 --- a/pkg/storage/storage_test.go +++ b/pkg/storage/storage_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/strvals/doc.go b/pkg/strvals/doc.go index d2b859e67..f17290587 100644 --- a/pkg/strvals/doc.go +++ b/pkg/strvals/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 90670a4dd..532a8c4ac 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -50,6 +50,20 @@ func Parse(s string) (map[string]interface{}, error) { return vals, err } +// ParseFile parses a set line, but its final value is loaded from the file at the path specified by the original value. +// +// A set line is of the form name1=path1,name2=path2 +// +// When the files at path1 and path2 contained "val1" and "val2" respectively, the set line is consumed as +// name1=val1,name2=val2 +func ParseFile(s string, runesToVal runesToVal) (map[string]interface{}, error) { + vals := map[string]interface{}{} + scanner := bytes.NewBufferString(s) + t := newFileParser(scanner, vals, runesToVal) + err := t.parse() + return vals, err +} + // ParseString parses a set line and forces a string value. // // A set line is of the form name1=value1,name2=value2 @@ -71,7 +85,16 @@ func ParseInto(s string, dest map[string]interface{}) error { return t.parse() } -// ParseIntoString parses a strvals line nad merges the result into dest. +// ParseIntoFile parses a filevals line and merges the result into dest. +// +// This method always returns a string as the value. +func ParseIntoFile(s string, dest map[string]interface{}, runesToVal runesToVal) error { + scanner := bytes.NewBufferString(s) + t := newFileParser(scanner, dest, runesToVal) + return t.parse() +} + +// ParseIntoString parses a strvals line and merges the result into dest. // // This method always returns a string as the value. func ParseIntoString(s string, dest map[string]interface{}) error { @@ -87,13 +110,22 @@ func ParseIntoString(s string, dest map[string]interface{}) error { // where data is the final parsed data from the parses with correct types // where st is a boolean to figure out if we're forcing it to parse values as string type parser struct { - sc *bytes.Buffer - data map[string]interface{} - st bool + sc *bytes.Buffer + data map[string]interface{} + runesToVal runesToVal } +type runesToVal func([]rune) (interface{}, error) + func newParser(sc *bytes.Buffer, data map[string]interface{}, stringBool bool) *parser { - return &parser{sc: sc, data: data, st: stringBool} + rs2v := func(rs []rune) (interface{}, error) { + return typedVal(rs, stringBool), nil + } + return &parser{sc: sc, data: data, runesToVal: rs2v} +} + +func newFileParser(sc *bytes.Buffer, data map[string]interface{}, runesToVal runesToVal) *parser { + return &parser{sc: sc, data: data, runesToVal: runesToVal} } func (t *parser) parse() error { @@ -157,8 +189,12 @@ func (t *parser) key(data map[string]interface{}) error { set(data, string(k), "") return e case ErrNotList: - v, e := t.val() - set(data, string(k), typedVal(v, t.st)) + rs, e := t.val() + if e != nil && e != io.EOF { + return e + } + v, e := t.runesToVal(rs) + set(data, string(k), v) return e default: return e @@ -230,8 +266,12 @@ func (t *parser) listItem(list []interface{}, i int) ([]interface{}, error) { case io.EOF: return setIndex(list, i, ""), err case ErrNotList: - v, e := t.val() - return setIndex(list, i, typedVal(v, t.st)), e + rs, e := t.val() + if e != nil && e != io.EOF { + return list, e + } + v, e := t.runesToVal(rs) + return setIndex(list, i, v), e default: return list, e } @@ -279,7 +319,7 @@ func (t *parser) valList() ([]interface{}, error) { list := []interface{}{} stop := runeSet([]rune{',', '}'}) for { - switch v, last, err := runesUntil(t.sc, stop); { + switch rs, last, err := runesUntil(t.sc, stop); { case err != nil: if err == io.EOF { err = errors.New("list must terminate with '}'") @@ -290,10 +330,15 @@ func (t *parser) valList() ([]interface{}, error) { if r, _, e := t.sc.ReadRune(); e == nil && r != ',' { t.sc.UnreadRune() } - list = append(list, typedVal(v, t.st)) - return list, nil + v, e := t.runesToVal(rs) + list = append(list, v) + return list, e case last == ',': - list = append(list, typedVal(v, t.st)) + v, e := t.runesToVal(rs) + if e != nil { + return list, e + } + list = append(list, v) } } } @@ -325,6 +370,11 @@ func inMap(k rune, m map[rune]bool) bool { func typedVal(v []rune, st bool) interface{} { val := string(v) + + if st { + return val + } + if strings.EqualFold(val, "true") { return true } @@ -337,8 +387,8 @@ func typedVal(v []rune, st bool) interface{} { return nil } - // If this value does not start with zero, and not returnString, try parsing it to an int - if !st && len(val) != 0 && val[0] != '0' { + // If this value does not start with zero, try parsing it to an int + if len(val) != 0 && val[0] != '0' { if iv, err := strconv.ParseInt(val, 10, 64); err == nil { return iv } diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index c897cf0a7..e5d878149 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -75,6 +75,16 @@ func TestParseSet(t *testing.T) { expect: map[string]interface{}{"long_int_string": "1234567890"}, err: false, }, + { + str: "boolean=true", + expect: map[string]interface{}{"boolean": "true"}, + err: false, + }, + { + str: "is_null=null", + expect: map[string]interface{}{"is_null": "null"}, + err: false, + }, } tests := []struct { str string @@ -117,6 +127,15 @@ func TestParseSet(t *testing.T) { str: "long_int=1234567890", expect: map[string]interface{}{"long_int": 1234567890}, }, + { + str: "boolean=true", + expect: map[string]interface{}{"boolean": true}, + }, + { + str: "is_null=null", + expect: map[string]interface{}{"is_null": nil}, + err: false, + }, { str: "name1,name2=", err: true, @@ -336,12 +355,13 @@ func TestParseInto(t *testing.T) { "inner2": "value2", }, } - input := "outer.inner1=value1,outer.inner3=value3" + input := "outer.inner1=value1,outer.inner3=value3,outer.inner4=4" expect := map[string]interface{}{ "outer": map[string]interface{}{ "inner1": "value1", "inner2": "value2", "inner3": "value3", + "inner4": 4, }, } @@ -362,6 +382,72 @@ func TestParseInto(t *testing.T) { t.Errorf("%s: Expected:\n%s\nGot:\n%s", input, y1, y2) } } +func TestParseIntoString(t *testing.T) { + got := map[string]interface{}{ + "outer": map[string]interface{}{ + "inner1": "overwrite", + "inner2": "value2", + }, + } + input := "outer.inner1=1,outer.inner3=3" + expect := map[string]interface{}{ + "outer": map[string]interface{}{ + "inner1": "1", + "inner2": "value2", + "inner3": "3", + }, + } + + if err := ParseIntoString(input, got); err != nil { + t.Fatal(err) + } + + y1, err := yaml.Marshal(expect) + if err != nil { + t.Fatal(err) + } + y2, err := yaml.Marshal(got) + if err != nil { + t.Fatalf("Error serializing parsed value: %s", err) + } + + if string(y1) != string(y2) { + t.Errorf("%s: Expected:\n%s\nGot:\n%s", input, y1, y2) + } +} + +func TestParseIntoFile(t *testing.T) { + got := map[string]interface{}{} + input := "name1=path1" + expect := map[string]interface{}{ + "name1": "value1", + } + rs2v := func(rs []rune) (interface{}, error) { + v := string(rs) + if v != "path1" { + t.Errorf("%s: runesToVal: Expected value path1, got %s", input, v) + return "", nil + } + return "value1", nil + } + + if err := ParseIntoFile(input, got, rs2v); err != nil { + t.Fatal(err) + } + + y1, err := yaml.Marshal(expect) + if err != nil { + t.Fatal(err) + } + y2, err := yaml.Marshal(got) + if err != nil { + t.Fatalf("Error serializing parsed value: %s", err) + } + + if string(y1) != string(y2) { + t.Errorf("%s: Expected:\n%s\nGot:\n%s", input, y1, y2) + } +} func TestToYAML(t *testing.T) { // The TestParse does the hard part. We just verify that YAML formatting is diff --git a/pkg/sympath/walk.go b/pkg/sympath/walk.go index 77fa04153..b2500284a 100644 --- a/pkg/sympath/walk.go +++ b/pkg/sympath/walk.go @@ -4,7 +4,7 @@ the BSD license. https://github.com/golang/go/blob/master/LICENSE -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/sympath/walk_test.go b/pkg/sympath/walk_test.go index d86d8dabd..ab8e0eb4c 100644 --- a/pkg/sympath/walk_test.go +++ b/pkg/sympath/walk_test.go @@ -4,7 +4,7 @@ the BSD license. https://github.com/golang/go/blob/master/LICENSE -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index 366fdf522..86d077b89 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,8 +26,8 @@ import ( "io" "time" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/api/core/v1" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/engine" @@ -98,8 +98,6 @@ type Engine interface { type KubeClient interface { // Create creates one or more resources. // - // namespace must contain a valid existing namespace. - // // reader must contain a YAML stream (one or more YAML documents separated // by "\n---\n"). Create(namespace string, reader io.Reader, timeout int64, shouldWait bool) error @@ -142,7 +140,7 @@ type KubeClient interface { // WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase // and returns said phase (PodSucceeded or PodFailed qualify). - WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) + WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) } // PrintingKubeClient implements KubeClient, but simply prints the reader to @@ -194,9 +192,9 @@ func (p *PrintingKubeClient) BuildUnstructured(ns string, reader io.Reader) (kub } // WaitAndGetCompletedPodPhase implements KubeClient WaitAndGetCompletedPodPhase. -func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { +func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { _, err := io.Copy(p.Out, reader) - return core.PodUnknown, err + return v1.PodUnknown, err } // Environment provides the context for executing a client request. diff --git a/pkg/tiller/environment/environment_test.go b/pkg/tiller/environment/environment_test.go index d8c82b901..5c19a9b21 100644 --- a/pkg/tiller/environment/environment_test.go +++ b/pkg/tiller/environment/environment_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/api/core/v1" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/kube" @@ -61,11 +61,11 @@ func (k *mockKubeClient) Build(ns string, reader io.Reader) (kube.Result, error) func (k *mockKubeClient) BuildUnstructured(ns string, reader io.Reader) (kube.Result, error) { return []*resource.Info{}, nil } -func (k *mockKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodUnknown, nil +func (k *mockKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodUnknown, nil } -func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { +func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { return "", nil } diff --git a/pkg/tiller/hook_sorter.go b/pkg/tiller/hook_sorter.go index 42d546620..11fa61533 100644 --- a/pkg/tiller/hook_sorter.go +++ b/pkg/tiller/hook_sorter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/hook_sorter_test.go b/pkg/tiller/hook_sorter_test.go index ac5b9bf8d..efe960ca4 100644 --- a/pkg/tiller/hook_sorter_test.go +++ b/pkg/tiller/hook_sorter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/hooks.go b/pkg/tiller/hooks.go index 2dd085ed7..0fb7c92f8 100644 --- a/pkg/tiller/hooks.go +++ b/pkg/tiller/hooks.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import ( "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/hooks" + "k8s.io/helm/pkg/manifest" "k8s.io/helm/pkg/proto/hapi/release" util "k8s.io/helm/pkg/releaseutil" ) @@ -53,11 +54,7 @@ var deletePolices = map[string]release.Hook_DeletePolicy{ } // Manifest represents a manifest file, which has a name and some content. -type Manifest struct { - Name string - Content string - Head *util.SimpleHead -} +type Manifest = manifest.Manifest type result struct { hooks []*release.Hook diff --git a/pkg/tiller/hooks_test.go b/pkg/tiller/hooks_test.go index 658f859f4..8bd928500 100644 --- a/pkg/tiller/hooks_test.go +++ b/pkg/tiller/hooks_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index 43726d53e..8aff4e6c1 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ var InstallOrder SortOrder = []string{ "ResourceQuota", "LimitRange", "PodSecurityPolicy", + "PodDisruptionBudget", "Secret", "ConfigMap", "StorageClass", @@ -81,6 +82,7 @@ var UninstallOrder SortOrder = []string{ "StorageClass", "ConfigMap", "Secret", + "PodDisruptionBudget", "PodSecurityPolicy", "LimitRange", "ResourceQuota", diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index 8d01fac17..1c187e90d 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -133,6 +133,10 @@ func TestKindSorter(t *testing.T) { Name: "w", Head: &util.SimpleHead{Kind: "APIService"}, }, + { + Name: "z", + Head: &util.SimpleHead{Kind: "PodDisruptionBudget"}, + }, } for _, test := range []struct { @@ -140,8 +144,8 @@ func TestKindSorter(t *testing.T) { order SortOrder expected string }{ - {"install", InstallOrder, "abc3de1fgh2ijklmnopqrstuvw!"}, - {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1ed3cba!"}, + {"install", InstallOrder, "abc3zde1fgh2ijklmnopqrstuvw!"}, + {"uninstall", UninstallOrder, "wvmutsrqponlkji2hgf1edz3cba!"}, } { var buf bytes.Buffer t.Run(test.description, func(t *testing.T) { diff --git a/pkg/tiller/release_content.go b/pkg/tiller/release_content.go index fd783d6b6..2315f1aaa 100644 --- a/pkg/tiller/release_content.go +++ b/pkg/tiller/release_content.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_content_test.go b/pkg/tiller/release_content_test.go index 7c003f709..4a29c5d3e 100644 --- a/pkg/tiller/release_content_test.go +++ b/pkg/tiller/release_content_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_history.go b/pkg/tiller/release_history.go index 0dd525978..fe7ad1395 100644 --- a/pkg/tiller/release_history.go +++ b/pkg/tiller/release_history.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_history_test.go b/pkg/tiller/release_history_test.go index 5df98410f..58b7fad9a 100644 --- a/pkg/tiller/release_history_test.go +++ b/pkg/tiller/release_history_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index d7781c0d9..3cfbcf30e 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -250,7 +250,11 @@ func (s *ReleaseServer) performRelease(r *release.Release, req *services.Install } r.Info.Status.Code = release.Status_DEPLOYED - r.Info.Description = "Install complete" + if req.Description == "" { + r.Info.Description = "Install complete" + } else { + r.Info.Description = req.Description + } // This is a tricky case. The release has been created, but the result // cannot be recorded. The truest thing to tell the user is that the // release was created. However, the user will not be able to do anything diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index 1d1b08e90..78d00ce66 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -528,3 +528,23 @@ func TestInstallRelease_WrongKubeVersion(t *testing.T) { t.Errorf("Expected %q to contain %q", err.Error(), expect) } } + +func TestInstallRelease_Description(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + customDescription := "foo" + req := &services.InstallReleaseRequest{ + Chart: chartStub(), + Description: customDescription, + } + res, err := rs.InstallRelease(c, req) + if err != nil { + t.Errorf("Failed install: %s", err) + } + + if desc := res.Release.Info.Description; desc != customDescription { + t.Errorf("Expected description %q. Got %q", customDescription, desc) + } +} diff --git a/pkg/tiller/release_list.go b/pkg/tiller/release_list.go index 72c21d97c..3299d3ef2 100644 --- a/pkg/tiller/release_list.go +++ b/pkg/tiller/release_list.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,11 +18,12 @@ package tiller import ( "fmt" + "regexp" + "github.com/golang/protobuf/proto" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" relutil "k8s.io/helm/pkg/releaseutil" - "regexp" ) // ListReleases lists the releases found by the server. @@ -65,6 +66,8 @@ func (s *ReleaseServer) ListReleases(req *services.ListReleasesRequest, stream s relutil.SortByName(rels) case services.ListSort_LAST_RELEASED: relutil.SortByDate(rels) + case services.ListSort_CHART_NAME: + relutil.SortByChartName(rels) } if req.SortOrder == services.ListSort_DESC { @@ -138,7 +141,7 @@ func (s *ReleaseServer) partition(rels []*release.Release, cap int) <-chan []*re s.Log("partitioned at %d with %d releases (cap=%d)", fill, len(chunk), cap) chunks <- chunk // reset paritioning state - chunk = chunk[:0] + chunk = nil fill = 0 } chunk = append(chunk, rls) diff --git a/pkg/tiller/release_list_test.go b/pkg/tiller/release_list_test.go index 64877422a..f2d19cf96 100644 --- a/pkg/tiller/release_list_test.go +++ b/pkg/tiller/release_list_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import ( "fmt" "testing" + "k8s.io/helm/pkg/proto/hapi/chart" "k8s.io/helm/pkg/proto/hapi/release" "k8s.io/helm/pkg/proto/hapi/services" ) @@ -147,6 +148,48 @@ func TestListReleasesSort(t *testing.T) { } } +func TestListReleasesSortByChartName(t *testing.T) { + rs := rsFixture() + + // Put them in by reverse order so that the mock doesn't "accidentally" + // sort. + num := 7 + for i := num; i > 0; i-- { + rel := releaseStub() + rel.Name = fmt.Sprintf("rel-%d", num-i) + rel.Chart = &chart.Chart{ + Metadata: &chart.Metadata{ + Name: fmt.Sprintf("chartName-%d", i), + }, + } + if err := rs.env.Releases.Create(rel); err != nil { + t.Fatalf("Could not store mock release: %s", err) + } + } + + limit := 6 + mrs := &mockListServer{} + req := &services.ListReleasesRequest{ + Offset: "", + Limit: int64(limit), + SortBy: services.ListSort_CHART_NAME, + } + if err := rs.ListReleases(req, mrs); err != nil { + t.Fatalf("Failed listing: %s", err) + } + + if len(mrs.val.Releases) != limit { + t.Errorf("Expected %d releases, got %d", limit, len(mrs.val.Releases)) + } + + for i := 0; i < limit; i++ { + n := fmt.Sprintf("chartName-%d", i+1) + if mrs.val.Releases[i].Chart.Metadata.Name != n { + t.Errorf("Expected %q, got %q", n, mrs.val.Releases[i].Chart.Metadata.Name) + } + } +} + func TestListReleasesFilter(t *testing.T) { rs := rsFixture() names := []string{ @@ -231,3 +274,26 @@ func TestReleasesNamespace(t *testing.T) { t.Errorf("Expected 2 releases, got %d", len(mrs.val.Releases)) } } + +func TestReleasePartition(t *testing.T) { + var rl []*release.Release + rs := rsFixture() + rs.Log = t.Logf + num := 7 + for i := 0; i < num; i++ { + rel := releaseStub() + rel.Name = fmt.Sprintf("rel-%d", i) + rl = append(rl, rel) + } + visited := map[string]bool{} + + chunks := rs.partition(rl, 0) + for chunk := range chunks { + for _, rel := range chunk { + if visited[rel.Name] { + t.Errorf("%s was already visited", rel.Name) + } + visited[rel.Name] = true + } + } +} diff --git a/pkg/tiller/release_modules.go b/pkg/tiller/release_modules.go index 876e1ba37..9a8c66e96 100644 --- a/pkg/tiller/release_modules.go +++ b/pkg/tiller/release_modules.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import ( "log" "strings" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/kube" @@ -46,7 +46,7 @@ type ReleaseModule interface { // LocalReleaseModule is a local implementation of ReleaseModule type LocalReleaseModule struct { - clientset internalclientset.Interface + clientset kubernetes.Interface } // Create creates a release via kubeclient from provided environment diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index fa3d943f4..75e282fb8 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -86,6 +86,11 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* return nil, nil, err } + description := req.Description + if req.Description == "" { + description = fmt.Sprintf("Rollback to %d", previousVersion) + } + // Store a new release object with previous release's configuration targetRelease := &release.Release{ Name: req.Name, @@ -101,7 +106,7 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* }, // Because we lose the reference to previous version elsewhere, we set the // message here, and only override it later if we experience failure. - Description: fmt.Sprintf("Rollback to %d", previousVersion), + Description: description, }, Version: currentRelease.Version + 1, Manifest: previousRelease.Manifest, diff --git a/pkg/tiller/release_rollback_test.go b/pkg/tiller/release_rollback_test.go index b73501a36..d7909ed8b 100644 --- a/pkg/tiller/release_rollback_test.go +++ b/pkg/tiller/release_rollback_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -252,3 +252,35 @@ func TestRollbackReleaseFailure(t *testing.T) { t.Errorf("Expected SUPERSEDED status on previous Release version. Got %v", oldStatus) } } + +func TestRollbackReleaseWithCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + upgradedRel := upgradeReleaseVersion(rel) + rs.env.Releases.Update(rel) + rs.env.Releases.Create(upgradedRel) + + customDescription := "foo" + req := &services.RollbackReleaseRequest{ + Name: rel.Name, + Description: customDescription, + } + res, err := rs.RollbackRelease(c, req) + if err != nil { + t.Fatalf("Failed rollback: %s", err) + } + + if res.Release.Name == "" { + t.Errorf("Expected release name.") + } + + if res.Release.Name != rel.Name { + t.Errorf("Updated release name does not match previous release name. Expected %s, got %s", rel.Name, res.Release.Name) + } + + if res.Release.Info.Description != customDescription { + t.Errorf("Expected Description to be %q, got %q", customDescription, res.Release.Info.Description) + } +} diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 29379d374..8fb897b83 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ import ( "gopkg.in/yaml.v2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/discovery" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" + "k8s.io/client-go/kubernetes" "k8s.io/helm/pkg/chartutil" "k8s.io/helm/pkg/hooks" @@ -83,12 +83,12 @@ var ValidName = regexp.MustCompile("^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+ type ReleaseServer struct { ReleaseModule env *environment.Environment - clientset internalclientset.Interface + clientset kubernetes.Interface Log func(string, ...interface{}) } // NewReleaseServer creates a new release server. -func NewReleaseServer(env *environment.Environment, clientset internalclientset.Interface, useRemote bool) *ReleaseServer { +func NewReleaseServer(env *environment.Environment, clientset kubernetes.Interface, useRemote bool) *ReleaseServer { var releaseModule ReleaseModule if useRemote { releaseModule = &RemoteReleaseModule{} @@ -138,7 +138,13 @@ func (s *ReleaseServer) reuseValues(req *services.UpdateReleaseRequest, current } // merge new values with current - req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw + if current.Config != nil && current.Config.Raw != "" && current.Config.Raw != "{}\n" { + if req.Values.Raw != "{}\n" { + req.Values.Raw = current.Config.Raw + "\n" + req.Values.Raw + } else { + req.Values.Raw = current.Config.Raw + "\n" + } + } req.Chart.Values = &chart.Config{Raw: nv} // yaml unmarshal and marshal to remove duplicate keys @@ -190,21 +196,34 @@ func (s *ReleaseServer) uniqName(start string, reuse bool) (string, error) { s.Log("name %s exists but is not in use, reusing name", start) return start, nil } else if reuse { - return "", errors.New("cannot re-use a name that is still in use") + return "", fmt.Errorf("a released named %s is in use, cannot re-use a name that is still in use", start) } return "", fmt.Errorf("a release named %s already exists.\nRun: helm ls --all %s; to check the status of the release\nOr run: helm del --purge %s; to delete it", start, start, start) } + moniker := moniker.New() + newname, err := s.createUniqName(moniker) + if err != nil { + return "ERROR", err + } + + s.Log("info: Created new release name %s", newname) + return newname, nil + +} + +func (s *ReleaseServer) createUniqName(m moniker.Namer) (string, error) { maxTries := 5 for i := 0; i < maxTries; i++ { - namer := moniker.New() - name := namer.NameSep("-") + name := m.NameSep("-") if len(name) > releaseNameMaxLen { name = name[:releaseNameMaxLen] } - if _, err := s.env.Releases.Get(name, 1); strings.Contains(err.Error(), "not found") { - return name, nil + if _, err := s.env.Releases.Get(name, 1); err != nil { + if strings.Contains(err.Error(), "not found") { + return name, nil + } } s.Log("info: generated name %s is taken. Searching again.", name) } diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index 78c16e679..78452981e 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -28,11 +28,12 @@ import ( "github.com/ghodss/yaml" "github.com/golang/protobuf/ptypes/timestamp" + "github.com/technosophos/moniker" "golang.org/x/net/context" "google.golang.org/grpc/metadata" - "k8s.io/kubernetes/pkg/apis/core" - "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake" - "k8s.io/kubernetes/pkg/kubectl/resource" + "k8s.io/api/core/v1" + "k8s.io/cli-runtime/pkg/genericclioptions/resource" + "k8s.io/client-go/kubernetes/fake" "k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/hooks" @@ -112,24 +113,16 @@ data: name: value ` -func rsFixture() *ReleaseServer { - clientset := fake.NewSimpleClientset() - return &ReleaseServer{ - ReleaseModule: &LocalReleaseModule{ - clientset: clientset, - }, - env: MockEnvironment(), - clientset: clientset, - Log: func(_ string, _ ...interface{}) {}, - } -} - type chartOptions struct { *chart.Chart } type chartOption func(*chartOptions) +func rsFixture() *ReleaseServer { + return NewReleaseServer(MockEnvironment(), fake.NewSimpleClientset(), false) +} + func buildChart(opts ...chartOption) *chart.Chart { c := &chartOptions{ Chart: &chart.Chart{ @@ -394,6 +387,62 @@ func TestUniqName(t *testing.T) { } } +type fakeNamer struct { + name string +} + +func NewFakeNamer(nam string) moniker.Namer { + return &fakeNamer{ + name: nam, + } +} + +func (f *fakeNamer) Name() string { + return f.NameSep(" ") +} + +func (f *fakeNamer) NameSep(sep string) string { + return f.name +} + +func TestCreateUniqueName(t *testing.T) { + rs := rsFixture() + + rel1 := releaseStub() + rel1.Name = "happy-panda" + + rs.env.Releases.Create(rel1) + + tests := []struct { + name string + expect string + err bool + }{ + {"happy-panda", "ERROR", true}, + {"wobbly-octopus", "[a-z]+-[a-z]+", false}, + } + + for _, tt := range tests { + m := NewFakeNamer(tt.name) + u, err := rs.createUniqName(m) + if err != nil { + if tt.err { + continue + } + t.Fatal(err) + } + if tt.err { + t.Errorf("Expected an error for %q", tt.name) + } + if match, err := regexp.MatchString(tt.expect, u); err != nil { + t.Fatal(err) + } else if !match { + t.Errorf("Expected %q to match %q", u, tt.expect) + } + } + +} + func releaseWithKeepStub(rlsName string) *release.Release { ch := &chart.Chart{ Metadata: &chart.Metadata{ @@ -562,8 +611,8 @@ func (kc *mockHooksKubeClient) Build(ns string, reader io.Reader) (kube.Result, func (kc *mockHooksKubeClient) BuildUnstructured(ns string, reader io.Reader) (kube.Result, error) { return []*resource.Info{}, nil } -func (kc *mockHooksKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) { - return core.PodUnknown, nil +func (kc *mockHooksKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) { + return v1.PodUnknown, nil } func deletePolicyStub(kubeClient *mockHooksKubeClient) *ReleaseServer { diff --git a/pkg/tiller/release_status.go b/pkg/tiller/release_status.go index e0d75877d..3f8047118 100644 --- a/pkg/tiller/release_status.go +++ b/pkg/tiller/release_status.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_status_test.go b/pkg/tiller/release_status_test.go index 4ba0f6cd5..69a710143 100644 --- a/pkg/tiller/release_status_test.go +++ b/pkg/tiller/release_status_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_testing.go b/pkg/tiller/release_testing.go index a44b67e6f..06d41e323 100644 --- a/pkg/tiller/release_testing.go +++ b/pkg/tiller/release_testing.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_testing_test.go b/pkg/tiller/release_testing_test.go index f8d92ebcc..e0fc7df41 100644 --- a/pkg/tiller/release_testing_test.go +++ b/pkg/tiller/release_testing_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/release_uninstall.go b/pkg/tiller/release_uninstall.go index 423b6e7ef..2ae3e4c36 100644 --- a/pkg/tiller/release_uninstall.go +++ b/pkg/tiller/release_uninstall.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -97,7 +97,11 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR } rel.Info.Status.Code = release.Status_DELETED - rel.Info.Description = "Deletion complete" + if req.Description == "" { + rel.Info.Description = "Deletion complete" + } else { + rel.Info.Description = req.Description + } if req.Purge { s.Log("purge requested for %s", req.Name) diff --git a/pkg/tiller/release_uninstall_test.go b/pkg/tiller/release_uninstall_test.go index 20bfd2486..d33e9c2a6 100644 --- a/pkg/tiller/release_uninstall_test.go +++ b/pkg/tiller/release_uninstall_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -176,3 +176,24 @@ func TestUninstallReleaseNoHooks(t *testing.T) { t.Errorf("Expected LastRun to be zero, got %d.", res.Release.Hooks[0].LastRun.Seconds) } } + +func TestUninstallReleaseCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + customDescription := "foo" + req := &services.UninstallReleaseRequest{ + Name: "angry-panda", + Description: "foo", + } + + res, err := rs.UninstallRelease(c, req) + if err != nil { + t.Errorf("Failed uninstall: %s", err) + } + + if res.Release.Info.Description != customDescription { + t.Errorf("Expected description to be %q, got %q", customDescription, res.Release.Info.Description) + } +} diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index c4e4820e7..2f5dc24b4 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -150,6 +150,8 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return nil, err } + res := &services.UpdateReleaseResponse{} + newRelease, err := s.prepareRelease(&services.InstallReleaseRequest{ Chart: req.Chart, Values: req.Values, @@ -161,7 +163,6 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( Timeout: req.Timeout, Wait: req.Wait, }) - res := &services.UpdateReleaseResponse{Release: newRelease} if err != nil { s.Log("failed update prepare step: %s", err) // On dry run, append the manifest contents to a failed release. This is @@ -172,6 +173,16 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( return res, err } + // update new release with next revision number so as to append to the old release's history + newRelease.Version = oldRelease.Version + 1 + res.Release = newRelease + + if req.DryRun { + s.Log("dry run for %s", newRelease.Name) + res.Release.Info.Description = "Dry run complete" + return res, nil + } + // From here on out, the release is considered to be in Status_DELETING or Status_DELETED // state. There is no turning back. oldRelease.Info.Status.Code = release.Status_DELETING @@ -218,8 +229,6 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( } } - // update new release with next revision number so as to append to the old release's history - newRelease.Version = oldRelease.Version + 1 s.recordRelease(newRelease, false) if err := s.ReleaseModule.Update(oldRelease, newRelease, req, s.env); err != nil { msg := fmt.Sprintf("Upgrade %q failed: %s", newRelease.Name, err) @@ -243,7 +252,11 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( } newRelease.Info.Status.Code = release.Status_DEPLOYED - newRelease.Info.Description = "Upgrade complete" + if req.Description == "" { + newRelease.Info.Description = "Upgrade complete" + } else { + newRelease.Info.Description = req.Description + } s.recordRelease(newRelease, true) return res, nil @@ -287,7 +300,11 @@ func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.R s.recordRelease(originalRelease, true) updatedRelease.Info.Status.Code = release.Status_DEPLOYED - updatedRelease.Info.Description = "Upgrade complete" + if req.Description == "" { + updatedRelease.Info.Description = "Upgrade complete" + } else { + updatedRelease.Info.Description = req.Description + } return res, nil } diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index a1b9a4bff..81fad0bc4 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -129,6 +129,45 @@ func TestUpdateRelease_ResetValues(t *testing.T) { } } +func TestUpdateRelease_ReuseValuesWithNoValues(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + + installReq := &services.InstallReleaseRequest{ + Namespace: "spaced", + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + {Name: "templates/hooks", Data: []byte(manifestWithHook)}, + }, + Values: &chart.Config{Raw: "defaultFoo: defaultBar"}, + }, + } + + installResp, err := rs.InstallRelease(c, installReq) + if err != nil { + t.Fatal(err) + } + + rel := installResp.Release + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: &chart.Chart{ + Metadata: &chart.Metadata{Name: "hello"}, + Templates: []*chart.Template{ + {Name: "templates/hello", Data: []byte("hello: world")}, + }, + }, + Values: &chart.Config{Raw: "{}\n"}, + ReuseValues: true, + } + + if _, err := rs.UpdateRelease(c, req); err != nil { + t.Fatalf("Failed updated: %s", err) + } +} + // This is a regression test for bug found in issue #3655 func TestUpdateRelease_ComplexReuseValues(t *testing.T) { c := helm.NewContext() @@ -432,6 +471,79 @@ func TestUpdateReleaseNoChanges(t *testing.T) { } } +func TestUpdateReleaseCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + + customDescription := "foo" + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Description: customDescription, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + if res.Release.Info.Description != customDescription { + t.Errorf("Expected release description to be %q, got %q", customDescription, res.Release.Info.Description) + } + compareStoredAndReturnedRelease(t, *rs, *res) +} + +func TestUpdateReleaseCustomDescription_Force(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + + customDescription := "foo" + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Force: true, + Description: customDescription, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + if res.Release.Info.Description != customDescription { + t.Errorf("Expected release description to be %q, got %q", customDescription, res.Release.Info.Description) + } + compareStoredAndReturnedRelease(t, *rs, *res) +} + +func TestUpdateReleasePendingInstall_Force(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := namedReleaseStub("forceful-luke", release.Status_PENDING_INSTALL) + rs.env.Releases.Create(rel) + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Force: true, + } + + _, err := rs.UpdateRelease(c, req) + if err == nil { + t.Error("Expected failed update") + } + + expectedError := "a released named forceful-luke is in use, cannot re-use a name that is still in use" + got := err.Error() + if err.Error() != expectedError { + t.Errorf("Expected error %q, got %q", expectedError, got) + } +} + func compareStoredAndReturnedRelease(t *testing.T, rs ReleaseServer, res services.UpdateReleaseResponse) *release.Release { storedRelease, err := rs.env.Releases.Get(res.Release.Name, res.Release.Version) if err != nil { diff --git a/pkg/tiller/release_version.go b/pkg/tiller/release_version.go index 66b7137bb..0656a1ab9 100644 --- a/pkg/tiller/release_version.go +++ b/pkg/tiller/release_version.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/resource_policy.go b/pkg/tiller/resource_policy.go index 66da1283f..cca2391d8 100644 --- a/pkg/tiller/resource_policy.go +++ b/pkg/tiller/resource_policy.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tiller/server.go b/pkg/tiller/server.go index 818cfd47a..0fbcd4533 100644 --- a/pkg/tiller/server.go +++ b/pkg/tiller/server.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/timeconv/doc.go b/pkg/timeconv/doc.go index 235167391..0565a45cd 100644 --- a/pkg/timeconv/doc.go +++ b/pkg/timeconv/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/timeconv/timeconv.go b/pkg/timeconv/timeconv.go index 24ff10f4e..4d11abfe6 100644 --- a/pkg/timeconv/timeconv.go +++ b/pkg/timeconv/timeconv.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/timeconv/timeconv_test.go b/pkg/timeconv/timeconv_test.go index f673df3c9..bd22a238d 100644 --- a/pkg/timeconv/timeconv_test.go +++ b/pkg/timeconv/timeconv_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tlsutil/cfg.go b/pkg/tlsutil/cfg.go index 9ce3109e1..2c1dfd340 100644 --- a/pkg/tlsutil/cfg.go +++ b/pkg/tlsutil/cfg.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -33,6 +33,9 @@ type Options struct { CertFile string // Client-only options InsecureSkipVerify bool + // Overrides the server name used to verify the hostname on the returned + // certificates from the server. + ServerName string // Server-only options ClientAuth tls.ClientAuthType } @@ -55,8 +58,12 @@ func ClientConfig(opts Options) (cfg *tls.Config, err error) { return nil, err } } - - cfg = &tls.Config{InsecureSkipVerify: opts.InsecureSkipVerify, Certificates: []tls.Certificate{*cert}, RootCAs: pool} + cfg = &tls.Config{ + InsecureSkipVerify: opts.InsecureSkipVerify, + Certificates: []tls.Certificate{*cert}, + ServerName: opts.ServerName, + RootCAs: pool, + } return cfg, nil } diff --git a/pkg/tlsutil/tls.go b/pkg/tlsutil/tls.go index c166a1662..6b0052acc 100644 --- a/pkg/tlsutil/tls.go +++ b/pkg/tlsutil/tls.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/tlsutil/tlsutil_test.go b/pkg/tlsutil/tlsutil_test.go index 4f04d50ab..a4b3c9c22 100644 --- a/pkg/tlsutil/tlsutil_test.go +++ b/pkg/tlsutil/tlsutil_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/urlutil/urlutil.go b/pkg/urlutil/urlutil.go index fb67708ae..272907de0 100644 --- a/pkg/urlutil/urlutil.go +++ b/pkg/urlutil/urlutil.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/urlutil/urlutil_test.go b/pkg/urlutil/urlutil_test.go index b3a142392..b2af24e63 100644 --- a/pkg/urlutil/urlutil_test.go +++ b/pkg/urlutil/urlutil_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/compatible.go b/pkg/version/compatible.go index 735610778..d0516a9d0 100644 --- a/pkg/version/compatible.go +++ b/pkg/version/compatible.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/compatible_test.go b/pkg/version/compatible_test.go index adc1c489e..7a3b23a7d 100644 --- a/pkg/version/compatible_test.go +++ b/pkg/version/compatible_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/doc.go b/pkg/version/doc.go index 23c9e500d..3b61dd50e 100644 --- a/pkg/version/doc.go +++ b/pkg/version/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/version/version.go b/pkg/version/version.go index 6f5a1a452..dae739500 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ var ( // Increment major number for new feature additions and behavioral changes. // Increment minor number for bug fixes and performance enhancements. // Increment patch number for critical fixes to existing releases. - Version = "v2.8" + Version = "v2.11" // BuildMetadata is extra build time data BuildMetadata = "unreleased" diff --git a/pkg/version/version_test.go b/pkg/version/version_test.go index e0e4cac0f..eba573533 100644 --- a/pkg/version/version_test.go +++ b/pkg/version/version_test.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors All rights reserved. +Copyright The Helm Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index ca5ad2225..82dfa0d4c 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2016 The Kubernetes Authors. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,13 +14,14 @@ FROM alpine:3.7 -RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* +RUN apk update && apk add ca-certificates socat && rm -rf /var/cache/apk/* ENV HOME /tmp -COPY tiller /bin/tiller +COPY helm /helm +COPY tiller /tiller EXPOSE 44134 USER nobody -ENTRYPOINT ["/bin/tiller"] +ENTRYPOINT ["/tiller"] diff --git a/rootfs/Dockerfile.experimental b/rootfs/Dockerfile.experimental index 66a218477..ca0c87f30 100644 --- a/rootfs/Dockerfile.experimental +++ b/rootfs/Dockerfile.experimental @@ -1,4 +1,4 @@ -# Copyright 2017 The Kubernetes Authors. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* ENV HOME /tmp -COPY tiller /bin/tiller +COPY tiller /tiller EXPOSE 44134 USER nobody -ENTRYPOINT ["/bin/tiller", "--experimental-release"] +ENTRYPOINT ["/tiller", "--experimental-release"] diff --git a/rootfs/Dockerfile.rudder b/rootfs/Dockerfile.rudder index 6bb3a2d92..61afb8af8 100644 --- a/rootfs/Dockerfile.rudder +++ b/rootfs/Dockerfile.rudder @@ -1,4 +1,4 @@ -# Copyright 2017 The Kubernetes Authors. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 1863d5835..62d495769 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/get b/scripts/get index af0960abf..40fb2f69f 100755 --- a/scripts/get +++ b/scripts/get @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ # the package manager for Go: https://github.com/Masterminds/glide.sh/blob/master/get PROJECT_NAME="helm" +TILLER_NAME="tiller" +USE_SUDO="true" : ${HELM_INSTALL_DIR:="/usr/local/bin"} @@ -50,7 +52,7 @@ initOS() { runAsRoot() { local CMD="$*" - if [ $EUID -ne 0 ]; then + if [ $EUID -ne 0 -a $USE_SUDO = "true" ]; then CMD="sudo $CMD" fi @@ -63,7 +65,7 @@ verifySupported() { local supported="darwin-386\ndarwin-amd64\nlinux-386\nlinux-amd64\nlinux-arm\nlinux-arm64\nlinux-ppc64le\nwindows-386\nwindows-amd64" if ! echo "${supported}" | grep -q "${OS}-${ARCH}"; then echo "No prebuilt binary for ${OS}-${ARCH}." - echo "To build from source, go to https://github.com/kubernetes/helm" + echo "To build from source, go to https://github.com/helm/helm" exit 1 fi @@ -76,11 +78,11 @@ verifySupported() { # checkDesiredVersion checks if the desired version is available. checkDesiredVersion() { # Use the GitHub releases webpage for the project to find the desired version for this project. - local release_url="https://github.com/kubernetes/helm/releases/${DESIRED_VERSION:-latest}" + local release_url="https://github.com/helm/helm/releases/${DESIRED_VERSION:-latest}" if type "curl" > /dev/null; then - TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') + TAG=$(curl -SsL $release_url | awk '/\/tag\//' | grep -v no-underline | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') elif type "wget" > /dev/null; then - TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | grep -v no-underline | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') + TAG=$(wget -q -O - $release_url | awk '/\/tag\//' | grep -v no-underline | head -n 1 | cut -d '"' -f 2 | awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}') fi if [ "x$TAG" == "x" ]; then echo "Cannot determine ${DESIRED_VERSION} tag." @@ -141,8 +143,16 @@ installFile() { mkdir -p "$HELM_TMP" tar xf "$HELM_TMP_FILE" -C "$HELM_TMP" HELM_TMP_BIN="$HELM_TMP/$OS-$ARCH/$PROJECT_NAME" - echo "Preparing to install into ${HELM_INSTALL_DIR}" + TILLER_TMP_BIN="$HELM_TMP/$OS-$ARCH/$TILLER_NAME" + echo "Preparing to install $PROJECT_NAME and $TILLER_NAME into ${HELM_INSTALL_DIR}" runAsRoot cp "$HELM_TMP_BIN" "$HELM_INSTALL_DIR" + echo "$PROJECT_NAME installed into $HELM_INSTALL_DIR/$PROJECT_NAME" + if [ -x "$TILLER_TMP_BIN" ]; then + runAsRoot cp "$TILLER_TMP_BIN" "$HELM_INSTALL_DIR" + echo "$TILLER_NAME installed into $HELM_INSTALL_DIR/$TILLER_NAME" + else + echo "info: $TILLER_NAME binary was not found in this release; skipping $TILLER_NAME installation" + fi } # fail_trap is executed if an error occurs. @@ -155,7 +165,7 @@ fail_trap() { else echo "Failed to install $PROJECT_NAME" fi - echo -e "\tFor support, go to https://github.com/kubernetes/helm." + echo -e "\tFor support, go to https://github.com/helm/helm." fi cleanup exit $result @@ -164,7 +174,6 @@ fail_trap() { # testVersion tests the installed client to make sure it is working. testVersion() { set +e - echo "$PROJECT_NAME installed into $HELM_INSTALL_DIR/$PROJECT_NAME" HELM="$(which $PROJECT_NAME)" if [ "$?" = "1" ]; then echo "$PROJECT_NAME not found. Is $HELM_INSTALL_DIR on your "'$PATH?' @@ -180,9 +189,10 @@ help () { echo -e "\t[--help|-h ] ->> prints this help" echo -e "\t[--version|-v ] . When not defined it defaults to latest" echo -e "\te.g. --version v2.4.0 or -v latest" + echo -e "\t[--no-sudo] ->> install without sudo" } -# cleanup temporary files to avoid https://github.com/kubernetes/helm/issues/2977 +# cleanup temporary files to avoid https://github.com/helm/helm/issues/2977 cleanup() { if [[ -d "${HELM_TMP_ROOT:-}" ]]; then rm -rf "$HELM_TMP_ROOT" @@ -209,6 +219,9 @@ while [[ $# -gt 0 ]]; do exit 0 fi ;; + '--no-sudo') + USE_SUDO="false" + ;; '--help'|-h) help exit 0 diff --git a/scripts/sync-repo.sh b/scripts/sync-repo.sh index 3795b1a7c..453102072 100755 --- a/scripts/sync-repo.sh +++ b/scripts/sync-repo.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/update-docs.sh b/scripts/update-docs.sh index e014b537e..d3018be50 100755 --- a/scripts/update-docs.sh +++ b/scripts/update-docs.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2017 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/util.sh b/scripts/util.sh index 09caaf972..c1e6c3751 100644 --- a/scripts/util.sh +++ b/scripts/util.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/validate-go.sh b/scripts/validate-go.sh index 2ecf5dfb3..328ce40f9 100755 --- a/scripts/validate-go.sh +++ b/scripts/validate-go.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/validate-license.sh b/scripts/validate-license.sh index fe7ec481b..12c76f75c 100755 --- a/scripts/validate-license.sh +++ b/scripts/validate-license.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2016 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,10 +27,19 @@ find_files() { \( -name '*.go' -o -name '*.sh' -o -name 'Dockerfile' \) } -failed=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License");')) -if (( ${#failed[@]} > 0 )); then +failed_license_header=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License");')) +if (( ${#failed_license_header[@]} > 0 )); then echo "Some source files are missing license headers." - for f in "${failed[@]}"; do + for f in "${failed_license_header[@]}"; do + echo " $f" + done + exit 1 +fi + +failed_copyright_header=($(find_files | xargs grep -L 'Copyright The Helm Authors.')) +if (( ${#failed_copyright_header[@]} > 0 )); then + echo "Some source files are missing the copyright header." + for f in "${failed_copyright_header[@]}"; do echo " $f" done exit 1 diff --git a/scripts/verify-docs.sh b/scripts/verify-docs.sh index b0b799eac..b176b036e 100755 --- a/scripts/verify-docs.sh +++ b/scripts/verify-docs.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2017 The Kubernetes Authors All rights reserved. +# Copyright The Helm Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.