Skip to content

Commit 91b5264

Browse files
authored
Fix kit operator chart path (#182)
1 parent 97715e3 commit 91b5264

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

substrate/pkg/controller/substrate/cluster/addons/kitoperator.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ func (l *KITOperator) Create(ctx context.Context, substrate *v1alpha1.Substrate)
3333
if err := helm.NewClient(*substrate.Status.Cluster.KubeConfig).Apply(ctx, &helm.Chart{
3434
Namespace: "kit",
3535
Name: "kit-operator",
36-
Repository: "https://github.com/awslabs/kubernetes-iteration-toolkit/releases/download/latest",
37-
Version: "latest",
36+
Repository: "https://awslabs.github.io/kubernetes-iteration-toolkit",
3837
CreateNamespace: true,
3938
Values: map[string]interface{}{
4039
"controller": map[string]interface{}{"nodeSelector": map[string]interface{}{"kit.aws/substrate": "control-plane"}},

substrate/pkg/utils/helm/chart.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import (
2121

2222
"helm.sh/helm/v3/pkg/action"
2323
"helm.sh/helm/v3/pkg/chart/loader"
24+
"helm.sh/helm/v3/pkg/cli"
2425
"helm.sh/helm/v3/pkg/getter"
26+
"helm.sh/helm/v3/pkg/repo"
2527
"helm.sh/helm/v3/pkg/storage/driver"
2628
"k8s.io/cli-runtime/pkg/genericclioptions"
2729
"knative.dev/pkg/logging"
@@ -47,9 +49,16 @@ type Chart struct {
4749
Values map[string]interface{}
4850
}
4951

50-
func (c *Client) Apply(ctx context.Context, chart *Chart) error {
52+
func (c *Client) Apply(ctx context.Context, chart *Chart) (err error) {
5153
// Get the chart from the repository
52-
charts, err := c.httpGetter.Get(fmt.Sprintf("%s/%s-%s.tgz", chart.Repository, chart.Name, chart.Version))
54+
chartPath := fmt.Sprintf("%s/%s-%s.tgz", chart.Repository, chart.Name, chart.Version)
55+
if chart.Version == "" {
56+
chartPath, err = repo.FindChartInRepoURL(chart.Repository, chart.Name, "", "", "", "", getter.All(&cli.EnvSettings{}))
57+
if err != nil {
58+
return fmt.Errorf("failed to find chart, %w", err)
59+
}
60+
}
61+
charts, err := c.httpGetter.Get(chartPath)
5362
if err != nil {
5463
return fmt.Errorf("getting chart, %w", err)
5564
}

0 commit comments

Comments
 (0)