package registry 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 getHarborCertificateGeneratorSpec() go_helm_client.ChartSpec { appConfig := config.GetConfig() return go_helm_client.ChartSpec{ ReleaseName: "harbor-certificate-generator", ChartName: appConfig.Modules.Registry.Tls.CertificateGenerator.ChartRef, Version: appConfig.Modules.Registry.Tls.CertificateGenerator.ChartVersion, Namespace: appConfig.Modules.Registry.Namespace, CreateNamespace: true, Atomic: true, Timeout: time.Second * 60, ValuesYaml: templates.GetHelmValuesByTemplate("templates/helm-apps/releases/registry/harbor-certificate-generator.yml.tmpl"), } } func getHarborSpec() go_helm_client.ChartSpec { appConfig := config.GetConfig() return go_helm_client.ChartSpec{ ReleaseName: "harbor", ChartName: appConfig.Modules.Registry.ChartRef, Version: appConfig.Modules.Registry.ChartVersion, Namespace: appConfig.Modules.Registry.Namespace, CreateNamespace: true, Atomic: true, Timeout: time.Second * 600, ValuesYaml: templates.GetHelmValuesByTemplate("templates/helm-apps/releases/registry/harbor.yml.tmpl"), } } func ApplyCharts() { appConfig := config.GetConfig() helm_client.AddHelmRepos(appConfig.Modules.Registry.Namespace, HELM_REPOS) if appConfig.Modules.Registry.Enabled { if appConfig.Modules.Registry.Expose.Type == "ingress" { helm_client.InstallChart(getHarborCertificateGeneratorSpec()) } else { helm_client.DeleteChart(getHarborCertificateGeneratorSpec()) } helm_client.InstallChart(getHarborSpec()) } else { helm_client.DeleteChart(getHarborSpec()) helm_client.DeleteChart(getHarborCertificateGeneratorSpec()) } }