migrate from kubespray to library helm client
This commit is contained in:
44
internal/secrets_storage/helm.go
Normal file
44
internal/secrets_storage/helm.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package secrets_storage
|
||||
|
||||
import (
|
||||
"kube-forge/internal/config"
|
||||
"kube-forge/internal/helm_client"
|
||||
"kube-forge/internal/templates"
|
||||
"time"
|
||||
|
||||
go_helm_client "github.com/mittwald/go-helm-client"
|
||||
)
|
||||
|
||||
var HELM_REPOS = []config.RepoSettings{
|
||||
{
|
||||
Name: "kube-forge",
|
||||
URL: "https://git.kvazaric.ru/api/v4/projects/41/packages/helm/stable",
|
||||
},
|
||||
}
|
||||
|
||||
func getVaultSpec() go_helm_client.ChartSpec {
|
||||
appConfig := config.GetConfig()
|
||||
return go_helm_client.ChartSpec{
|
||||
ReleaseName: "vault",
|
||||
ChartName: appConfig.Modules.SecretsStorage.ChartRef,
|
||||
Version: appConfig.Modules.SecretsStorage.ChartVersion,
|
||||
Namespace: appConfig.Modules.SecretsStorage.Namespace,
|
||||
CreateNamespace: true,
|
||||
Atomic: true,
|
||||
Timeout: time.Second * 600,
|
||||
ValuesYaml: templates.GetHelmValuesByTemplate("templates/helm-apps/releases/secrets-storage/vault.yml.tmpl"),
|
||||
}
|
||||
}
|
||||
|
||||
func ApplyCharts() {
|
||||
appConfig := config.GetConfig()
|
||||
helm_client.AddHelmRepos(appConfig.Modules.SecretsStorage.Namespace, HELM_REPOS)
|
||||
if appConfig.Modules.SecretsStorage.Enabled {
|
||||
helm_client.InstallChart(getVaultSpec())
|
||||
initVault()
|
||||
unsealVault()
|
||||
addKubernetesLocalIntegration()
|
||||
} else {
|
||||
helm_client.DeleteChart(getVaultSpec())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user