|
1 | 1 | package helm |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "log/slog" |
5 | 4 | "maps" |
6 | 5 | "time" |
7 | 6 |
|
8 | 7 | "github.com/deckhouse/deckhouse/pkg/log" |
9 | 8 |
|
10 | 9 | "github.com/flant/addon-operator/pkg/helm/client" |
11 | | - "github.com/flant/addon-operator/pkg/helm/helm3" |
12 | 10 | "github.com/flant/addon-operator/pkg/helm/helm3lib" |
13 | 11 | ) |
14 | 12 |
|
@@ -54,42 +52,28 @@ type Options struct { |
54 | 52 | } |
55 | 53 |
|
56 | 54 | func InitHelmClientFactory(helmopts *Options, labels map[string]string) (*ClientFactory, error) { |
57 | | - helmVersion, err := DetectHelmVersion() |
| 55 | + _, err := DetectHelmVersion() |
58 | 56 | if err != nil { |
59 | 57 | return nil, err |
60 | 58 | } |
61 | 59 |
|
62 | 60 | factory := new(ClientFactory) |
63 | 61 | factory.labels = labels |
64 | 62 |
|
65 | | - switch helmVersion { |
66 | | - case Helm3Lib: |
67 | | - log.Info("Helm3Lib detected. Use builtin Helm.") |
68 | | - factory.ClientType = Helm3Lib |
69 | | - factory.NewClientFn = helm3lib.NewClient |
70 | | - err = helm3lib.Init(&helm3lib.Options{ |
71 | | - Namespace: helmopts.Namespace, |
72 | | - HistoryMax: helmopts.HistoryMax, |
73 | | - Timeout: helmopts.Timeout, |
74 | | - HelmIgnoreRelease: helmopts.HelmIgnoreRelease, |
75 | | - }, helmopts.Logger) |
76 | | - |
77 | | - case Helm3: |
78 | | - log.Info("Helm 3 detected", slog.String("path", helm3.Helm3Path)) |
79 | | - // Use helm3 client. |
80 | | - factory.ClientType = Helm3 |
81 | | - factory.NewClientFn = helm3.NewClient |
82 | | - err = helm3.Init(&helm3.Helm3Options{ |
83 | | - Namespace: helmopts.Namespace, |
84 | | - HistoryMax: helmopts.HistoryMax, |
85 | | - Timeout: helmopts.Timeout, |
86 | | - HelmIgnoreRelease: helmopts.HelmIgnoreRelease, |
87 | | - Logger: helmopts.Logger, |
88 | | - }) |
89 | | - } |
| 63 | + log.Info("Helm3Lib detected. Use builtin Helm.") |
| 64 | + |
| 65 | + factory.ClientType = Helm3Lib |
| 66 | + factory.NewClientFn = helm3lib.NewClient |
90 | 67 |
|
| 68 | + err = helm3lib.Init(&helm3lib.Options{ |
| 69 | + Namespace: helmopts.Namespace, |
| 70 | + HistoryMax: helmopts.HistoryMax, |
| 71 | + Timeout: helmopts.Timeout, |
| 72 | + HelmIgnoreRelease: helmopts.HelmIgnoreRelease, |
| 73 | + }, helmopts.Logger) |
91 | 74 | if err != nil { |
92 | 75 | return nil, err |
93 | 76 | } |
| 77 | + |
94 | 78 | return factory, nil |
95 | 79 | } |
0 commit comments