This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +25
-32
lines changed Expand file tree Collapse file tree 3 files changed +25
-32
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,6 @@ type ComposeProject struct {
18
18
Name string `yaml:"-" json:"-"`
19
19
}
20
20
21
- type ComposeResult struct {
22
- Info string
23
- Status string
24
- Descriptin string
25
- }
26
-
27
21
func Load (name string , configpaths []string ) (* ComposeProject , error ) {
28
22
if name == "" {
29
23
name = "docker-compose"
@@ -68,3 +62,7 @@ func (cp *ComposeProject) Install(name, path string) error {
68
62
func (cp * ComposeProject ) Uninstall (name string ) error {
69
63
return cp .helm .Uninstall (name )
70
64
}
65
+
66
+ func (cp * ComposeProject ) List () (map [string ]interface {}, error ) {
67
+ return cp .helm .ListReleases ()
68
+ }
Original file line number Diff line number Diff line change @@ -11,34 +11,11 @@ import (
11
11
"github.com/docker/helm-prototype/pkg/compose/internal/utils"
12
12
chart "helm.sh/helm/v3/pkg/chart"
13
13
util "helm.sh/helm/v3/pkg/chartutil"
14
+ helmenv "helm.sh/helm/v3/pkg/cli"
14
15
)
15
16
16
- // Kind is "kubernetes" or "docker"
17
- type Kind string
18
-
19
- const (
20
- // Kubernetes specifies to use a kubernetes cluster.
21
- Kubernetes Kind = "kubernetes"
22
- // Docker specifies to use Docker engine.
23
- DockerEngine Kind = "docker"
24
- )
25
-
26
- type Engine struct {
27
- Namespace string
28
-
29
- Kind Kind
30
-
31
- Config string
32
- // Context is the name of the kubeconfig/docker context.
33
- Context string
34
- // Token used for authentication (kubernetes)
35
- Token string
36
- // Kubernetes API Server Endpoint for authentication
37
- APIServer string
38
- }
39
-
40
- func GetDefault () * Engine {
41
- return & Engine {Kind : Kubernetes }
17
+ func GetDefault () * helmenv.EnvSettings {
18
+ return helmenv .New ()
42
19
}
43
20
44
21
func Environment () map [string ]string {
Original file line number Diff line number Diff line change @@ -95,3 +95,21 @@ func (hc *HelmActions) Get(name string) (*release.Release, error) {
95
95
actGet := action .NewGet (hc .Config )
96
96
return actGet .Run (name )
97
97
}
98
+
99
+ func (hc * HelmActions ) ListReleases () (map [string ]interface {}, error ) {
100
+ hc .initKubeClient ()
101
+
102
+ actList := action .NewList (hc .Config )
103
+ releases , err := actList .Run ()
104
+ if err != nil {
105
+ return map [string ]interface {}{}, err
106
+ }
107
+ result := map [string ]interface {}{}
108
+ for _ , rel := range releases {
109
+ result [rel .Name ] = map [string ]string {
110
+ "Status" : string (rel .Info .Status ),
111
+ "Description" : rel .Info .Description ,
112
+ }
113
+ }
114
+ return result , nil
115
+ }
You can’t perform that action at this time.
0 commit comments