feat: support version in chart spec (separated from name by `:`).
@@ -3,6 +3,7 @@ package services
import (
"context"
"fmt"
+ "strings"
"github.com/epinio/epinio/helpers/tracelog"
"github.com/epinio/epinio/internal/helm"
@@ -79,6 +80,15 @@ func (s *ServiceClient) Get(ctx context.Context, namespace, name string) (*model
}
func (s *ServiceClient) Create(ctx context.Context, namespace, name string, catalogService models.CatalogService) error {
+
+ helmChartName := catalogService.HelmChart
+ helmChartVersion := ""
+ pieces := strings.SplitN(helmChartName, ":", 2)
+ if len(pieces) == 2 {
+ helmChartVersion = pieces[1]
+ helmChartName = pieces[0]
+ }
+
helmChart := &helmapiv1.HelmChart{
TypeMeta: metav1.TypeMeta{
APIVersion: "helm.cattle.io/v1",
@@ -95,7 +105,8 @@ func (s *ServiceClient) Create(ctx context.Context, namespace, name string, cata
},
Spec: helmapiv1.HelmChartSpec{
TargetNamespace: namespace,
- Chart: catalogService.HelmChart,
+ Chart: helmChartName,
+ Version: helmChartVersion,
Repo: catalogService.HelmRepo.URL,
ValuesContent: catalogService.Values,
},
