Skip to content

Commit

Permalink
Add more capabilities to the detault set used by helm template
Browse files Browse the repository at this point in the history
- These are the capabilities as of k8s 1.14
- They are generated because getting them at runtime uses so much
  memory it causes CI errors

Signed-off-by: Matt Farina <matt@mattfarina.com>
  • Loading branch information
mattfarina committed Jun 17, 2019
1 parent 6c88a42 commit 79235ee
Show file tree
Hide file tree
Showing 6 changed files with 697 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ docker-test-style: check-docker
protoc: protoc:
$(MAKE) -C _proto/ all $(MAKE) -C _proto/ all


.PHONY: generate
generate:
$(GO) generate ./...

.PHONY: docs .PHONY: docs
docs: build docs: build
@scripts/update-docs.sh @scripts/update-docs.sh
Expand Down
4 changes: 2 additions & 2 deletions docs/helm/helm_template.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ helm template [flags] CHART
-x, --execute stringArray Only execute the given templates -x, --execute stringArray Only execute the given templates
-h, --help help for template -h, --help help for template
--is-upgrade Set .Release.IsUpgrade instead of .Release.IsInstall --is-upgrade Set .Release.IsUpgrade instead of .Release.IsInstall
--kube-version string Kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.9") --kube-version string Kubernetes version used as Capabilities.KubeVersion.Major/Minor (default "1.14")
-n, --name string Release name (default "release-name") -n, --name string Release name (default "release-name")
--name-template string Specify template used to name the release --name-template string Specify template used to name the release
--namespace string Namespace to install the release into --namespace string Namespace to install the release into
Expand Down Expand Up @@ -55,4 +55,4 @@ helm template [flags] CHART


* [helm](helm.md) - The Helm package manager for Kubernetes. * [helm](helm.md) - The Helm package manager for Kubernetes.


###### Auto generated by spf13/cobra on 16-May-2019 ###### Auto generated by spf13/cobra on 17-Jun-2019
10 changes: 6 additions & 4 deletions pkg/chartutil/capabilities.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
//go:generate go run generator/capabilities_default_versions_generate.go


package chartutil package chartutil


Expand All @@ -24,14 +25,15 @@ import (
) )


var ( var (
// DefaultVersionSet is the default version set, which includes only Core V1 ("v1"). // DefaultVersionSet is the default version set in included in Kubernetes for workloads
DefaultVersionSet = NewVersionSet("v1") // Default versions as of Kubernetes 1.14
DefaultVersionSet = NewVersionSet(defaultVersions()...)


// DefaultKubeVersion is the default kubernetes version // DefaultKubeVersion is the default kubernetes version
DefaultKubeVersion = &version.Info{ DefaultKubeVersion = &version.Info{
Major: "1", Major: "1",
Minor: "9", Minor: "14",
GitVersion: "v1.9.0", GitVersion: "v1.14.0",
GoVersion: runtime.Version(), GoVersion: runtime.Version(),
Compiler: runtime.Compiler, Compiler: runtime.Compiler,
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
Expand Down
7 changes: 4 additions & 3 deletions pkg/chartutil/capabilities_test.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ func TestDefaultVersionSet(t *testing.T) {
if !DefaultVersionSet.Has("v1") { if !DefaultVersionSet.Has("v1") {
t.Error("Expected core v1 version set") t.Error("Expected core v1 version set")
} }
if d := len(DefaultVersionSet); d != 1 {
t.Errorf("Expected only one version, got %d", d)
}
} }


func TestCapabilities(t *testing.T) { func TestCapabilities(t *testing.T) {
Expand All @@ -51,4 +48,8 @@ func TestCapabilities(t *testing.T) {
if !cap.APIVersions.Has("v1") { if !cap.APIVersions.Has("v1") {
t.Error("APIVersions should have v1") t.Error("APIVersions should have v1")
} }

if !cap.APIVersions.Has("apps/v1/Deployment") {
t.Error("APIVersions should have apps/v1/Deployment")
}
} }
Loading

0 comments on commit 79235ee

Please sign in to comment.