Skip to content

Commit d2e2d6f

Browse files
committed
fix: get rid of kargo.io
1 parent 29593da commit d2e2d6f

File tree

3 files changed

+17
-142
lines changed

3 files changed

+17
-142
lines changed

kubernetes-services/templates/kargo.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

pkg/helm/helm.go

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ import (
1111
"sigs.k8s.io/e2e-framework/third_party/helm"
1212
)
1313

14-
type HelmArguments struct {
15-
Name string
16-
Namespace string
17-
Chart string
18-
Version string
19-
ValuesFilePath string
20-
OciRepository string
21-
}
22-
2314
func NewHelmManager(kubeConfigFile string) *helm.Manager {
2415
return helm.New(kubeConfigFile)
2516
}
@@ -29,54 +20,45 @@ func AddHelmRepository(helmMgr *helm.Manager, repoURL, chartName string) error {
2920
}
3021

3122
func DeployHelmChart(helmMgr *helm.Manager, src argo.ApplicationSource, namespace string) error {
32-
opts, err := buildHelmArguments(src, namespace)
23+
opts, err := buildHelmOptions(src, namespace)
3324
if err != nil {
3425
return fmt.Errorf("building helm options: %w", err)
3526
}
3627

37-
options := []helm.Option{
38-
helm.WithName(opts.Name),
39-
helm.WithNamespace(opts.Namespace),
40-
helm.WithChart(opts.Chart),
41-
helm.WithVersion(opts.Version),
42-
helm.WithArgs("--install", "--create-namespace"),
43-
}
44-
45-
if opts.ValuesFilePath != "" {
46-
options = append(options, helm.WithArgs("-f", opts.ValuesFilePath))
47-
}
48-
49-
if err := helmMgr.RunUpgrade(options...); err != nil {
28+
if err := helmMgr.RunUpgrade(opts...); err != nil {
5029
return fmt.Errorf("helm upgrade/install failed: %w", err)
5130
}
5231

5332
return nil
5433
}
5534

56-
func buildHelmArguments(src argo.ApplicationSource, namespace string) (*HelmArguments, error) {
57-
opts := &HelmArguments{
58-
Name: src.Chart,
59-
Namespace: namespace,
60-
Version: src.TargetRevision,
61-
}
62-
35+
func buildHelmOptions(src argo.ApplicationSource, namespace string) ([]helm.Option, error) {
36+
chart := ""
6337
if strings.HasPrefix(src.RepoURL, "oci://") {
6438
base := strings.TrimSuffix(src.RepoURL, "/")
65-
opts.Chart = fmt.Sprintf("%s/%s", base, src.Chart)
66-
opts.OciRepository = ""
39+
chart = fmt.Sprintf("%s/%s", base, src.Chart)
6740
} else {
68-
opts.Chart = fmt.Sprintf("%s/%s", src.Chart, src.Chart)
41+
chart = fmt.Sprintf("%s/%s", src.Chart, src.Chart)
42+
}
43+
44+
options := []helm.Option{
45+
helm.WithName(src.Chart),
46+
helm.WithNamespace(namespace),
47+
helm.WithChart(chart),
48+
helm.WithVersion(src.TargetRevision),
49+
helm.WithArgs("--install", "--create-namespace"),
6950
}
7051

7152
if src.Helm != nil && src.Helm.Values != "" {
7253
valuesFilePath, err := writeValuesFile(src.Chart, src.TargetRevision, src.Helm.Values)
7354
if err != nil {
7455
return nil, fmt.Errorf("writing values file: %w", err)
7556
}
76-
opts.ValuesFilePath = valuesFilePath
57+
58+
options = append(options, helm.WithArgs("-f", valuesFilePath))
7759
}
7860

79-
return opts, nil
61+
return options, nil
8062
}
8163

8264
func writeValuesFile(chart, revision, valuesContent string) (string, error) {

test/kargo_test.go

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)