mirror of https://github.com/helm/helm.git
ref(*): use go conventions for naming types
This commit is contained in:
parent
36536d77ba
commit
c5a76deba3
|
@ -91,7 +91,7 @@ func (c *createCmd) run() error {
|
|||
Description: "A Helm chart for Kubernetes",
|
||||
Version: "0.1.0",
|
||||
AppVersion: "1.0",
|
||||
ApiVersion: chartutil.ApiVersionV1,
|
||||
APIVersion: chartutil.APIVersionv1,
|
||||
}
|
||||
|
||||
if c.starter != "" {
|
||||
|
|
|
@ -67,8 +67,8 @@ func TestCreateCmd(t *testing.T) {
|
|||
if c.Metadata.Name != cname {
|
||||
t.Errorf("Expected %q name, got %q", cname, c.Metadata.Name)
|
||||
}
|
||||
if c.Metadata.ApiVersion != chartutil.ApiVersionV1 {
|
||||
t.Errorf("Wrong API version: %q", c.Metadata.ApiVersion)
|
||||
if c.Metadata.APIVersion != chartutil.APIVersionv1 {
|
||||
t.Errorf("Wrong API version: %q", c.Metadata.APIVersion)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,8 @@ func TestCreateStarterCmd(t *testing.T) {
|
|||
if c.Metadata.Name != cname {
|
||||
t.Errorf("Expected %q name, got %q", cname, c.Metadata.Name)
|
||||
}
|
||||
if c.Metadata.ApiVersion != chartutil.ApiVersionV1 {
|
||||
t.Errorf("Wrong API version: %q", c.Metadata.ApiVersion)
|
||||
if c.Metadata.APIVersion != chartutil.APIVersionv1 {
|
||||
t.Errorf("Wrong API version: %q", c.Metadata.APIVersion)
|
||||
}
|
||||
|
||||
if l := len(c.Templates); l != 6 {
|
||||
|
|
|
@ -44,7 +44,7 @@ type getCmd struct {
|
|||
release string
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
version int32
|
||||
version int
|
||||
}
|
||||
|
||||
func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
||||
|
@ -69,7 +69,7 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
|||
},
|
||||
}
|
||||
|
||||
cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision")
|
||||
cmd.Flags().IntVar(&get.version, "revision", 0, "get the named release with revision")
|
||||
|
||||
cmd.AddCommand(newGetValuesCmd(nil, out))
|
||||
cmd.AddCommand(newGetManifestCmd(nil, out))
|
||||
|
|
|
@ -35,7 +35,7 @@ type getHooksCmd struct {
|
|||
release string
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
version int32
|
||||
version int
|
||||
}
|
||||
|
||||
func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
||||
|
@ -56,7 +56,7 @@ 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")
|
||||
cmd.Flags().IntVar(&ghc.version, "revision", 0, "get the named release with revision")
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ type getManifestCmd struct {
|
|||
release string
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
version int32
|
||||
version int
|
||||
}
|
||||
|
||||
func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
||||
|
@ -59,7 +59,7 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
|||
},
|
||||
}
|
||||
|
||||
cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision")
|
||||
cmd.Flags().IntVar(&get.version, "revision", 0, "get the named release with revision")
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ type getValuesCmd struct {
|
|||
allValues bool
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
version int32
|
||||
version int
|
||||
}
|
||||
|
||||
func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command {
|
||||
|
@ -57,7 +57,7 @@ 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().IntVar(&get.version, "revision", 0, "get the named release with revision")
|
||||
cmd.Flags().BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values")
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ type releaseCase struct {
|
|||
resp *release.Release
|
||||
// Rels are the available releases at the start of the test.
|
||||
rels []*release.Release
|
||||
responses map[string]release.TestRun_Status
|
||||
responses map[string]release.TestRunStatus
|
||||
}
|
||||
|
||||
// tempHelmHome sets up a Helm Home in a temp dir.
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
)
|
||||
|
||||
type releaseInfo struct {
|
||||
Revision int32 `json:"revision"`
|
||||
Revision int `json:"revision"`
|
||||
Updated string `json:"updated"`
|
||||
Status string `json:"status"`
|
||||
Chart string `json:"chart"`
|
||||
|
@ -57,7 +57,7 @@ The historical release set is printed as a formatted table, e.g:
|
|||
`
|
||||
|
||||
type historyCmd struct {
|
||||
max int32
|
||||
max int
|
||||
rls string
|
||||
out io.Writer
|
||||
helmc helm.Interface
|
||||
|
@ -86,7 +86,7 @@ func newHistoryCmd(c helm.Interface, w io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
f := cmd.Flags()
|
||||
f.Int32Var(&his.max, "max", 256, "maximum number of revision to include in history")
|
||||
f.IntVar(&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)")
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
)
|
||||
|
||||
func TestHistoryCmd(t *testing.T) {
|
||||
mk := func(name string, vers int32, code rpb.Status_Code) *rpb.Release {
|
||||
mk := func(name string, vers int, code rpb.StatusCode) *rpb.Release {
|
||||
return helm.ReleaseMock(&helm.MockReleaseOptions{
|
||||
Name: name,
|
||||
Version: vers,
|
||||
|
|
|
@ -136,8 +136,8 @@ func (l *listCmd) run() error {
|
|||
helm.ReleaseListLimit(l.limit),
|
||||
helm.ReleaseListOffset(l.offset),
|
||||
helm.ReleaseListFilter(l.filter),
|
||||
helm.ReleaseListSort(int32(sortBy)),
|
||||
helm.ReleaseListOrder(int32(sortOrder)),
|
||||
helm.ReleaseListSort(int(sortBy)),
|
||||
helm.ReleaseListOrder(int(sortOrder)),
|
||||
helm.ReleaseListStatuses(stats),
|
||||
helm.ReleaseListNamespace(l.namespace),
|
||||
)
|
||||
|
@ -164,7 +164,7 @@ func (l *listCmd) run() error {
|
|||
|
||||
// filterList returns a list scrubbed of old releases.
|
||||
func filterList(rels []*release.Release) []*release.Release {
|
||||
idx := map[string]int32{}
|
||||
idx := map[string]int{}
|
||||
|
||||
for _, r := range rels {
|
||||
name, version := r.Name, r.Version
|
||||
|
@ -187,9 +187,9 @@ func filterList(rels []*release.Release) []*release.Release {
|
|||
}
|
||||
|
||||
// statusCodes gets the list of status codes that are to be included in the results.
|
||||
func (l *listCmd) statusCodes() []release.Status_Code {
|
||||
func (l *listCmd) statusCodes() []release.StatusCode {
|
||||
if l.all {
|
||||
return []release.Status_Code{
|
||||
return []release.StatusCode{
|
||||
release.Status_UNKNOWN,
|
||||
release.Status_DEPLOYED,
|
||||
release.Status_DELETED,
|
||||
|
@ -200,7 +200,7 @@ func (l *listCmd) statusCodes() []release.Status_Code {
|
|||
release.Status_PENDING_ROLLBACK,
|
||||
}
|
||||
}
|
||||
status := []release.Status_Code{}
|
||||
status := []release.StatusCode{}
|
||||
if l.deployed {
|
||||
status = append(status, release.Status_DEPLOYED)
|
||||
}
|
||||
|
|
|
@ -32,42 +32,42 @@ func TestReleaseTesting(t *testing.T) {
|
|||
name: "basic test",
|
||||
args: []string{"example-release"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"PASSED: green lights everywhere": release.TestRun_SUCCESS},
|
||||
responses: map[string]release.TestRunStatus{"PASSED: green lights everywhere": release.TestRun_SUCCESS},
|
||||
err: false,
|
||||
},
|
||||
{
|
||||
name: "test failure",
|
||||
args: []string{"example-fail"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"FAILURE: red lights everywhere": release.TestRun_FAILURE},
|
||||
responses: map[string]release.TestRunStatus{"FAILURE: red lights everywhere": release.TestRun_FAILURE},
|
||||
err: true,
|
||||
},
|
||||
{
|
||||
name: "test unknown",
|
||||
args: []string{"example-unknown"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"UNKNOWN: yellow lights everywhere": release.TestRun_UNKNOWN},
|
||||
responses: map[string]release.TestRunStatus{"UNKNOWN: yellow lights everywhere": release.TestRun_UNKNOWN},
|
||||
err: false,
|
||||
},
|
||||
{
|
||||
name: "test error",
|
||||
args: []string{"example-error"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"ERROR: yellow lights everywhere": release.TestRun_FAILURE},
|
||||
responses: map[string]release.TestRunStatus{"ERROR: yellow lights everywhere": release.TestRun_FAILURE},
|
||||
err: true,
|
||||
},
|
||||
{
|
||||
name: "test running",
|
||||
args: []string{"example-running"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"RUNNING: things are happpeningggg": release.TestRun_RUNNING},
|
||||
responses: map[string]release.TestRunStatus{"RUNNING: things are happpeningggg": release.TestRun_RUNNING},
|
||||
err: false,
|
||||
},
|
||||
{
|
||||
name: "multiple tests example",
|
||||
args: []string{"example-suite"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{
|
||||
responses: map[string]release.TestRunStatus{
|
||||
"RUNNING: things are happpeningggg": release.TestRun_RUNNING,
|
||||
"PASSED: party time": release.TestRun_SUCCESS,
|
||||
"RUNNING: things are happening again": release.TestRun_RUNNING,
|
||||
|
|
|
@ -36,7 +36,7 @@ second is a revision (version) number. To see revision numbers, run
|
|||
|
||||
type rollbackCmd struct {
|
||||
name string
|
||||
revision int32
|
||||
revision int
|
||||
dryRun bool
|
||||
recreate bool
|
||||
force bool
|
||||
|
@ -69,7 +69,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command {
|
|||
return fmt.Errorf("invalid revision number '%q': %s", args[1], err)
|
||||
}
|
||||
|
||||
rollback.revision = int32(v64)
|
||||
rollback.revision = int(v64)
|
||||
rollback.client = ensureHelmClient(rollback.client)
|
||||
return rollback.run()
|
||||
},
|
||||
|
|
|
@ -48,7 +48,7 @@ type statusCmd struct {
|
|||
release string
|
||||
out io.Writer
|
||||
client helm.Interface
|
||||
version int32
|
||||
version int
|
||||
outfmt string
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ 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().IntVar(&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)")
|
||||
|
||||
return cmd
|
||||
|
@ -116,7 +116,7 @@ func PrintStatus(out io.Writer, res *hapi.GetReleaseStatusResponse) {
|
|||
fmt.Fprintf(out, "LAST DEPLOYED: %s\n", res.Info.LastDeployed)
|
||||
}
|
||||
fmt.Fprintf(out, "NAMESPACE: %s\n", res.Namespace)
|
||||
fmt.Fprintf(out, "STATUS: %s\n", res.Info.Status.Code)
|
||||
fmt.Fprintf(out, "STATUS: %s\n", res.Info.Status.Code.String())
|
||||
fmt.Fprintf(out, "\n")
|
||||
if len(res.Info.Status.Resources) > 0 {
|
||||
re := regexp.MustCompile(" +")
|
||||
|
|
|
@ -28,10 +28,8 @@ import (
|
|||
"k8s.io/helm/pkg/hapi/chart"
|
||||
)
|
||||
|
||||
// ApiVersionV1 is the API version number for version 1.
|
||||
//
|
||||
// This is ApiVersionV1 instead of APIVersionV1 to match the protobuf-generated name.
|
||||
const ApiVersionV1 = "v1" // nolint
|
||||
// APIVersionv1 is the API version number for version 1.
|
||||
const APIVersionv1 = "v1" // nolint
|
||||
|
||||
// UnmarshalChartfile takes raw Chart.yaml data and unmarshals it.
|
||||
func UnmarshalChartfile(data []byte) (*chart.Metadata, error) {
|
||||
|
|
|
@ -40,8 +40,8 @@ func verifyChartfile(t *testing.T, f *chart.Metadata, name string) {
|
|||
}
|
||||
|
||||
// Api instead of API because it was generated via protobuf.
|
||||
if f.ApiVersion != ApiVersionV1 {
|
||||
t.Errorf("Expected API Version %q, got %q", ApiVersionV1, f.ApiVersion)
|
||||
if f.APIVersion != APIVersionv1 {
|
||||
t.Errorf("Expected API Version %q, got %q", APIVersionv1, f.APIVersion)
|
||||
}
|
||||
|
||||
if f.Name != name {
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
package chart
|
||||
|
||||
type Metadata_Engine int32
|
||||
|
||||
const (
|
||||
Metadata_UNKNOWN Metadata_Engine = 0
|
||||
Metadata_GOTPL Metadata_Engine = 1
|
||||
)
|
||||
|
||||
var Metadata_Engine_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "GOTPL",
|
||||
}
|
||||
var Metadata_Engine_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"GOTPL": 1,
|
||||
}
|
||||
|
||||
func (x Metadata_Engine) String() string {
|
||||
return Metadata_Engine_name[int32(x)]
|
||||
}
|
||||
|
||||
// Maintainer describes a Chart maintainer.
|
||||
type Maintainer struct {
|
||||
// Name is a user name or organization name
|
||||
|
@ -53,7 +33,7 @@ type Metadata struct {
|
|||
// The URL to an icon file.
|
||||
Icon string `json:"icon,omitempty"`
|
||||
// The API Version of this chart.
|
||||
ApiVersion string `json:"apiVersion,omitempty"`
|
||||
APIVersion string `json:"apiVersion,omitempty"`
|
||||
// The condition to check to enable chart
|
||||
Condition string `json:"condition,omitempty"`
|
||||
// The tags to check to enable chart
|
||||
|
|
|
@ -2,72 +2,54 @@ package release
|
|||
|
||||
import "time"
|
||||
|
||||
type Hook_Event int32
|
||||
type HookEvent int
|
||||
|
||||
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
|
||||
Hook_PRE_ROLLBACK Hook_Event = 7
|
||||
Hook_POST_ROLLBACK Hook_Event = 8
|
||||
Hook_RELEASE_TEST_SUCCESS Hook_Event = 9
|
||||
Hook_RELEASE_TEST_FAILURE Hook_Event = 10
|
||||
Hook_UNKNOWN HookEvent = iota
|
||||
Hook_PRE_INSTALL
|
||||
Hook_POST_INSTALL
|
||||
Hook_PRE_DELETE
|
||||
Hook_POST_DELETE
|
||||
Hook_PRE_UPGRADE
|
||||
Hook_POST_UPGRADE
|
||||
Hook_PRE_ROLLBACK
|
||||
Hook_POST_ROLLBACK
|
||||
Hook_RELEASE_TEST_SUCCESS
|
||||
Hook_RELEASE_TEST_FAILURE
|
||||
)
|
||||
|
||||
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",
|
||||
7: "PRE_ROLLBACK",
|
||||
8: "POST_ROLLBACK",
|
||||
9: "RELEASE_TEST_SUCCESS",
|
||||
10: "RELEASE_TEST_FAILURE",
|
||||
}
|
||||
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,
|
||||
"PRE_ROLLBACK": 7,
|
||||
"POST_ROLLBACK": 8,
|
||||
"RELEASE_TEST_SUCCESS": 9,
|
||||
"RELEASE_TEST_FAILURE": 10,
|
||||
var eventNames = [...]string{
|
||||
"UNKNOWN",
|
||||
"PRE_INSTALL",
|
||||
"POST_INSTALL",
|
||||
"PRE_DELETE",
|
||||
"POST_DELETE",
|
||||
"PRE_UPGRADE",
|
||||
"POST_UPGRADE",
|
||||
"PRE_ROLLBACK",
|
||||
"POST_ROLLBACK",
|
||||
"RELEASE_TEST_SUCCESS",
|
||||
"RELEASE_TEST_FAILURE",
|
||||
}
|
||||
|
||||
func (x Hook_Event) String() string {
|
||||
return Hook_Event_name[int32(x)]
|
||||
}
|
||||
func (x HookEvent) String() string { return eventNames[x] }
|
||||
|
||||
type Hook_DeletePolicy int32
|
||||
type HookDeletePolicy int
|
||||
|
||||
const (
|
||||
Hook_SUCCEEDED Hook_DeletePolicy = 0
|
||||
Hook_FAILED Hook_DeletePolicy = 1
|
||||
Hook_BEFORE_HOOK_CREATION Hook_DeletePolicy = 2
|
||||
Hook_SUCCEEDED HookDeletePolicy = iota
|
||||
Hook_FAILED
|
||||
Hook_BEFORE_HOOK_CREATION
|
||||
)
|
||||
|
||||
var Hook_DeletePolicy_name = map[int32]string{
|
||||
0: "SUCCEEDED",
|
||||
1: "FAILED",
|
||||
2: "BEFORE_HOOK_CREATION",
|
||||
}
|
||||
var Hook_DeletePolicy_value = map[string]int32{
|
||||
"SUCCEEDED": 0,
|
||||
"FAILED": 1,
|
||||
"BEFORE_HOOK_CREATION": 2,
|
||||
var deletePolicyNames = [...]string{
|
||||
"SUCCEEDED",
|
||||
"FAILED",
|
||||
"BEFORE_HOOK_CREATION",
|
||||
}
|
||||
|
||||
func (x HookDeletePolicy) String() string { return deletePolicyNames[x] }
|
||||
|
||||
// Hook defines a hook object.
|
||||
type Hook struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
|
@ -78,11 +60,11 @@ type Hook struct {
|
|||
// Manifest is the manifest contents.
|
||||
Manifest string `json:"manifest,omitempty"`
|
||||
// Events are the events that this hook fires on.
|
||||
Events []Hook_Event `json:"events,omitempty"`
|
||||
Events []HookEvent `json:"events,omitempty"`
|
||||
// LastRun indicates the date/time this was last run.
|
||||
LastRun time.Time `json:"last_run,omitempty"`
|
||||
// Weight indicates the sort order for execution among similar Hook type
|
||||
Weight int32 `json:"weight,omitempty"`
|
||||
Weight int `json:"weight,omitempty"`
|
||||
// DeletePolicies are the policies that indicate when to delete the hook
|
||||
DeletePolicies []Hook_DeletePolicy `json:"delete_policies,omitempty"`
|
||||
DeletePolicies []HookDeletePolicy `json:"delete_policies,omitempty"`
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ type Release struct {
|
|||
Manifest string `json:"manifest,omitempty"`
|
||||
// Hooks are all of the hooks declared for this release.
|
||||
Hooks []*Hook `json:"hooks,omitempty"`
|
||||
// Version is an int32 which represents the version of the release.
|
||||
Version int32 `json:"version,omitempty"`
|
||||
// Version is an int which represents the version of the release.
|
||||
Version int `json:"version,omitempty"`
|
||||
// Namespace is the kubernetes namespace of the release.
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
|
|
@ -1,58 +1,45 @@
|
|||
package release
|
||||
|
||||
type Status_Code int32
|
||||
type StatusCode int
|
||||
|
||||
const (
|
||||
// Status_UNKNOWN indicates that a release is in an uncertain state.
|
||||
Status_UNKNOWN Status_Code = 0
|
||||
Status_UNKNOWN StatusCode = iota
|
||||
// Status_DEPLOYED indicates that the release has been pushed to Kubernetes.
|
||||
Status_DEPLOYED Status_Code = 1
|
||||
Status_DEPLOYED
|
||||
// Status_DELETED indicates that a release has been deleted from Kubermetes.
|
||||
Status_DELETED Status_Code = 2
|
||||
Status_DELETED
|
||||
// Status_SUPERSEDED indicates that this release object is outdated and a newer one exists.
|
||||
Status_SUPERSEDED Status_Code = 3
|
||||
Status_SUPERSEDED
|
||||
// Status_FAILED indicates that the release was not successfully deployed.
|
||||
Status_FAILED Status_Code = 4
|
||||
Status_FAILED
|
||||
// Status_DELETING indicates that a delete operation is underway.
|
||||
Status_DELETING Status_Code = 5
|
||||
Status_DELETING
|
||||
// Status_PENDING_INSTALL indicates that an install operation is underway.
|
||||
Status_PENDING_INSTALL Status_Code = 6
|
||||
Status_PENDING_INSTALL
|
||||
// Status_PENDING_UPGRADE indicates that an upgrade operation is underway.
|
||||
Status_PENDING_UPGRADE Status_Code = 7
|
||||
Status_PENDING_UPGRADE
|
||||
// Status_PENDING_ROLLBACK indicates that an rollback operation is underway.
|
||||
Status_PENDING_ROLLBACK Status_Code = 8
|
||||
Status_PENDING_ROLLBACK
|
||||
)
|
||||
|
||||
var Status_Code_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "DEPLOYED",
|
||||
2: "DELETED",
|
||||
3: "SUPERSEDED",
|
||||
4: "FAILED",
|
||||
5: "DELETING",
|
||||
6: "PENDING_INSTALL",
|
||||
7: "PENDING_UPGRADE",
|
||||
8: "PENDING_ROLLBACK",
|
||||
}
|
||||
var Status_Code_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"DEPLOYED": 1,
|
||||
"DELETED": 2,
|
||||
"SUPERSEDED": 3,
|
||||
"FAILED": 4,
|
||||
"DELETING": 5,
|
||||
"PENDING_INSTALL": 6,
|
||||
"PENDING_UPGRADE": 7,
|
||||
"PENDING_ROLLBACK": 8,
|
||||
var statusCodeNames = [...]string{
|
||||
"UNKNOWN",
|
||||
"DEPLOYED",
|
||||
"DELETED",
|
||||
"SUPERSEDED",
|
||||
"FAILED",
|
||||
"DELETING",
|
||||
"PENDING_INSTALL",
|
||||
"PENDING_UPGRADE",
|
||||
"PENDING_ROLLBACK",
|
||||
}
|
||||
|
||||
func (x Status_Code) String() string {
|
||||
return Status_Code_name[int32(x)]
|
||||
}
|
||||
func (x StatusCode) String() string { return statusCodeNames[x] }
|
||||
|
||||
// Status defines the status of a release.
|
||||
type Status struct {
|
||||
Code Status_Code `json:"code,omitempty"`
|
||||
Code StatusCode `json:"code,omitempty"`
|
||||
// Cluster resources as kubectl would print them.
|
||||
Resources string `json:"resources,omitempty"`
|
||||
// Contains the rendered templates/NOTES.txt if available
|
||||
|
|
|
@ -2,36 +2,28 @@ package release
|
|||
|
||||
import "time"
|
||||
|
||||
type TestRun_Status int32
|
||||
type TestRunStatus int
|
||||
|
||||
const (
|
||||
TestRun_UNKNOWN TestRun_Status = 0
|
||||
TestRun_SUCCESS TestRun_Status = 1
|
||||
TestRun_FAILURE TestRun_Status = 2
|
||||
TestRun_RUNNING TestRun_Status = 3
|
||||
TestRun_UNKNOWN TestRunStatus = iota
|
||||
TestRun_SUCCESS
|
||||
TestRun_FAILURE
|
||||
TestRun_RUNNING
|
||||
)
|
||||
|
||||
var TestRun_Status_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "SUCCESS",
|
||||
2: "FAILURE",
|
||||
3: "RUNNING",
|
||||
}
|
||||
var TestRun_Status_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"SUCCESS": 1,
|
||||
"FAILURE": 2,
|
||||
"RUNNING": 3,
|
||||
var testRunStatusNames = [...]string{
|
||||
"UNKNOWN",
|
||||
"SUCCESS",
|
||||
"FAILURE",
|
||||
"RUNNING",
|
||||
}
|
||||
|
||||
func (x TestRun_Status) String() string {
|
||||
return TestRun_Status_name[int32(x)]
|
||||
}
|
||||
func (x TestRunStatus) String() string { return testRunStatusNames[x] }
|
||||
|
||||
type TestRun struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Status TestRun_Status `json:"status,omitempty"`
|
||||
Info string `json:"info,omitempty"`
|
||||
StartedAt time.Time `json:"started_at,omitempty"`
|
||||
CompletedAt time.Time `json:"completed_at,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Status TestRunStatus `json:"status,omitempty"`
|
||||
Info string `json:"info,omitempty"`
|
||||
StartedAt time.Time `json:"started_at,omitempty"`
|
||||
CompletedAt time.Time `json:"completed_at,omitempty"`
|
||||
}
|
||||
|
|
|
@ -6,49 +6,36 @@ import (
|
|||
)
|
||||
|
||||
// SortBy defines sort operations.
|
||||
type ListSort_SortBy int32
|
||||
type ListSortBy int
|
||||
|
||||
const (
|
||||
ListSort_UNKNOWN ListSort_SortBy = 0
|
||||
ListSort_NAME ListSort_SortBy = 1
|
||||
ListSort_LAST_RELEASED ListSort_SortBy = 2
|
||||
ListSort_UNKNOWN ListSortBy = iota
|
||||
ListSort_NAME
|
||||
ListSort_LAST_RELEASED
|
||||
)
|
||||
|
||||
var ListSort_SortBy_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
1: "NAME",
|
||||
2: "LAST_RELEASED",
|
||||
}
|
||||
var ListSort_SortBy_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"NAME": 1,
|
||||
"LAST_RELEASED": 2,
|
||||
var sortByNames = [...]string{
|
||||
"UNKNOWN",
|
||||
"NAME",
|
||||
"LAST_RELEASED",
|
||||
}
|
||||
|
||||
func (x ListSort_SortBy) String() string {
|
||||
return ListSort_SortBy_name[int32(x)]
|
||||
}
|
||||
func (x ListSortBy) String() string { return sortByNames[x] }
|
||||
|
||||
// SortOrder defines sort orders to augment sorting operations.
|
||||
type ListSort_SortOrder int32
|
||||
type ListSortOrder int
|
||||
|
||||
const (
|
||||
ListSort_ASC ListSort_SortOrder = 0
|
||||
ListSort_DESC ListSort_SortOrder = 1
|
||||
ListSort_ASC ListSortOrder = iota
|
||||
ListSort_DESC
|
||||
)
|
||||
|
||||
var ListSort_SortOrder_name = map[int32]string{
|
||||
0: "ASC",
|
||||
1: "DESC",
|
||||
}
|
||||
var ListSort_SortOrder_value = map[string]int32{
|
||||
"ASC": 0,
|
||||
"DESC": 1,
|
||||
var sortOrderNames = [...]string{
|
||||
"ASC",
|
||||
"DESC",
|
||||
}
|
||||
|
||||
func (x ListSort_SortOrder) String() string {
|
||||
return ListSort_SortOrder_name[int32(x)]
|
||||
}
|
||||
func (x ListSortOrder) String() string { return sortOrderNames[x] }
|
||||
|
||||
// ListReleasesRequest requests a list of releases.
|
||||
//
|
||||
|
@ -65,14 +52,14 @@ type ListReleasesRequest struct {
|
|||
// cause the next batch to return a set of results starting with 'dennis'.
|
||||
Offset string `json:"offset,omityempty"`
|
||||
// SortBy is the sort field that the ListReleases server should sort data before returning.
|
||||
SortBy ListSort_SortBy `json:"sort_by,omityempty"`
|
||||
SortBy ListSortBy `json:"sort_by,omityempty"`
|
||||
// Filter is a regular expression used to filter which releases should be listed.
|
||||
//
|
||||
// Anything that matches the regexp will be included in the results.
|
||||
Filter string `json:"filter,omityempty"`
|
||||
// SortOrder is the ordering directive used for sorting.
|
||||
SortOrder ListSort_SortOrder `json:"sort_order,omityempty"`
|
||||
StatusCodes []release.Status_Code `json:"status_codes,omityempty"`
|
||||
SortOrder ListSortOrder `json:"sort_order,omityempty"`
|
||||
StatusCodes []release.StatusCode `json:"status_codes,omityempty"`
|
||||
// Namespace is the filter to select releases only from a specific namespace.
|
||||
Namespace string `json:"namespace,omityempty"`
|
||||
}
|
||||
|
@ -95,7 +82,7 @@ type GetReleaseStatusRequest struct {
|
|||
// Name is the name of the release
|
||||
Name string `json:"name,omitempty"`
|
||||
// Version is the version of the release
|
||||
Version int32 `json:"version,omitempty"`
|
||||
Version int `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// GetReleaseStatusResponse is the response indicating the status of the named release.
|
||||
|
@ -113,7 +100,7 @@ type GetReleaseContentRequest struct {
|
|||
// The name of the release
|
||||
Name string `json:"name,omityempty"`
|
||||
// Version is the version of the release
|
||||
Version int32 `json:"version,omityempty"`
|
||||
Version int `json:"version,omityempty"`
|
||||
}
|
||||
|
||||
// UpdateReleaseRequest updates a release.
|
||||
|
@ -152,7 +139,7 @@ type RollbackReleaseRequest struct {
|
|||
// DisableHooks causes the server to skip running any hooks for the rollback
|
||||
DisableHooks bool `json:"disable_hooks,omityempty"`
|
||||
// Version is the version of the release to deploy.
|
||||
Version int32 `json:"version,omityempty"`
|
||||
Version int `json:"version,omityempty"`
|
||||
// Performs pods restart for resources if applicable
|
||||
Recreate bool `json:"recreate,omityempty"`
|
||||
// timeout specifies the max amount of time any kubernetes client command can run.
|
||||
|
@ -216,7 +203,7 @@ type GetHistoryRequest struct {
|
|||
// The name of the release.
|
||||
Name string `json:"name,omityempty"`
|
||||
// The maximum number of releases to include.
|
||||
Max int32 `json:"max,omityempty"`
|
||||
Max int `json:"max,omityempty"`
|
||||
}
|
||||
|
||||
// TestReleaseRequest is a request to get the status of a release.
|
||||
|
@ -231,6 +218,6 @@ type TestReleaseRequest struct {
|
|||
|
||||
// TestReleaseResponse represents a message from executing a test
|
||||
type TestReleaseResponse struct {
|
||||
Msg string `json:"msg,omityempty"`
|
||||
Status release.TestRun_Status `json:"status,omityempty"`
|
||||
Msg string `json:"msg,omityempty"`
|
||||
Status release.TestRunStatus `json:"status,omityempty"`
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ func (c *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*relea
|
|||
}
|
||||
|
||||
// ReleaseStatus returns the given release's status.
|
||||
func (c *Client) ReleaseStatus(rlsName string, version int32) (*hapi.GetReleaseStatusResponse, error) {
|
||||
func (c *Client) ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error) {
|
||||
reqOpts := c.opts
|
||||
req := &reqOpts.statusReq
|
||||
req.Name = rlsName
|
||||
|
@ -211,7 +211,7 @@ func (c *Client) ReleaseStatus(rlsName string, version int32) (*hapi.GetReleaseS
|
|||
}
|
||||
|
||||
// ReleaseContent returns the configuration for a given release.
|
||||
func (c *Client) ReleaseContent(name string, version int32) (*release.Release, error) {
|
||||
func (c *Client) ReleaseContent(name string, version int) (*release.Release, error) {
|
||||
reqOpts := c.opts
|
||||
req := &reqOpts.contentReq
|
||||
req.Name = name
|
||||
|
@ -224,7 +224,7 @@ func (c *Client) ReleaseContent(name string, version int32) (*release.Release, e
|
|||
}
|
||||
|
||||
// ReleaseHistory returns a release's revision history.
|
||||
func (c *Client) ReleaseHistory(rlsName string, max int32) ([]*release.Release, error) {
|
||||
func (c *Client) ReleaseHistory(rlsName string, max int) ([]*release.Release, error) {
|
||||
reqOpts := c.opts
|
||||
req := &reqOpts.histReq
|
||||
req.Name = rlsName
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
// FakeClient implements Interface
|
||||
type FakeClient struct {
|
||||
Rels []*release.Release
|
||||
Responses map[string]release.TestRun_Status
|
||||
Responses map[string]release.TestRunStatus
|
||||
Opts options
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ func (c *FakeClient) RollbackRelease(rlsName string, opts ...RollbackOption) (*r
|
|||
}
|
||||
|
||||
// ReleaseStatus returns a release status response with info from the matching release name.
|
||||
func (c *FakeClient) ReleaseStatus(rlsName string, version int32) (*hapi.GetReleaseStatusResponse, error) {
|
||||
func (c *FakeClient) ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error) {
|
||||
for _, rel := range c.Rels {
|
||||
if rel.Name == rlsName {
|
||||
return &hapi.GetReleaseStatusResponse{
|
||||
|
@ -122,7 +122,7 @@ func (c *FakeClient) ReleaseStatus(rlsName string, version int32) (*hapi.GetRele
|
|||
}
|
||||
|
||||
// ReleaseContent returns the configuration for the matching release name in the fake release client.
|
||||
func (c *FakeClient) ReleaseContent(rlsName string, version int32) (*release.Release, error) {
|
||||
func (c *FakeClient) ReleaseContent(rlsName string, version int) (*release.Release, error) {
|
||||
for _, rel := range c.Rels {
|
||||
if rel.Name == rlsName {
|
||||
return rel, nil
|
||||
|
@ -132,7 +132,7 @@ func (c *FakeClient) ReleaseContent(rlsName string, version int32) (*release.Rel
|
|||
}
|
||||
|
||||
// ReleaseHistory returns a release's revision history.
|
||||
func (c *FakeClient) ReleaseHistory(rlsName string, max int32) ([]*release.Release, error) {
|
||||
func (c *FakeClient) ReleaseHistory(rlsName string, max int) ([]*release.Release, error) {
|
||||
return c.Rels, nil
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ func (c *FakeClient) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (
|
|||
for m, s := range c.Responses {
|
||||
wg.Add(1)
|
||||
|
||||
go func(msg string, status release.TestRun_Status) {
|
||||
go func(msg string, status release.TestRunStatus) {
|
||||
defer wg.Done()
|
||||
results <- &hapi.TestReleaseResponse{Msg: msg, Status: status}
|
||||
}(m, s)
|
||||
|
@ -179,9 +179,9 @@ metadata:
|
|||
// MockReleaseOptions allows for user-configurable options on mock release objects.
|
||||
type MockReleaseOptions struct {
|
||||
Name string
|
||||
Version int32
|
||||
Version int
|
||||
Chart *chart.Chart
|
||||
StatusCode release.Status_Code
|
||||
StatusCode release.StatusCode
|
||||
Namespace string
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release {
|
|||
name = "testrelease-" + string(rand.Intn(100))
|
||||
}
|
||||
|
||||
var version int32 = 1
|
||||
var version int = 1
|
||||
if opts.Version != 0 {
|
||||
version = opts.Version
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release {
|
|||
Path: "pre-install-hook.yaml",
|
||||
Manifest: MockHookTemplate,
|
||||
LastRun: date,
|
||||
Events: []release.Hook_Event{release.Hook_PRE_INSTALL},
|
||||
Events: []release.HookEvent{release.Hook_PRE_INSTALL},
|
||||
},
|
||||
},
|
||||
Manifest: MockManifest,
|
||||
|
|
|
@ -40,9 +40,9 @@ func TestListReleases_VerifyOptions(t *testing.T) {
|
|||
var limit = 2
|
||||
var offset = "offset"
|
||||
var filter = "filter"
|
||||
var sortBy = int32(2)
|
||||
var sortOrd = int32(1)
|
||||
var codes = []rls.Status_Code{
|
||||
var sortBy = 2
|
||||
var sortOrd = 1
|
||||
var codes = []rls.StatusCode{
|
||||
rls.Status_FAILED,
|
||||
rls.Status_DELETED,
|
||||
rls.Status_DEPLOYED,
|
||||
|
@ -55,8 +55,8 @@ func TestListReleases_VerifyOptions(t *testing.T) {
|
|||
Limit: int64(limit),
|
||||
Offset: offset,
|
||||
Filter: filter,
|
||||
SortBy: hapi.ListSort_SortBy(sortBy),
|
||||
SortOrder: hapi.ListSort_SortOrder(sortOrd),
|
||||
SortBy: hapi.ListSortBy(sortBy),
|
||||
SortOrder: hapi.ListSortOrder(sortOrd),
|
||||
StatusCodes: codes,
|
||||
Namespace: namespace,
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func TestRollbackRelease_VerifyOptions(t *testing.T) {
|
|||
// Options testdata
|
||||
var disableHooks = true
|
||||
var releaseName = "test"
|
||||
var revision = int32(2)
|
||||
var revision = 2
|
||||
var dryRun = true
|
||||
|
||||
// Expected RollbackReleaseRequest message
|
||||
|
@ -283,7 +283,7 @@ func TestRollbackRelease_VerifyOptions(t *testing.T) {
|
|||
func TestReleaseStatus_VerifyOptions(t *testing.T) {
|
||||
// Options testdata
|
||||
var releaseName = "test"
|
||||
var revision = int32(2)
|
||||
var revision = 2
|
||||
|
||||
// Expected GetReleaseStatusRequest message
|
||||
exp := &hapi.GetReleaseStatusRequest{
|
||||
|
@ -317,7 +317,7 @@ func TestReleaseContent_VerifyOptions(t *testing.T) {
|
|||
t.Skip("refactoring out")
|
||||
// Options testdata
|
||||
var releaseName = "test"
|
||||
var revision = int32(2)
|
||||
var revision = 2
|
||||
|
||||
// Expected GetReleaseContentRequest message
|
||||
exp := &hapi.GetReleaseContentRequest{
|
||||
|
|
|
@ -28,11 +28,11 @@ type Interface interface {
|
|||
InstallRelease(chStr, namespace string, opts ...InstallOption) (*release.Release, error)
|
||||
InstallReleaseFromChart(chart *chart.Chart, namespace string, opts ...InstallOption) (*release.Release, error)
|
||||
DeleteRelease(rlsName string, opts ...DeleteOption) (*hapi.UninstallReleaseResponse, error)
|
||||
ReleaseStatus(rlsName string, version int32) (*hapi.GetReleaseStatusResponse, error)
|
||||
ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error)
|
||||
UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*release.Release, error)
|
||||
UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*release.Release, error)
|
||||
RollbackRelease(rlsName string, opts ...RollbackOption) (*release.Release, error)
|
||||
ReleaseContent(rlsName string, version int32) (*release.Release, error)
|
||||
ReleaseHistory(rlsName string, max int32) ([]*release.Release, error)
|
||||
ReleaseContent(rlsName string, version int) (*release.Release, error)
|
||||
ReleaseHistory(rlsName string, max int) ([]*release.Release, error)
|
||||
RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-chan *hapi.TestReleaseResponse, <-chan error)
|
||||
}
|
||||
|
|
|
@ -116,24 +116,24 @@ func ReleaseListLimit(limit int) ReleaseListOption {
|
|||
}
|
||||
|
||||
// ReleaseListOrder specifies how to order a list of releases.
|
||||
func ReleaseListOrder(order int32) ReleaseListOption {
|
||||
func ReleaseListOrder(order int) ReleaseListOption {
|
||||
return func(opts *options) {
|
||||
opts.listReq.SortOrder = hapi.ListSort_SortOrder(order)
|
||||
opts.listReq.SortOrder = hapi.ListSortOrder(order)
|
||||
}
|
||||
}
|
||||
|
||||
// ReleaseListSort specifies how to sort a release list.
|
||||
func ReleaseListSort(sort int32) ReleaseListOption {
|
||||
func ReleaseListSort(sort int) ReleaseListOption {
|
||||
return func(opts *options) {
|
||||
opts.listReq.SortBy = hapi.ListSort_SortBy(sort)
|
||||
opts.listReq.SortBy = hapi.ListSortBy(sort)
|
||||
}
|
||||
}
|
||||
|
||||
// ReleaseListStatuses specifies which status codes should be returned.
|
||||
func ReleaseListStatuses(statuses []release.Status_Code) ReleaseListOption {
|
||||
func ReleaseListStatuses(statuses []release.StatusCode) ReleaseListOption {
|
||||
return func(opts *options) {
|
||||
if len(statuses) == 0 {
|
||||
statuses = []release.Status_Code{release.Status_DEPLOYED}
|
||||
statuses = []release.StatusCode{release.Status_DEPLOYED}
|
||||
}
|
||||
opts.listReq.StatusCodes = statuses
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ func RollbackForce(force bool) RollbackOption {
|
|||
}
|
||||
|
||||
// RollbackVersion sets the version of the release to deploy.
|
||||
func RollbackVersion(ver int32) RollbackOption {
|
||||
func RollbackVersion(ver int) RollbackOption {
|
||||
return func(opts *options) {
|
||||
opts.rollbackReq.Version = ver
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
|
||||
|
@ -52,7 +51,6 @@ func Chartfile(linter *support.Linter) {
|
|||
|
||||
// Chart metadata
|
||||
linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartVersion(chartFile))
|
||||
linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartEngine(chartFile))
|
||||
linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartMaintainer(chartFile))
|
||||
linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartSources(chartFile))
|
||||
linter.RunLinterRule(support.InfoSev, chartFileName, validateChartIconPresence(chartFile))
|
||||
|
@ -113,29 +111,6 @@ func validateChartVersion(cf *chart.Metadata) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateChartEngine(cf *chart.Metadata) error {
|
||||
if cf.Engine == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
keys := make([]string, 0, len(chart.Metadata_Engine_value))
|
||||
for engine := range chart.Metadata_Engine_value {
|
||||
str := strings.ToLower(engine)
|
||||
|
||||
if str == "unknown" {
|
||||
continue
|
||||
}
|
||||
|
||||
if str == cf.Engine {
|
||||
return nil
|
||||
}
|
||||
|
||||
keys = append(keys, str)
|
||||
}
|
||||
|
||||
return fmt.Errorf("engine '%v' not valid. Valid options are %v", cf.Engine, keys)
|
||||
}
|
||||
|
||||
func validateChartMaintainer(cf *chart.Metadata) error {
|
||||
for _, maintainer := range cf.Maintainers {
|
||||
if maintainer.Name == "" {
|
||||
|
|
|
@ -120,24 +120,6 @@ func TestValidateChartVersion(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestValidateChartEngine(t *testing.T) {
|
||||
var successTest = []string{"", "gotpl"}
|
||||
|
||||
for _, engine := range successTest {
|
||||
badChart.Engine = engine
|
||||
err := validateChartEngine(badChart)
|
||||
if err != nil {
|
||||
t.Errorf("validateChartEngine(%s) to return no error, got a linter error %s", engine, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
badChart.Engine = "foobar"
|
||||
err := validateChartEngine(badChart)
|
||||
if err == nil || !strings.Contains(err.Error(), "not valid. Valid options are [gotpl") {
|
||||
t.Errorf("validateChartEngine(%s) to return an error, got no error", badChart.Engine)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateChartMaintainer(t *testing.T) {
|
||||
var failTest = []struct {
|
||||
Name string
|
||||
|
|
|
@ -105,7 +105,7 @@ func (env *Environment) streamUnknown(name, info string) error {
|
|||
return env.streamMessage(msg, release.TestRun_UNKNOWN)
|
||||
}
|
||||
|
||||
func (env *Environment) streamMessage(msg string, status release.TestRun_Status) error {
|
||||
func (env *Environment) streamMessage(msg string, status release.TestRunStatus) error {
|
||||
resp := &hapi.TestReleaseResponse{Msg: msg, Status: status}
|
||||
env.Mesages <- resp
|
||||
return nil
|
||||
|
|
|
@ -243,7 +243,7 @@ func releaseStub() *release.Release {
|
|||
Kind: "Pod",
|
||||
Path: "finding-nemo",
|
||||
Manifest: manifestWithTestSuccessHook,
|
||||
Events: []release.Hook_Event{
|
||||
Events: []release.HookEvent{
|
||||
release.Hook_RELEASE_TEST_SUCCESS,
|
||||
},
|
||||
},
|
||||
|
@ -252,7 +252,7 @@ func releaseStub() *release.Release {
|
|||
Kind: "ConfigMap",
|
||||
Path: "test-cm",
|
||||
Manifest: manifestWithInstallHooks,
|
||||
Events: []release.Hook_Event{
|
||||
Events: []release.HookEvent{
|
||||
release.Hook_POST_INSTALL,
|
||||
release.Hook_PRE_DELETE,
|
||||
},
|
||||
|
|
|
@ -68,7 +68,7 @@ func All(filters ...FilterFunc) FilterFunc {
|
|||
}
|
||||
|
||||
// StatusFilter filters a set of releases by status code.
|
||||
func StatusFilter(status rspb.Status_Code) FilterFunc {
|
||||
func StatusFilter(status rspb.StatusCode) FilterFunc {
|
||||
return FilterFunc(func(rls *rspb.Release) bool {
|
||||
if rls == nil {
|
||||
return true
|
||||
|
|
|
@ -31,9 +31,9 @@ func TestFilterAny(t *testing.T) {
|
|||
r0, r1 := ls[0], ls[1]
|
||||
switch {
|
||||
case r0.Info.Status.Code != rspb.Status_DELETED:
|
||||
t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.Code)
|
||||
t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.Code.String())
|
||||
case r1.Info.Status.Code != rspb.Status_DELETED:
|
||||
t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.Code)
|
||||
t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.Code.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ var releases = []*rspb.Release{
|
|||
tsRelease("vocal-dogs", 3, 6000, rspb.Status_DELETED),
|
||||
}
|
||||
|
||||
func tsRelease(name string, vers int32, dur time.Duration, code rspb.Status_Code) *rspb.Release {
|
||||
func tsRelease(name string, vers int, dur time.Duration, code rspb.StatusCode) *rspb.Release {
|
||||
tmsp := time.Now().Add(time.Duration(dur))
|
||||
info := &rspb.Info{Status: &rspb.Status{Code: code}, LastDeployed: tmsp}
|
||||
return &rspb.Release{
|
||||
|
|
|
@ -244,8 +244,8 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*v1.ConfigM
|
|||
// apply labels
|
||||
lbs.set("NAME", rls.Name)
|
||||
lbs.set("OWNER", owner)
|
||||
lbs.set("STATUS", rspb.Status_Code_name[int32(rls.Info.Status.Code)])
|
||||
lbs.set("VERSION", strconv.Itoa(int(rls.Version)))
|
||||
lbs.set("STATUS", rls.Info.Status.Code.String())
|
||||
lbs.set("VERSION", strconv.Itoa(rls.Version))
|
||||
|
||||
// create and return configmap object
|
||||
return &v1.ConfigMap{
|
||||
|
|
|
@ -32,7 +32,7 @@ func TestConfigMapName(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestConfigMapGet(t *testing.T) {
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -52,7 +52,7 @@ func TestConfigMapGet(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUNcompressedConfigMapGet(t *testing.T) {
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -133,7 +133,7 @@ func TestConfigMapList(t *testing.T) {
|
|||
func TestConfigMapCreate(t *testing.T) {
|
||||
cfgmaps := newTestFixtureCfgMaps(t)
|
||||
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -157,7 +157,7 @@ func TestConfigMapCreate(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestConfigMapUpdate(t *testing.T) {
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -181,6 +181,6 @@ func TestConfigMapUpdate(t *testing.T) {
|
|||
|
||||
// check release has actually been updated by comparing modified fields
|
||||
if rel.Info.Status.Code != got.Info.Status.Code {
|
||||
t.Errorf("Expected status %s, got status %s", rel.Info.Status.Code, got.Info.Status.Code)
|
||||
t.Errorf("Expected status %s, got status %s", rel.Info.Status.Code.String(), got.Info.Status.Code.String())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
rspb "k8s.io/helm/pkg/hapi/release"
|
||||
)
|
||||
|
||||
func releaseStub(name string, vers int32, namespace string, code rspb.Status_Code) *rspb.Release {
|
||||
func releaseStub(name string, vers int, namespace string, code rspb.StatusCode) *rspb.Release {
|
||||
return &rspb.Release{
|
||||
Name: name,
|
||||
Version: vers,
|
||||
|
@ -37,7 +37,7 @@ func releaseStub(name string, vers int32, namespace string, code rspb.Status_Cod
|
|||
}
|
||||
}
|
||||
|
||||
func testKey(name string, vers int32) string {
|
||||
func testKey(name string, vers int) string {
|
||||
return fmt.Sprintf("%s.v%d", name, vers)
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ func (rs *records) Replace(key string, rec *record) *record {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (rs records) FindByVersion(vers int32) (int, bool) {
|
||||
func (rs records) FindByVersion(vers int) (int, bool) {
|
||||
i := sort.Search(len(rs), func(i int) bool {
|
||||
return rs[i].rls.Version == vers
|
||||
})
|
||||
|
@ -126,8 +126,8 @@ func newRecord(key string, rls *rspb.Release) *record {
|
|||
lbs.init()
|
||||
lbs.set("NAME", rls.Name)
|
||||
lbs.set("OWNER", "TILLER")
|
||||
lbs.set("STATUS", rspb.Status_Code_name[int32(rls.Info.Status.Code)])
|
||||
lbs.set("VERSION", strconv.Itoa(int(rls.Version)))
|
||||
lbs.set("STATUS", rls.Info.Status.Code.String())
|
||||
lbs.set("VERSION", strconv.Itoa(rls.Version))
|
||||
|
||||
// return &record{key: key, lbs: lbs, rls: proto.Clone(rls).(*rspb.Release)}
|
||||
return &record{key: key, lbs: lbs, rls: rls}
|
||||
|
|
|
@ -244,8 +244,8 @@ func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*v1.Secret, er
|
|||
// apply labels
|
||||
lbs.set("NAME", rls.Name)
|
||||
lbs.set("OWNER", owner)
|
||||
lbs.set("STATUS", rspb.Status_Code_name[int32(rls.Info.Status.Code)])
|
||||
lbs.set("VERSION", strconv.Itoa(int(rls.Version)))
|
||||
lbs.set("STATUS", rls.Info.Status.Code.String())
|
||||
lbs.set("VERSION", strconv.Itoa(rls.Version))
|
||||
|
||||
// create and return secret object
|
||||
return &v1.Secret{
|
||||
|
|
|
@ -32,7 +32,7 @@ func TestSecretName(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSecretGet(t *testing.T) {
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -52,7 +52,7 @@ func TestSecretGet(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUNcompressedSecretGet(t *testing.T) {
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -133,7 +133,7 @@ func TestSecretList(t *testing.T) {
|
|||
func TestSecretCreate(t *testing.T) {
|
||||
secrets := newTestFixtureSecrets(t)
|
||||
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -157,7 +157,7 @@ func TestSecretCreate(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSecretUpdate(t *testing.T) {
|
||||
vers := int32(1)
|
||||
vers := 1
|
||||
name := "smug-pigeon"
|
||||
namespace := "default"
|
||||
key := testKey(name, vers)
|
||||
|
@ -181,6 +181,6 @@ func TestSecretUpdate(t *testing.T) {
|
|||
|
||||
// check release has actually been updated by comparing modified fields
|
||||
if rel.Info.Status.Code != got.Info.Status.Code {
|
||||
t.Errorf("Expected status %s, got status %s", rel.Info.Status.Code, got.Info.Status.Code)
|
||||
t.Errorf("Expected status %s, got status %s", rel.Info.Status.Code.String(), got.Info.Status.Code.String())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ type Storage struct {
|
|||
// Get retrieves the release from storage. An error is returned
|
||||
// if the storage driver failed to fetch the release, or the
|
||||
// release identified by the key, version pair does not exist.
|
||||
func (s *Storage) Get(name string, version int32) (*rspb.Release, error) {
|
||||
func (s *Storage) Get(name string, version int) (*rspb.Release, error) {
|
||||
s.Log("getting release %q", makeKey(name, version))
|
||||
return s.Driver.Get(makeKey(name, version))
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func (s *Storage) Update(rls *rspb.Release) error {
|
|||
// Delete deletes the release from storage. An error is returned if
|
||||
// the storage backend fails to delete the release or if the release
|
||||
// does not exist.
|
||||
func (s *Storage) Delete(name string, version int32) (*rspb.Release, error) {
|
||||
func (s *Storage) Delete(name string, version int) (*rspb.Release, error) {
|
||||
s.Log("deleting release %q", makeKey(name, version))
|
||||
return s.Driver.Delete(makeKey(name, version))
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ func (s *Storage) Last(name string) (*rspb.Release, error) {
|
|||
// makeKey concatenates a release name and version into
|
||||
// a string with format ```<release_name>#v<version>```.
|
||||
// This key is used to uniquely identify storage objects.
|
||||
func makeKey(rlsname string, version int32) string {
|
||||
func makeKey(rlsname string, version int) string {
|
||||
return fmt.Sprintf("%s.v%d", rlsname, version)
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ func TestStorageDeployed(t *testing.T) {
|
|||
storage := Init(driver.NewMemory())
|
||||
|
||||
const name = "angry-bird"
|
||||
const vers = int32(4)
|
||||
const vers = 4
|
||||
|
||||
// setup storage with test releases
|
||||
setup := func() {
|
||||
|
@ -201,7 +201,7 @@ func TestStorageDeployed(t *testing.T) {
|
|||
case rls.Version != vers:
|
||||
t.Fatalf("Expected release version %d, actual %d\n", vers, rls.Version)
|
||||
case rls.Info.Status.Code != rspb.Status_DEPLOYED:
|
||||
t.Fatalf("Expected release status 'DEPLOYED', actual %s\n", rls.Info.Status.Code)
|
||||
t.Fatalf("Expected release status 'DEPLOYED', actual %s\n", rls.Info.Status.Code.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ func TestStorageRemoveLeastRecent(t *testing.T) {
|
|||
|
||||
// We expect the existing records to be 3, 4, and 5.
|
||||
for i, item := range hist {
|
||||
v := int(item.Version)
|
||||
v := item.Version
|
||||
if expect := i + 3; v != expect {
|
||||
t.Errorf("Expected release %d, got %d", expect, v)
|
||||
}
|
||||
|
@ -327,10 +327,10 @@ func TestStorageLast(t *testing.T) {
|
|||
|
||||
type ReleaseTestData struct {
|
||||
Name string
|
||||
Version int32
|
||||
Version int
|
||||
Manifest string
|
||||
Namespace string
|
||||
Status rspb.Status_Code
|
||||
Status rspb.StatusCode
|
||||
}
|
||||
|
||||
func (test ReleaseTestData) ToRelease() *rspb.Release {
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
util "k8s.io/helm/pkg/releaseutil"
|
||||
)
|
||||
|
||||
var events = map[string]release.Hook_Event{
|
||||
var events = map[string]release.HookEvent{
|
||||
hooks.PreInstall: release.Hook_PRE_INSTALL,
|
||||
hooks.PostInstall: release.Hook_POST_INSTALL,
|
||||
hooks.PreDelete: release.Hook_PRE_DELETE,
|
||||
|
@ -45,7 +45,7 @@ var events = map[string]release.Hook_Event{
|
|||
}
|
||||
|
||||
// deletePolices represents a mapping between the key in the annotation for label deleting policy and its real meaning
|
||||
var deletePolices = map[string]release.Hook_DeletePolicy{
|
||||
var deletePolices = map[string]release.HookDeletePolicy{
|
||||
hooks.HookSucceeded: release.Hook_SUCCEEDED,
|
||||
hooks.HookFailed: release.Hook_FAILED,
|
||||
hooks.BeforeHookCreation: release.Hook_BEFORE_HOOK_CREATION,
|
||||
|
@ -167,9 +167,9 @@ func (file *manifestFile) sort(result *result) error {
|
|||
Kind: entry.Kind,
|
||||
Path: file.path,
|
||||
Manifest: m,
|
||||
Events: []release.Hook_Event{},
|
||||
Events: []release.HookEvent{},
|
||||
Weight: hw,
|
||||
DeletePolicies: []release.Hook_DeletePolicy{},
|
||||
DeletePolicies: []release.HookDeletePolicy{},
|
||||
}
|
||||
|
||||
isUnknownHook := false
|
||||
|
@ -213,14 +213,13 @@ func hasAnyAnnotation(entry util.SimpleHead) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func calculateHookWeight(entry util.SimpleHead) int32 {
|
||||
func calculateHookWeight(entry util.SimpleHead) int {
|
||||
hws := entry.Metadata.Annotations[hooks.HookWeightAnno]
|
||||
hw, err := strconv.Atoi(hws)
|
||||
if err != nil {
|
||||
hw = 0
|
||||
}
|
||||
|
||||
return int32(hw)
|
||||
return hw
|
||||
}
|
||||
|
||||
func operateAnnotationValues(entry util.SimpleHead, annotation string, operate func(p string)) {
|
||||
|
|
|
@ -33,14 +33,14 @@ func TestSortManifests(t *testing.T) {
|
|||
name []string
|
||||
path string
|
||||
kind []string
|
||||
hooks map[string][]release.Hook_Event
|
||||
hooks map[string][]release.HookEvent
|
||||
manifest string
|
||||
}{
|
||||
{
|
||||
name: []string{"first"},
|
||||
path: "one",
|
||||
kind: []string{"Job"},
|
||||
hooks: map[string][]release.Hook_Event{"first": {release.Hook_PRE_INSTALL}},
|
||||
hooks: map[string][]release.HookEvent{"first": {release.Hook_PRE_INSTALL}},
|
||||
manifest: `apiVersion: v1
|
||||
kind: Job
|
||||
metadata:
|
||||
|
@ -55,7 +55,7 @@ metadata:
|
|||
name: []string{"second"},
|
||||
path: "two",
|
||||
kind: []string{"ReplicaSet"},
|
||||
hooks: map[string][]release.Hook_Event{"second": {release.Hook_POST_INSTALL}},
|
||||
hooks: map[string][]release.HookEvent{"second": {release.Hook_POST_INSTALL}},
|
||||
manifest: `kind: ReplicaSet
|
||||
apiVersion: v1beta1
|
||||
metadata:
|
||||
|
@ -67,7 +67,7 @@ metadata:
|
|||
name: []string{"third"},
|
||||
path: "three",
|
||||
kind: []string{"ReplicaSet"},
|
||||
hooks: map[string][]release.Hook_Event{"third": nil},
|
||||
hooks: map[string][]release.HookEvent{"third": nil},
|
||||
manifest: `kind: ReplicaSet
|
||||
apiVersion: v1beta1
|
||||
metadata:
|
||||
|
@ -79,7 +79,7 @@ metadata:
|
|||
name: []string{"fourth"},
|
||||
path: "four",
|
||||
kind: []string{"Pod"},
|
||||
hooks: map[string][]release.Hook_Event{"fourth": nil},
|
||||
hooks: map[string][]release.HookEvent{"fourth": nil},
|
||||
manifest: `kind: Pod
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
|
@ -90,7 +90,7 @@ metadata:
|
|||
name: []string{"fifth"},
|
||||
path: "five",
|
||||
kind: []string{"ReplicaSet"},
|
||||
hooks: map[string][]release.Hook_Event{"fifth": {release.Hook_POST_DELETE, release.Hook_POST_INSTALL}},
|
||||
hooks: map[string][]release.HookEvent{"fifth": {release.Hook_POST_DELETE, release.Hook_POST_INSTALL}},
|
||||
manifest: `kind: ReplicaSet
|
||||
apiVersion: v1beta1
|
||||
metadata:
|
||||
|
@ -103,21 +103,21 @@ metadata:
|
|||
name: []string{"sixth"},
|
||||
path: "six/_six",
|
||||
kind: []string{"ReplicaSet"},
|
||||
hooks: map[string][]release.Hook_Event{"sixth": nil},
|
||||
hooks: map[string][]release.HookEvent{"sixth": nil},
|
||||
manifest: `invalid manifest`, // This will fail if partial is not skipped.
|
||||
}, {
|
||||
// Regression test: files with no content should be skipped.
|
||||
name: []string{"seventh"},
|
||||
path: "seven",
|
||||
kind: []string{"ReplicaSet"},
|
||||
hooks: map[string][]release.Hook_Event{"seventh": nil},
|
||||
hooks: map[string][]release.HookEvent{"seventh": nil},
|
||||
manifest: "",
|
||||
},
|
||||
{
|
||||
name: []string{"eighth", "example-test"},
|
||||
path: "eight",
|
||||
kind: []string{"ConfigMap", "Pod"},
|
||||
hooks: map[string][]release.Hook_Event{"eighth": nil, "example-test": {release.Hook_RELEASE_TEST_SUCCESS}},
|
||||
hooks: map[string][]release.HookEvent{"eighth": nil, "example-test": {release.Hook_RELEASE_TEST_SUCCESS}},
|
||||
manifest: `kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
|
|
|
@ -38,7 +38,7 @@ func (s *ReleaseServer) GetHistory(req *hapi.GetHistoryRequest) ([]*release.Rele
|
|||
relutil.Reverse(h, relutil.SortByRevision)
|
||||
|
||||
var rels []*release.Release
|
||||
for i := 0; i < min(len(h), int(req.Max)); i++ {
|
||||
for i := 0; i < min(len(h), req.Max); i++ {
|
||||
rels = append(rels, h[i])
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
)
|
||||
|
||||
func TestGetHistory_WithRevisions(t *testing.T) {
|
||||
mk := func(name string, vers int32, code rpb.Status_Code) *rpb.Release {
|
||||
mk := func(name string, vers int, code rpb.StatusCode) *rpb.Release {
|
||||
return &rpb.Release{
|
||||
Name: name,
|
||||
Version: vers,
|
||||
|
|
|
@ -119,7 +119,7 @@ func (s *ReleaseServer) prepareRelease(req *hapi.InstallReleaseRequest) (*releas
|
|||
},
|
||||
Manifest: manifestDoc.String(),
|
||||
Hooks: hooks,
|
||||
Version: int32(revision),
|
||||
Version: revision,
|
||||
}
|
||||
if len(notesTxt) > 0 {
|
||||
rel.Info.Status.Notes = notesTxt
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
// ListReleases lists the releases found by the server.
|
||||
func (s *ReleaseServer) ListReleases(req *hapi.ListReleasesRequest) ([]*release.Release, error) {
|
||||
if len(req.StatusCodes) == 0 {
|
||||
req.StatusCodes = []release.Status_Code{release.Status_DEPLOYED}
|
||||
req.StatusCodes = []release.StatusCode{release.Status_DEPLOYED}
|
||||
}
|
||||
|
||||
rels, err := s.env.Releases.ListFilterAll(func(r *release.Release) bool {
|
||||
|
|
|
@ -60,24 +60,24 @@ func TestListReleasesByStatus(t *testing.T) {
|
|||
}
|
||||
|
||||
tests := []struct {
|
||||
statusCodes []release.Status_Code
|
||||
statusCodes []release.StatusCode
|
||||
names []string
|
||||
}{
|
||||
{
|
||||
names: []string{"kamal"},
|
||||
statusCodes: []release.Status_Code{release.Status_DEPLOYED},
|
||||
statusCodes: []release.StatusCode{release.Status_DEPLOYED},
|
||||
},
|
||||
{
|
||||
names: []string{"astrolabe"},
|
||||
statusCodes: []release.Status_Code{release.Status_DELETED},
|
||||
statusCodes: []release.StatusCode{release.Status_DELETED},
|
||||
},
|
||||
{
|
||||
names: []string{"kamal", "octant"},
|
||||
statusCodes: []release.Status_Code{release.Status_DEPLOYED, release.Status_FAILED},
|
||||
statusCodes: []release.StatusCode{release.Status_DEPLOYED, release.Status_FAILED},
|
||||
},
|
||||
{
|
||||
names: []string{"kamal", "astrolabe", "octant", "sextant"},
|
||||
statusCodes: []release.Status_Code{
|
||||
statusCodes: []release.StatusCode{
|
||||
release.Status_DEPLOYED,
|
||||
release.Status_DELETED,
|
||||
release.Status_FAILED,
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestRollbackRelease(t *testing.T) {
|
|||
Kind: "ConfigMap",
|
||||
Path: "test-cm",
|
||||
Manifest: manifestWithRollbackHooks,
|
||||
Events: []release.Hook_Event{
|
||||
Events: []release.HookEvent{
|
||||
release.Hook_PRE_ROLLBACK,
|
||||
release.Hook_POST_ROLLBACK,
|
||||
},
|
||||
|
@ -190,7 +190,7 @@ func TestRollbackReleaseNoHooks(t *testing.T) {
|
|||
Kind: "ConfigMap",
|
||||
Path: "test-cm",
|
||||
Manifest: manifestWithRollbackHooks,
|
||||
Events: []release.Hook_Event{
|
||||
Events: []release.HookEvent{
|
||||
release.Hook_PRE_ROLLBACK,
|
||||
release.Hook_POST_ROLLBACK,
|
||||
},
|
||||
|
|
|
@ -221,7 +221,7 @@ func releaseStub() *release.Release {
|
|||
return namedReleaseStub("angry-panda", release.Status_DEPLOYED)
|
||||
}
|
||||
|
||||
func namedReleaseStub(name string, status release.Status_Code) *release.Release {
|
||||
func namedReleaseStub(name string, status release.StatusCode) *release.Release {
|
||||
date := time.Unix(242085845, 0)
|
||||
return &release.Release{
|
||||
Name: name,
|
||||
|
@ -240,7 +240,7 @@ func namedReleaseStub(name string, status release.Status_Code) *release.Release
|
|||
Kind: "ConfigMap",
|
||||
Path: "test-cm",
|
||||
Manifest: manifestWithHook,
|
||||
Events: []release.Hook_Event{
|
||||
Events: []release.HookEvent{
|
||||
release.Hook_POST_INSTALL,
|
||||
release.Hook_PRE_DELETE,
|
||||
},
|
||||
|
@ -250,7 +250,7 @@ func namedReleaseStub(name string, status release.Status_Code) *release.Release
|
|||
Kind: "Pod",
|
||||
Path: "finding-nemo",
|
||||
Manifest: manifestWithTestHook,
|
||||
Events: []release.Hook_Event{
|
||||
Events: []release.HookEvent{
|
||||
release.Hook_RELEASE_TEST_SUCCESS,
|
||||
},
|
||||
},
|
||||
|
@ -513,7 +513,7 @@ func deletePolicyStub(kubeClient *mockHooksKubeClient) *ReleaseServer {
|
|||
}
|
||||
}
|
||||
|
||||
func deletePolicyHookStub(hookName string, extraAnnotations map[string]string, DeletePolicies []release.Hook_DeletePolicy) *release.Hook {
|
||||
func deletePolicyHookStub(hookName string, extraAnnotations map[string]string, DeletePolicies []release.HookDeletePolicy) *release.Hook {
|
||||
extraAnnotationsStr := ""
|
||||
for k, v := range extraAnnotations {
|
||||
extraAnnotationsStr += fmt.Sprintf(" \"%s\": \"%s\"\n", k, v)
|
||||
|
@ -530,7 +530,7 @@ metadata:
|
|||
"helm.sh/hook": pre-install,pre-upgrade
|
||||
%sdata:
|
||||
name: value`, hookName, extraAnnotationsStr),
|
||||
Events: []release.Hook_Event{
|
||||
Events: []release.HookEvent{
|
||||
release.Hook_PRE_INSTALL,
|
||||
release.Hook_PRE_UPGRADE,
|
||||
},
|
||||
|
@ -617,7 +617,7 @@ func TestSuccessfulHookWithSucceededDeletePolicy(t *testing.T) {
|
|||
ctx := newDeletePolicyContext()
|
||||
hook := deletePolicyHookStub(ctx.HookName,
|
||||
map[string]string{"helm.sh/hook-delete-policy": "hook-succeeded"},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED},
|
||||
)
|
||||
|
||||
err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -633,7 +633,7 @@ func TestSuccessfulHookWithFailedDeletePolicy(t *testing.T) {
|
|||
ctx := newDeletePolicyContext()
|
||||
hook := deletePolicyHookStub(ctx.HookName,
|
||||
map[string]string{"helm.sh/hook-delete-policy": "hook-failed"},
|
||||
[]release.Hook_DeletePolicy{release.Hook_FAILED},
|
||||
[]release.HookDeletePolicy{release.Hook_FAILED},
|
||||
)
|
||||
|
||||
err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -653,7 +653,7 @@ func TestFailedHookWithSucceededDeletePolicy(t *testing.T) {
|
|||
"mockHooksKubeClient/Emulate": "hook-failed",
|
||||
"helm.sh/hook-delete-policy": "hook-succeeded",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED},
|
||||
)
|
||||
|
||||
err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -673,7 +673,7 @@ func TestFailedHookWithFailedDeletePolicy(t *testing.T) {
|
|||
"mockHooksKubeClient/Emulate": "hook-failed",
|
||||
"helm.sh/hook-delete-policy": "hook-failed",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_FAILED},
|
||||
[]release.HookDeletePolicy{release.Hook_FAILED},
|
||||
)
|
||||
|
||||
err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -692,7 +692,7 @@ func TestSuccessfulHookWithSuccededOrFailedDeletePolicy(t *testing.T) {
|
|||
map[string]string{
|
||||
"helm.sh/hook-delete-policy": "hook-succeeded,hook-failed",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_FAILED},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED, release.Hook_FAILED},
|
||||
)
|
||||
|
||||
err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -712,7 +712,7 @@ func TestFailedHookWithSuccededOrFailedDeletePolicy(t *testing.T) {
|
|||
"mockHooksKubeClient/Emulate": "hook-failed",
|
||||
"helm.sh/hook-delete-policy": "hook-succeeded,hook-failed",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_FAILED},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED, release.Hook_FAILED},
|
||||
)
|
||||
|
||||
err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -753,7 +753,7 @@ func TestHookDeletingWithBeforeHookCreationDeletePolicy(t *testing.T) {
|
|||
|
||||
hook := deletePolicyHookStub(ctx.HookName,
|
||||
map[string]string{"helm.sh/hook-delete-policy": "before-hook-creation"},
|
||||
[]release.Hook_DeletePolicy{release.Hook_BEFORE_HOOK_CREATION},
|
||||
[]release.HookDeletePolicy{release.Hook_BEFORE_HOOK_CREATION},
|
||||
)
|
||||
|
||||
err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -782,7 +782,7 @@ func TestSuccessfulHookWithMixedDeletePolicies(t *testing.T) {
|
|||
map[string]string{
|
||||
"helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
)
|
||||
|
||||
err := execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -812,7 +812,7 @@ func TestFailedHookWithMixedDeletePolicies(t *testing.T) {
|
|||
"mockHooksKubeClient/Emulate": "hook-failed",
|
||||
"helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
)
|
||||
|
||||
err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -842,7 +842,7 @@ func TestFailedThenSuccessfulHookWithMixedDeletePolicies(t *testing.T) {
|
|||
"mockHooksKubeClient/Emulate": "hook-failed",
|
||||
"helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
)
|
||||
|
||||
err := execHookShouldFail(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreInstall)
|
||||
|
@ -858,7 +858,7 @@ func TestFailedThenSuccessfulHookWithMixedDeletePolicies(t *testing.T) {
|
|||
map[string]string{
|
||||
"helm.sh/hook-delete-policy": "hook-succeeded,before-hook-creation",
|
||||
},
|
||||
[]release.Hook_DeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
[]release.HookDeletePolicy{release.Hook_SUCCEEDED, release.Hook_BEFORE_HOOK_CREATION},
|
||||
)
|
||||
|
||||
err = execHookShouldSucceed(ctx.ReleaseServer, hook, ctx.ReleaseName, ctx.Namespace, hooks.PreUpgrade)
|
||||
|
|
|
@ -99,7 +99,7 @@ func (s *ReleaseServer) prepareUpdate(req *hapi.UpdateReleaseRequest) (*release.
|
|||
Time: ts,
|
||||
Namespace: currentRelease.Namespace,
|
||||
IsUpgrade: true,
|
||||
Revision: int(revision),
|
||||
Revision: revision,
|
||||
}
|
||||
|
||||
caps, err := capabilities(s.discovery)
|
||||
|
|
Loading…
Reference in New Issue