migrate from kubespray to library helm client
This commit is contained in:
@@ -5,13 +5,30 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
helm_client "github.com/mittwald/go-helm-client"
|
||||
)
|
||||
|
||||
var client *helm_client.Client
|
||||
type RepoSettings struct {
|
||||
Name string
|
||||
URL string
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
|
||||
func CreateHelmClient() helm_client.Client {
|
||||
type ChartSettings struct {
|
||||
ReleaseName string
|
||||
ChartRef string
|
||||
ChartVersion string
|
||||
Namespace string
|
||||
CreateNamespace bool
|
||||
Atomic bool
|
||||
Timeout time.Duration
|
||||
ValuesYaml string
|
||||
}
|
||||
|
||||
func GetHelmClient(namespace string) helm_client.Client {
|
||||
config := GetConfig()
|
||||
file, err := os.Open(filepath.Join(config.WorkDir, config.KubeconfigFile))
|
||||
if err != nil {
|
||||
@@ -24,7 +41,7 @@ func CreateHelmClient() helm_client.Client {
|
||||
}
|
||||
opts := &helm_client.KubeConfClientOptions{
|
||||
Options: &helm_client.Options{
|
||||
Namespace: "default", // Change this to the namespace you wish to install the chart in.
|
||||
Namespace: namespace,
|
||||
RepositoryCache: "/tmp/.helmcache",
|
||||
RepositoryConfig: "/tmp/.helmrepo",
|
||||
Debug: true,
|
||||
@@ -40,9 +57,6 @@ func CreateHelmClient() helm_client.Client {
|
||||
if err != nil {
|
||||
log.Fatalf("error while creating helm client: %s", err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
func GetHelmClient() *helm_client.Client {
|
||||
return client
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user