This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
/
release.go
75 lines (66 loc) · 2.14 KB
/
release.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package helm
import "time"
// Define release statuses
const (
// StatusUnknown indicates that a release is in an uncertain state
StatusUnknown Status = "unknown"
// StatusDeployed indicates that the release has been pushed to Kubernetes
StatusDeployed Status = "deployed"
// StatusUninstalled indicates that a release has been uninstalled from Kubernetes
StatusUninstalled Status = "uninstalled"
// StatusSuperseded indicates that this release object is outdated and a newer one exists
StatusSuperseded Status = "superseded"
// StatusFailed indicates that the release was not successfully deployed
StatusFailed Status = "failed"
// StatusUninstalling indicates that a uninstall operation is underway
StatusUninstalling Status = "uninstalling"
// StatusPendingInstall indicates that an install operation is underway
StatusPendingInstall Status = "pending-install"
// StatusPendingUpgrade indicates that an upgrade operation is underway
StatusPendingUpgrade Status = "pending-upgrade"
// StatusPendingRollback indicates that an rollback operation is underway
StatusPendingRollback Status = "pending-rollback"
)
// Release describes a generic chart deployment
type Release struct {
Name string
Namespace string
Chart *Chart
Info *Info
Values map[string]interface{}
Manifest string
Version int
}
// Info holds metadata of a chart deployment
type Info struct {
LastDeployed time.Time
Description string
Status Status
}
// Chart describes the chart for a release
type Chart struct {
Name string
Version string
AppVersion string
Values Values
Templates []*File
}
// File represents a file as a name/value pair.
// The name is a relative path within the scope
// of the chart's base directory.
type File struct {
Name string
Data []byte
}
// Status holds the status of a release
type Status string
// AllowsUpgrade returns true if the status allows the release
// to be upgraded. This is currently only the case if it equals
// `StatusDeployed`.
func (s Status) AllowsUpgrade() bool {
return s == StatusDeployed
}
// String returns the Status as a string
func (s Status) String() string {
return string(s)
}