mirror of https://github.com/helm/helm
* 'master' of github.com:kubernetes/helm: (59 commits) ref(cmd): refactor status cmd ref(helm): fix naming issues from golint ref(cmd): refactor create cmd chore(*): add canonical import path annotation Add reference to text/template Go package doc ref(cmd): remove duplicate test cases feat(helm): add 'helm get hooks'. fix(engine): change template naming fix(ci): ensure godir is installed for coverage feat(ci): setup test coverage reports with coveralls.io feat(*): add version to release feat(tiller): support hooks for install fix(ci): move docker-build out of parallel step docs(ci): add cicleci badge to readme fix(ci): add docker-build to the parallel builds fix(lint): fix tests chore(deps): pin kubernetes to an official release (v1.3.0) fix(lint): only return count of actually linted charts docs(helm):correct the documentation for the global values usage fix(scripts): update local-cluster.sh to work with v1.3 ...pull/881/head
commit
e0b9f1d99a
@ -0,0 +1,45 @@
|
||||
// Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package hapi.release;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "release";
|
||||
|
||||
// Hook defines a hook object.
|
||||
message Hook {
|
||||
enum Event {
|
||||
UNKNOWN = 0;
|
||||
PRE_INSTALL = 1;
|
||||
POST_INSTALL = 2;
|
||||
PRE_DELETE = 3;
|
||||
POST_DELETE = 4;
|
||||
PRE_UPGRADE = 5;
|
||||
POST_UPGRADE = 6;
|
||||
}
|
||||
string name = 1;
|
||||
// Kind is the Kubernetes kind.
|
||||
string kind = 2;
|
||||
// Path is the chart-relative path to the template.
|
||||
string path = 3;
|
||||
// Manifest is the manifest contents.
|
||||
string manifest = 4;
|
||||
// Events are the events that this hook fires on.
|
||||
repeated Event events = 5;
|
||||
// LastRun indicates the date/time this was last run.
|
||||
google.protobuf.Timestamp last_run = 6;
|
||||
}
|
@ -1,43 +1,45 @@
|
||||
machine:
|
||||
pre:
|
||||
- curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
|
||||
|
||||
environment:
|
||||
GLIDE_VERSION: "0.10.1"
|
||||
GO15VENDOREXPERIMENT: 1
|
||||
GOPATH: /usr/local/go_workspace
|
||||
HOME: /home/ubuntu
|
||||
IMPORT_PATH: "k8s.io/helm"
|
||||
PATH: $HOME/go/bin:$PATH
|
||||
GOROOT: $HOME/go
|
||||
GOVERSION: "1.6.2"
|
||||
GOPATH: "${HOME}/.go_workspace"
|
||||
WORKDIR: "${GOPATH}/src/k8s.io/helm"
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- sudo rm -rf /usr/local/go
|
||||
- rm -rf "$GOPATH"
|
||||
|
||||
override:
|
||||
- mkdir -p $HOME/go
|
||||
- wget "https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz"
|
||||
- tar -C $HOME -xzf go1.6.linux-amd64.tar.gz
|
||||
- go version
|
||||
# install go
|
||||
- wget "https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz"
|
||||
- sudo tar -C /usr/local -xzf "go${GOVERSION}.linux-amd64.tar.gz"
|
||||
|
||||
# move repository to the canonical import path
|
||||
- mkdir -p "$(dirname ${WORKDIR})"
|
||||
- cp -R "${HOME}/helm" "${WORKDIR}"
|
||||
|
||||
# install dependencies
|
||||
- cd "${WORKDIR}" && make bootstrap
|
||||
|
||||
post:
|
||||
- go env
|
||||
- sudo chown -R $(whoami):staff /usr/local
|
||||
- cd $GOPATH
|
||||
- mkdir -p $GOPATH/src/$IMPORT_PATH
|
||||
- cd $HOME/helm
|
||||
- rsync -az --delete ./ "$GOPATH/src/$IMPORT_PATH/"
|
||||
- wget "https://github.com/Masterminds/glide/releases/download/$GLIDE_VERSION/glide-$GLIDE_VERSION-linux-amd64.tar.gz"
|
||||
- mkdir -p $HOME/bin
|
||||
- tar -vxz -C $HOME/bin --strip=1 -f glide-$GLIDE_VERSION-linux-amd64.tar.gz
|
||||
- export PATH="$HOME/bin:$PATH" GLIDE_HOME="$HOME/.glide"
|
||||
|
||||
test:
|
||||
override:
|
||||
- cd $GOPATH/src/$IMPORT_PATH && make bootstrap test
|
||||
- cd "${WORKDIR}" && ./scripts/ci.sh:
|
||||
parallel: true
|
||||
|
||||
deployment:
|
||||
master-branch:
|
||||
gcr:
|
||||
branch: master
|
||||
commands:
|
||||
- echo $GCLOUD_SERVICE_KEY | base64 --decode > ${HOME}/gcloud-service-key.json
|
||||
- sudo docker login -e 1234@5678.com -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io
|
||||
- cd $GOPATH/src/$IMPORT_PATH
|
||||
- docker login -e 1234@5678.com -u _json_key -p "$(cat ${HOME}/gcloud-service-key.json)" https://gcr.io
|
||||
- make docker-build
|
||||
- sudo docker push gcr.io/kubernetes-helm/tiller:canary
|
||||
- docker push gcr.io/kubernetes-helm/tiller:canary
|
||||
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
const getHooksHelp = `
|
||||
This command downloads hooks for a given release.
|
||||
|
||||
Hooks are formatted in YAML and separated by the YAML '---\n' separator.
|
||||
`
|
||||
|
||||
type getHooksCmd struct {
|
||||
release string
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
}
|
||||
|
||||
func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
||||
ghc := &getHooksCmd{
|
||||
out: out,
|
||||
client: client,
|
||||
}
|
||||
cmd := &cobra.Command{
|
||||
Use: "hooks [flags] RELEASE_NAME",
|
||||
Short: "download all hooks for a named release",
|
||||
Long: getHooksHelp,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) == 0 {
|
||||
return errReleaseRequired
|
||||
}
|
||||
ghc.release = args[0]
|
||||
ghc.client = ensureHelmClient(ghc.client)
|
||||
return ghc.run()
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (g *getHooksCmd) run() error {
|
||||
res, err := g.client.ReleaseContent(g.release)
|
||||
if err != nil {
|
||||
fmt.Fprintln(g.out, g.release)
|
||||
return prettyError(err)
|
||||
}
|
||||
|
||||
for _, hook := range res.Release.Hooks {
|
||||
fmt.Fprintf(g.out, "---\n# %s\n%s", hook.Name, hook.Manifest)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
func TestGetHooks(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get hooks with release",
|
||||
args: []string{"aeneas"},
|
||||
expected: mockHookTemplate,
|
||||
resp: releaseMock("aeneas"),
|
||||
},
|
||||
{
|
||||
name: "get hooks without args",
|
||||
args: []string{},
|
||||
err: true,
|
||||
},
|
||||
}
|
||||
runReleaseCases(t, tests, func(c *fakeReleaseClient, out io.Writer) *cobra.Command {
|
||||
return newGetHooksCmd(c, out)
|
||||
})
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 getManifestHelp = `
|
||||
This command fetches the generated manifest for a given release.
|
||||
|
||||
A manifest is a YAML-encoded representation of the Kubernetes resources that
|
||||
were generated from this release's chart(s). If a chart is dependent on other
|
||||
charts, those resources will also be included in the manifest.
|
||||
`
|
||||
|
||||
type getManifestCmd struct {
|
||||
release string
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
}
|
||||
|
||||
func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
||||
get := &getManifestCmd{
|
||||
out: out,
|
||||
client: client,
|
||||
}
|
||||
cmd := &cobra.Command{
|
||||
Use: "manifest [flags] RELEASE_NAME",
|
||||
Short: "download the manifest for a named release",
|
||||
Long: getManifestHelp,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) == 0 {
|
||||
return errReleaseRequired
|
||||
}
|
||||
get.release = args[0]
|
||||
if get.client == nil {
|
||||
get.client = helm.NewClient(helm.Host(helm.Config.ServAddr))
|
||||
}
|
||||
return get.run()
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
// getManifest implements 'helm get manifest'
|
||||
func (g *getManifestCmd) run() error {
|
||||
res, err := g.client.ReleaseContent(g.release)
|
||||
if err != nil {
|
||||
return prettyError(err)
|
||||
}
|
||||
fmt.Fprintln(g.out, res.Release.Manifest)
|
||||
return nil
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
func TestGetManifest(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get manifest with release",
|
||||
args: []string{"juno"},
|
||||
expected: mockManifest,
|
||||
resp: releaseMock("juno"),
|
||||
},
|
||||
{
|
||||
name: "get manifest without args",
|
||||
args: []string{},
|
||||
err: true,
|
||||
},
|
||||
}
|
||||
runReleaseCases(t, tests, func(c *fakeReleaseClient, out io.Writer) *cobra.Command {
|
||||
return newGetManifestCmd(c, out)
|
||||
})
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
func TestGetCmd(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get with a release",
|
||||
resp: releaseMock("thomas-guide"),
|
||||
args: []string{"thomas-guide"},
|
||||
expected: "VERSION: 1\nRELEASED: (.*)\nCHART: foo-0.1.0-beta.1\nUSER-SUPPLIED VALUES:\nname: \"value\"\nCOMPUTED VALUES:\nname: value\n\nHOOKS:\n---\n# pre-install-hook\n" + mockHookTemplate + "\nMANIFEST:",
|
||||
},
|
||||
{
|
||||
name: "get requires release name arg",
|
||||
err: true,
|
||||
},
|
||||
}
|
||||
|
||||
cmd := func(c *fakeReleaseClient, out io.Writer) *cobra.Command {
|
||||
return newGetCmd(c, out)
|
||||
}
|
||||
runReleaseCases(t, tests, cmd)
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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/chartutil"
|
||||
"k8s.io/helm/pkg/helm"
|
||||
)
|
||||
|
||||
var getValuesHelp = `
|
||||
This command downloads a values file for a given release.
|
||||
`
|
||||
|
||||
type getValuesCmd struct {
|
||||
release string
|
||||
allValues bool
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
}
|
||||
|
||||
func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
||||
get := &getValuesCmd{
|
||||
out: out,
|
||||
client: client,
|
||||
}
|
||||
cmd := &cobra.Command{
|
||||
Use: "values [flags] RELEASE_NAME",
|
||||
Short: "download the values file for a named release",
|
||||
Long: getValuesHelp,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if len(args) == 0 {
|
||||
return errReleaseRequired
|
||||
}
|
||||
get.release = args[0]
|
||||
get.client = ensureHelmClient(get.client)
|
||||
return get.run()
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values")
|
||||
return cmd
|
||||
}
|
||||
|
||||
// getValues implements 'helm get values'
|
||||
func (g *getValuesCmd) run() error {
|
||||
res, err := g.client.ReleaseContent(g.release)
|
||||
if err != nil {
|
||||
return prettyError(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, nil)
|
||||
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)
|
||||
return nil
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
func TestGetValuesCmd(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
{
|
||||
name: "get values with a release",
|
||||
resp: releaseMock("thomas-guide"),
|
||||
args: []string{"thomas-guide"},
|
||||
expected: "name: \"value\"",
|
||||
},
|
||||
{
|
||||
name: "get values requires release name arg",
|
||||
err: true,
|
||||
},
|
||||
}
|
||||
cmd := func(c *fakeReleaseClient, out io.Writer) *cobra.Command {
|
||||
return newGetValuesCmd(c, out)
|
||||
}
|
||||
runReleaseCases(t, tests, cmd)
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 (
|
||||
"bytes"
|
||||
"io"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"k8s.io/helm/pkg/helm"
|
||||
"k8s.io/helm/pkg/proto/hapi/chart"
|
||||
"k8s.io/helm/pkg/proto/hapi/release"
|
||||
rls "k8s.io/helm/pkg/proto/hapi/services"
|
||||
)
|
||||
|
||||
var mockHookTemplate = `apiVersion: v1
|
||||
kind: Job
|
||||
metadata:
|
||||
annotations:
|
||||
"helm.sh/hooks": pre-install
|
||||
`
|
||||
|
||||
var mockManifest = `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: fixture
|
||||
`
|
||||
|
||||
func releaseMock(name string) *release.Release {
|
||||
date := timestamp.Timestamp{Seconds: 242085845, Nanos: 0}
|
||||
return &release.Release{
|
||||
Name: name,
|
||||
Info: &release.Info{
|
||||
FirstDeployed: &date,
|
||||
LastDeployed: &date,
|
||||
Status: &release.Status{Code: release.Status_DEPLOYED},
|
||||
},
|
||||
Chart: &chart.Chart{
|
||||
Metadata: &chart.Metadata{
|
||||
Name: "foo",
|
||||
Version: "0.1.0-beta.1",
|
||||
},
|
||||
Templates: []*chart.Template{
|
||||
{Name: "foo.tpl", Data: []byte(mockManifest)},
|
||||
},
|
||||
},
|
||||
Config: &chart.Config{Raw: `name: "value"`},
|
||||
Version: 1,
|
||||
Hooks: []*release.Hook{
|
||||
{
|
||||
Name: "pre-install-hook",
|
||||
Kind: "Job",
|
||||
Path: "pre-install-hook.yaml",
|
||||
Manifest: mockHookTemplate,
|
||||
LastRun: &date,
|
||||
Events: []release.Hook_Event{release.Hook_PRE_INSTALL},
|
||||
},
|
||||
},
|
||||
Manifest: mockManifest,
|
||||
}
|
||||
}
|
||||
|
||||
type fakeReleaseClient struct {
|
||||
rels []*release.Release
|
||||
err error
|
||||
}
|
||||
|
||||
func (c *fakeReleaseClient) ListReleases(opts ...helm.ReleaseListOption) (*rls.ListReleasesResponse, error) {
|
||||
resp := &rls.ListReleasesResponse{
|
||||
Count: int64(len(c.rels)),
|
||||
Releases: c.rels,
|
||||
}
|
||||
return resp, c.err
|
||||
}
|
||||
|
||||
func (c *fakeReleaseClient) InstallRelease(chStr string, opts ...helm.InstallOption) (*rls.InstallReleaseResponse, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *fakeReleaseClient) DeleteRelease(rlsName string, opts ...helm.DeleteOption) (*rls.UninstallReleaseResponse, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *fakeReleaseClient) ReleaseStatus(rlsName string, opts ...helm.StatusOption) (*rls.GetReleaseStatusResponse, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *fakeReleaseClient) UpdateRelease(rlsName string, opts ...helm.UpdateOption) (*rls.UpdateReleaseResponse, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *fakeReleaseClient) ReleaseContent(rlsName string, opts ...helm.ContentOption) (resp *rls.GetReleaseContentResponse, err error) {
|
||||
if len(c.rels) > 0 {
|
||||
resp = &rls.GetReleaseContentResponse{
|
||||
Release: c.rels[0],
|
||||
}
|
||||
}
|
||||
return resp, c.err
|
||||
}
|
||||
|
||||
// releaseCmd is a command that works with a fakeReleaseClient
|
||||
type releaseCmd func(c *fakeReleaseClient, out io.Writer) *cobra.Command
|
||||
|
||||
// runReleaseCases runs a set of release cases through the given releaseCmd.
|
||||
func runReleaseCases(t *testing.T, tests []releaseCase, rcmd releaseCmd) {
|
||||
var buf bytes.Buffer
|
||||
for _, tt := range tests {
|
||||
c := &fakeReleaseClient{
|
||||
rels: []*release.Release{tt.resp},
|
||||
}
|
||||
cmd := rcmd(c, &buf)
|
||||
err := cmd.RunE(cmd, tt.args)
|
||||
if (err != nil) != tt.err {
|
||||
t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err)
|
||||
}
|
||||
re := regexp.MustCompile(tt.expected)
|
||||
if !re.Match(buf.Bytes()) {
|
||||
t.Errorf("%q. expected\n%q\ngot\n%q", tt.name, tt.expected, buf.String())
|
||||
}
|
||||
buf.Reset()
|
||||
}
|
||||
}
|
||||
|
||||
// releaseCase describes a test case that works with releases.
|
||||
type releaseCase struct {
|
||||
name string
|
||||
args []string
|
||||
// expected is the string to be matched. This supports regular expressions.
|
||||
expected string
|
||||
err bool
|
||||
resp *release.Release
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
archivedChartPath = "testdata/testcharts/compressedchart-0.1.0.tgz"
|
||||
chartDirPath = "testdata/testcharts/decompressedchart/"
|
||||
)
|
||||
|
||||
func TestLintChart(t *testing.T) {
|
||||
if _, err := lintChart(chartDirPath); err != nil {
|
||||
t.Errorf("%s", err)
|
||||
}
|
||||
|
||||
if _, err := lintChart(archivedChartPath); err != nil {
|
||||
t.Errorf("%s", err)
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 (
|
||||
"bytes"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"k8s.io/helm/pkg/proto/hapi/release"
|
||||
)
|
||||
|
||||
func TestListCmd(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args []string
|
||||
flags map[string]string
|
||||
resp []*release.Release
|
||||
expected string
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
name: "with a release",
|
||||
resp: []*release.Release{
|
||||
releaseMock("thomas-guide"),
|
||||
},
|
||||
expected: "thomas-guide",
|
||||
},
|
||||
{
|
||||
name: "list --long",
|
||||
flags: map[string]string{"long": "1"},
|
||||
resp: []*release.Release{
|
||||
releaseMock("atlas"),
|
||||
},
|
||||
expected: "NAME \tVERSION\tUPDATED \tSTATUS \tCHART \natlas\t1 \t(.*)\tDEPLOYED\tfoo-0.1.0-beta.1\n",
|
||||
},
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
for _, tt := range tests {
|
||||
c := &fakeReleaseClient{
|
||||
rels: tt.resp,
|
||||
}
|
||||
cmd := newListCmd(c, &buf)
|
||||
for flag, value := range tt.flags {
|
||||
cmd.Flags().Set(flag, value)
|
||||
}
|
||||
err := cmd.RunE(cmd, tt.args)
|
||||
if (err != nil) != tt.err {
|
||||
t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err)
|
||||
}
|
||||
re := regexp.MustCompile(tt.expected)
|
||||
if !re.Match(buf.Bytes()) {
|
||||
t.Errorf("%q. expected %q, got %q", tt.name, tt.expected, buf.String())
|
||||
}
|
||||
buf.Reset()
|
||||
}
|
||||
}
|
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
.git
|
@ -0,0 +1,3 @@
|
||||
description: A Helm chart for Kubernetes
|
||||
name: decompressedchart
|
||||
version: 0.1.0
|
@ -0,0 +1,4 @@
|
||||
# Default values for decompressedchart.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare name/value pairs to be passed into your templates.
|
||||
name: my-decompressed-chart
|
@ -0,0 +1,107 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
"k8s.io/helm/pkg/proto/hapi/release"
|
||||
)
|
||||
|
||||
// hookAnno is the label name for a hook
|
||||
const hookAnno = "helm.sh/hook"
|
||||
|
||||
const (
|
||||
preInstall = "pre-install"
|
||||
postInstall = "post-install"
|
||||
preDelete = "pre-delete"
|
||||
postDelete = "post-delete"
|
||||
preUpgrade = "pre-upgrade"
|
||||
postUpgrade = "post-upgrade"
|
||||
)
|
||||
|
||||
var events = map[string]release.Hook_Event{
|
||||
preInstall: release.Hook_PRE_INSTALL,
|
||||
postInstall: release.Hook_POST_INSTALL,
|
||||
preDelete: release.Hook_PRE_DELETE,
|
||||
postDelete: release.Hook_POST_DELETE,
|
||||
preUpgrade: release.Hook_PRE_UPGRADE,
|
||||
postUpgrade: release.Hook_POST_UPGRADE,
|
||||
}
|
||||
|
||||
type simpleHead struct {
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Metadata *struct {
|
||||
Name string `json:"name"`
|
||||
Annotations map[string]string `json:"annotations"`
|
||||
} `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
// sortHooks takes a map of filename/YAML contents and sorts them into hook types.
|
||||
//
|
||||
// The resulting hooks struct will be populated with all of the generated hooks.
|
||||
// Any file that does not declare one of the hook types will be placed in the
|
||||
// 'generic' bucket.
|
||||
//
|
||||
// To determine hook type, this looks for a YAML structure like this:
|
||||
//
|
||||
// kind: SomeKind
|
||||
// metadata:
|
||||
// annotations:
|
||||
// helm.sh/hook: pre-install
|
||||
//
|
||||
// Where HOOK_NAME is one of the known hooks.
|
||||
//
|
||||
// If a file declares more than one hook, it will be copied into all of the applicable
|
||||
// hook buckets. (Note: label keys are not unique within the labels section).
|
||||
//
|
||||
// Files that do not parse into the expected format are simply placed into a map and
|
||||
// returned.
|
||||
func sortHooks(files map[string]string) (hs []*release.Hook, generic map[string]string) {
|
||||
hs = []*release.Hook{}
|
||||
generic = map[string]string{}
|
||||
|
||||
for n, c := range files {
|
||||
var sh simpleHead
|
||||
err := yaml.Unmarshal([]byte(c), &sh)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("YAML parse error on %s: %s (skipping)", n, err)
|
||||
}
|
||||
|
||||
if sh.Metadata == nil || sh.Metadata.Annotations == nil || len(sh.Metadata.Annotations) == 0 {
|
||||
generic[n] = c
|
||||
continue
|
||||
}
|
||||
|
||||
hookTypes, ok := sh.Metadata.Annotations[hookAnno]
|
||||
if !ok {
|
||||
generic[n] = c
|
||||
continue
|
||||
}
|
||||
h := &release.Hook{
|
||||
Name: sh.Metadata.Name,
|
||||
Kind: sh.Kind,
|
||||
Path: n,
|
||||
Manifest: c,
|
||||
Events: []release.Hook_Event{},
|
||||
}
|
||||
|
||||
isHook := false
|
||||
for _, hookType := range strings.Split(hookTypes, ",") {
|
||||
hookType = strings.ToLower(strings.TrimSpace(hookType))
|
||||
e, ok := events[hookType]
|
||||
if ok {
|
||||
isHook = true
|
||||
h.Events = append(h.Events, e)
|
||||
}
|
||||
}
|
||||
|
||||
if !isHook {
|
||||
log.Printf("info: skipping unknown hook: %q", hookTypes)
|
||||
continue
|
||||
}
|
||||
hs = append(hs, h)
|
||||
}
|
||||
return
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"k8s.io/helm/pkg/proto/hapi/release"
|
||||
)
|
||||
|
||||
func TestSortHooks(t *testing.T) {
|
||||
|
||||
data := []struct {
|
||||
name string
|
||||
path string
|
||||
kind string
|
||||
hooks []release.Hook_Event
|
||||
manifest string
|
||||
}{
|
||||
{
|
||||
name: "first",
|
||||
path: "one",
|
||||
kind: "Job",
|
||||
hooks: []release.Hook_Event{release.Hook_PRE_INSTALL},
|
||||
manifest: `apiVersion: v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: first
|
||||
labels:
|
||||
doesnt: matter
|
||||
annotations:
|
||||
"helm.sh/hook": pre-install
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "second",
|
||||
path: "two",
|
||||
kind: "ReplicaSet",
|
||||
hooks: []release.Hook_Event{release.Hook_POST_INSTALL},
|
||||
manifest: `kind: ReplicaSet
|
||||
metadata:
|
||||
name: second
|
||||
annotations:
|
||||
"helm.sh/hook": post-install
|
||||
`,
|
||||
}, {
|
||||
name: "third",
|
||||
path: "three",
|
||||
kind: "ReplicaSet",
|
||||
hooks: []release.Hook_Event{},
|
||||
manifest: `kind: ReplicaSet
|
||||
metadata:
|
||||
name: third
|
||||
annotations:
|
||||
"helm.sh/hook": no-such-hook
|
||||
`,
|
||||
}, {
|
||||
name: "fourth",
|
||||
path: "four",
|
||||
kind: "Pod",
|
||||
hooks: []release.Hook_Event{},
|
||||
manifest: `kind: Pod
|
||||
metadata:
|
||||
name: fourth
|
||||
annotations:
|
||||
nothing: here
|
||||
`,
|
||||
}, {
|
||||
name: "fifth",
|
||||
path: "five",
|
||||
kind: "ReplicaSet",
|
||||
hooks: []release.Hook_Event{release.Hook_POST_DELETE, release.Hook_POST_INSTALL},
|
||||
manifest: `kind: ReplicaSet
|
||||
metadata:
|
||||
name: fifth
|
||||
annotations:
|
||||
"helm.sh/hook": post-delete, post-install
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
manifests := make(map[string]string, len(data))
|
||||
for _, o := range data {
|
||||
manifests[o.path] = o.manifest
|
||||
}
|
||||
|
||||
hs, generic := sortHooks(manifests)
|
||||
|
||||
if len(generic) != 1 {
|
||||
t.Errorf("Expected 1 generic manifest, got %d", len(generic))
|
||||
}
|
||||
|
||||
if len(hs) != 3 {
|
||||
t.Errorf("Expected 3 hooks, got %d", len(hs))
|
||||
}
|
||||
|
||||
for _, out := range hs {
|
||||
found := false
|
||||
for _, expect := range data {
|
||||
if out.Path == expect.path {
|
||||
found = true
|
||||
if out.Path != expect.path {
|
||||
t.Errorf("Expected path %s, got %s", expect.path, out.Path)
|
||||
}
|
||||
if out.Name != expect.name {
|
||||
t.Errorf("Expected name %s, got %s", expect.name, out.Name)
|
||||
}
|
||||
if out.Kind != expect.kind {
|
||||
t.Errorf("Expected kind %s, got %s", expect.kind, out.Kind)
|
||||
}
|
||||
for i := 0; i < len(out.Events); i++ {
|
||||
if out.Events[i] != expect.hooks[i] {
|
||||
t.Errorf("Expected event %d, got %d", expect.hooks[i], out.Events[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Errorf("Result not found: %v", out)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,2 +1,2 @@
|
||||
# The pod name
|
||||
name: my-alpine
|
||||
Name: my-alpine
|
||||
|
@ -0,0 +1,31 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "{{template "fullname" . }}"
|
||||
labels:
|
||||
heritage: {{.Release.Service | quote }}
|
||||
release: {{.Release.Name | quote }}
|
||||
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.
|
||||
"helm.sh/hook": post-install
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: "{{template "fullname" . }}"
|
||||
labels:
|
||||
heritage: {{.Release.Service | quote }}
|
||||
release: {{.Release.Name | quote }}
|
||||
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||
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.
|
||||
# {{default "Never" .restartPolicy}} is a slightly optimized version of the
|
||||
# more conventional syntax: {{.restartPolicy | default "Never"}}
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: {{template "fullname" .}}-job
|
||||
image: "alpine:3.3"
|
||||
# All we're going to do is sleep for a minute, then exit.
|
||||
command: ["/bin/sleep","{{default "10" .Values.sleepyTime}}"]
|
@ -0,0 +1,14 @@
|
||||
# This shows a secret as a pre-install hook.
|
||||
# A pre-install hook is run before the rest of the chart is loaded.
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: "{{.Release.Name}}-secret"
|
||||
# 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:
|
||||
"helm.sh/hook": pre-install
|
||||
type: Opaque
|
||||
data:
|
||||
password: {{ b64enc "secret" }}
|
||||
username: {{ b64enc "user1" }}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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 helm
|
||||
|
||||
import (
|
||||
rls "k8s.io/helm/pkg/proto/hapi/services"
|
||||
)
|
||||
|
||||
// Interface for helm client for mocking in tests
|
||||
type Interface interface {
|
||||
ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error)
|
||||
InstallRelease(chStr string, opts ...InstallOption) (*rls.InstallReleaseResponse, error)
|
||||
DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.UninstallReleaseResponse, error)
|
||||
ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.GetReleaseStatusResponse, error)
|
||||
UpdateRelease(rlsName string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error)
|
||||
ReleaseContent(rlsName string, opts ...ContentOption) (*rls.GetReleaseContentResponse, error)
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{define "name"}}{{default "nginx" .Values.nameOverride | trunc 24 }}{{end}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
|
||||
We truncate at 24 chars because some Kubernetes name fields are limited to this
|
||||
(by the DNS naming spec).
|
||||
*/}}
|
||||
{{define "fullname"}}
|
||||
{{- $name := default "nginx" .Values.nameOverride -}}
|
||||
{{printf "%s-%s" .Release.Name $name | trunc 24 -}}
|
||||
{{end}}
|
@ -1,2 +0,0 @@
|
||||
metadata:
|
||||
name: {{.name | default "foo" | title}}
|
@ -0,0 +1,18 @@
|
||||
# This is a service gateway to the replica set created by the deployment.
|
||||
# Take a look at the deployment.yaml for general notes about this chart.
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: "{{ .Values.name }}"
|
||||
labels:
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||
spec:
|
||||
ports:
|
||||
- port: {{default 80 .Values.httpPort | quote}}
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: {{template "fullname" .}}
|
@ -0,0 +1,125 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: hapi/release/hook.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package release is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
hapi/release/hook.proto
|
||||
hapi/release/info.proto
|
||||
hapi/release/release.proto
|
||||
hapi/release/status.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Hook
|
||||
Info
|
||||
Release
|
||||
Status
|
||||
*/
|
||||
package release
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
const _ = proto.ProtoPackageIsVersion1
|
||||
|
||||
type Hook_Event int32
|
||||
|
||||
const (
|
||||
Hook_UNKNOWN Hook_Event = 0
|
||||
Hook_PRE_INSTALL Hook_Event = 1
|
||||
Hook_POST_INSTALL Hook_Event = 2
|
||||
Hook_PRE_DELETE Hook_Event = 3
|
||||
Hook_POST_DELETE Hook_Event = 4
|
||||
Hook_PRE_UPGRADE Hook_Event = 5
|
||||
Hook_POST_UPGRADE Hook_Event = 6
|
||||
)
|
||||
|
||||
var Hook_Event_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "PRE_INSTALL",
|
||||
2: "POST_INSTALL",
|
||||
3: "PRE_DELETE",
|
||||
4: "POST_DELETE",
|
||||
5: "PRE_UPGRADE",
|
||||
6: "POST_UPGRADE",
|
||||
}
|
||||
var Hook_Event_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"PRE_INSTALL": 1,
|
||||
"POST_INSTALL": 2,
|
||||
"PRE_DELETE": 3,
|
||||
"POST_DELETE": 4,
|
||||
"PRE_UPGRADE": 5,
|
||||
"POST_UPGRADE": 6,
|
||||
}
|
||||
|
||||
func (x Hook_Event) String() string {
|
||||
return proto.EnumName(Hook_Event_name, int32(x))
|
||||
}
|
||||
func (Hook_Event) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
|
||||
|
||||
// Hook defines a hook object.
|
||||
type Hook struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// Kind is the Kubernetes kind.
|
||||
Kind string `protobuf:"bytes,2,opt,name=kind" json:"kind,omitempty"`
|
||||
// Path is the chart-relative path to the template.
|
||||
Path string `protobuf:"bytes,3,opt,name=path" json:"path,omitempty"`
|
||||
// Manifest is the manifest contents.
|
||||
Manifest string `protobuf:"bytes,4,opt,name=manifest" json:"manifest,omitempty"`
|
||||
// Events are the events that this hook fires on.
|
||||
Events []Hook_Event `protobuf:"varint,5,rep,name=events,enum=hapi.release.Hook_Event" json:"events,omitempty"`
|
||||
// LastRun indicates the date/time this was last run.
|
||||
LastRun *google_protobuf.Timestamp `protobuf:"bytes,6,opt,name=last_run,json=lastRun" json:"last_run,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Hook) Reset() { *m = Hook{} }
|
||||
func (m *Hook) String() string { return proto.CompactTextString(m) }
|
||||
func (*Hook) ProtoMessage() {}
|
||||
func (*Hook) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *Hook) GetLastRun() *google_protobuf.Timestamp {
|
||||
if m != nil {
|
||||
return m.LastRun
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Hook)(nil), "hapi.release.Hook")
|
||||
proto.RegisterEnum("hapi.release.Hook_Event", Hook_Event_name, Hook_Event_value)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 300 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x8f, 0x5f, 0x4f, 0xc2, 0x30,
|
||||
0x14, 0xc5, 0x05, 0xc6, 0x80, 0x0b, 0xc1, 0xa5, 0x2f, 0x36, 0xbc, 0x48, 0x78, 0xe2, 0xa9, 0x33,
|
||||
0x18, 0x3f, 0x00, 0x86, 0x46, 0x8d, 0x64, 0x90, 0x32, 0x62, 0xe2, 0x0b, 0x29, 0xb1, 0xc0, 0x02,
|
||||
0x6b, 0x17, 0xd6, 0xf9, 0xe2, 0xd7, 0xf3, 0x83, 0xb9, 0x76, 0x7f, 0xe2, 0xdb, 0xed, 0xef, 0x9c,
|
||||
0x7b, 0x7a, 0x0f, 0xdc, 0x9d, 0x78, 0x12, 0xf9, 0x57, 0x71, 0x11, 0x3c, 0x15, 0xfe, 0x49, 0xa9,
|
||||
0x33, 0x49, 0xae, 0x4a, 0x2b, 0x34, 0x30, 0x02, 0x29, 0x85, 0xd1, 0xfd, 0x51, 0xa9, 0xe3, 0x45,
|
||||
0xf8, 0x56, 0xdb, 0x67, 0x07, 0x5f, 0x47, 0xb1, 0x48, 0x35, 0x8f, 0x93, 0xc2, 0x3e, 0xf9, 0x6d,
|
||||
0x82, 0xf3, 0x9a, 0x6f, 0x23, 0x04, 0x8e, 0xe4, 0xb1, 0xc0, 0x8d, 0x71, 0x63, 0xda, 0x63, 0x76,
|
||||
0x36, 0xec, 0x1c, 0xc9, 0x2f, 0xdc, 0x2c, 0x98, 0x99, 0x0d, 0x4b, 0xb8, 0x3e, 0xe1, 0x56, 0xc1,
|
||||
0xcc, 0x8c, 0x46, 0xd0, 0x8d, 0xb9, 0x8c, 0x0e, 0x79, 0x32, 0x76, 0x2c, 0xaf, 0xdf, 0xe8, 0x01,
|
||||
0x5c, 0xf1, 0x2d, 0xa4, 0x4e, 0x71, 0x7b, 0xdc, 0x9a, 0x0e, 0x67, 0x98, 0xfc, 0x3f, 0x90, 0x98,
|
||||
0xbf, 0x09, 0x35, 0x06, 0x56, 0xfa, 0xd0, 0x13, 0x74, 0x2f, 0x3c, 0xd5, 0xbb, 0x6b, 0x26, 0xb1,
|
||||
0x9b, 0xa7, 0xf5, 0x67, 0x23, 0x52, 0xd4, 0x20, 0x55, 0x0d, 0x12, 0x56, 0x35, 0x58, 0xc7, 0x78,
|
||||
0x59, 0x26, 0x27, 0x3f, 0xd0, 0xb6, 0x39, 0xa8, 0x0f, 0x9d, 0x6d, 0xf0, 0x1e, 0xac, 0x3e, 0x02,
|
||||
0xef, 0x06, 0xdd, 0x42, 0x7f, 0xcd, 0xe8, 0xee, 0x2d, 0xd8, 0x84, 0xf3, 0xe5, 0xd2, 0x6b, 0x20,
|
||||
0x0f, 0x06, 0xeb, 0xd5, 0x26, 0xac, 0x49, 0x13, 0x0d, 0x01, 0x8c, 0x65, 0x41, 0x97, 0x34, 0xa4,
|
||||
0x5e, 0xcb, 0xae, 0x18, 0x47, 0x09, 0x9c, 0x2a, 0x63, 0xbb, 0x7e, 0x61, 0xf3, 0x05, 0xf5, 0xda,
|
||||
0x75, 0x46, 0x45, 0xdc, 0xe7, 0xde, 0x67, 0xa7, 0x6c, 0xb4, 0x77, 0xed, 0x91, 0x8f, 0x7f, 0x01,
|
||||
0x00, 0x00, 0xff, 0xff, 0x16, 0x64, 0x61, 0x76, 0xa2, 0x01, 0x00, 0x00,
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Bash 'Strict Mode'
|
||||
# http://redsymbol.net/articles/unofficial-bash-strict-mode
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
HELM_ROOT="${BASH_SOURCE[0]%/*}/.."
|
||||
cd "$HELM_ROOT"
|
||||
|
||||
run_unit_test() {
|
||||
if [[ "${CIRCLE_BRANCH-}" == "master" ]]; then
|
||||
echo "Running unit tests with coverage'"
|
||||
./scripts/coverage.sh --coveralls
|
||||
else
|
||||
echo "Running unit tests'"
|
||||
make test-unit
|
||||
fi
|
||||
}
|
||||
|
||||
run_style_check() {
|
||||
echo "Running 'make test-style'"
|
||||
make test-style
|
||||
}
|
||||
|
||||
case "${CIRCLE_NODE_INDEX-0}" in
|
||||
0) run_unit_test ;;
|
||||
1) run_style_check ;;
|
||||
esac
|
@ -1,4 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kube-system
|
Loading…
Reference in new issue