Skip to content

Commit c51e8d2

Browse files
authored
[addon-operator] bump nelm version (#691)
Signed-off-by: Pavel Okhlopkov <[email protected]>
1 parent b83164e commit c51e8d2

File tree

3 files changed

+70
-42
lines changed

3 files changed

+70
-42
lines changed

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/pkg/errors v0.9.1
2828
github.com/stretchr/testify v1.11.1
2929
github.com/tidwall/gjson v1.18.0
30-
github.com/werf/nelm v1.12.3
30+
github.com/werf/nelm v1.16.2-0.20251106110659-fb3b42bd8fba
3131
google.golang.org/protobuf v1.36.5
3232
gopkg.in/alecthomas/kingpin.v2 v2.2.6
3333
gopkg.in/yaml.v3 v3.0.1
@@ -43,12 +43,13 @@ require (
4343
sigs.k8s.io/yaml v1.4.0
4444
)
4545

46+
require github.com/go-openapi/swag/loading v0.25.1
47+
4648
require (
4749
github.com/go-openapi/swag/conv v0.25.1 // indirect
4850
github.com/go-openapi/swag/fileutils v0.25.1 // indirect
4951
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
5052
github.com/go-openapi/swag/jsonutils v0.25.1 // indirect
51-
github.com/go-openapi/swag/loading v0.25.1 // indirect
5253
github.com/go-openapi/swag/mangling v0.25.1 // indirect
5354
github.com/go-openapi/swag/stringutils v0.25.1 // indirect
5455
github.com/go-openapi/swag/typeutils v0.25.1 // indirect
@@ -200,9 +201,9 @@ require (
200201
github.com/tidwall/pretty v1.2.1 // indirect
201202
github.com/tidwall/sjson v1.2.5 // indirect
202203
github.com/wI2L/jsondiff v0.5.0 // indirect
203-
github.com/werf/3p-helm v0.0.0-20250731134240-58a9eff8ec5b // indirect
204-
github.com/werf/common-go v0.0.0-20251009090833-3d49886e7488 // indirect
205-
github.com/werf/kubedog v0.13.1-0.20250813095923-12d70b6780b0 // indirect
204+
github.com/werf/3p-helm v0.0.0-20251021224308-a90f195bd29a // indirect
205+
github.com/werf/common-go v0.0.0-20251017004901-cb6247f72f1a // indirect
206+
github.com/werf/kubedog v0.13.1-0.20251105104917-8615bb20d8c0 // indirect
206207
github.com/werf/lockgate v0.1.1 // indirect
207208
github.com/werf/logboek v0.6.1 // indirect
208209
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -522,18 +522,18 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
522522
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
523523
github.com/wI2L/jsondiff v0.5.0 h1:RRMTi/mH+R2aXcPe1VYyvGINJqQfC3R+KSEakuU1Ikw=
524524
github.com/wI2L/jsondiff v0.5.0/go.mod h1:qqG6hnK0Lsrz2BpIVCxWiK9ItsBCpIZQiv0izJjOZ9s=
525-
github.com/werf/3p-helm v0.0.0-20250731134240-58a9eff8ec5b h1:l9R9CvJLk8uaLmJpyuP5GboqzZaTqwxgfzuTMEbfF28=
526-
github.com/werf/3p-helm v0.0.0-20250731134240-58a9eff8ec5b/go.mod h1:KDjmOsjFiOmj0fB0+q+0gGvlejPMjTgckLC59bX0BLg=
527-
github.com/werf/common-go v0.0.0-20251009090833-3d49886e7488 h1:pNFYma4z3BB9oTzj9s+eF+Fiw9nGE1c8woZmRh0V6+4=
528-
github.com/werf/common-go v0.0.0-20251009090833-3d49886e7488/go.mod h1:MXS0JR9zut+oR9oEM8PEkdXXoEbKDILTmWopt0z1eZs=
529-
github.com/werf/kubedog v0.13.1-0.20250813095923-12d70b6780b0 h1:E7odWm4YBrYee/g9UyDVJ++C6xrKq2orNrkLiNrrN9k=
530-
github.com/werf/kubedog v0.13.1-0.20250813095923-12d70b6780b0/go.mod h1:gu4EY4hxtiYVDy5o6WE2lRZS0YWqrOV0HS//GTYyrUE=
525+
github.com/werf/3p-helm v0.0.0-20251021224308-a90f195bd29a h1:2MQLbG3bB3wx1PaHSKftVIZNmBUNHKjDdD2K+4kHFbE=
526+
github.com/werf/3p-helm v0.0.0-20251021224308-a90f195bd29a/go.mod h1:cJqEbzc97X0/gYYi5pU4RyXDD8o1spkZh7bOxV2+NQ0=
527+
github.com/werf/common-go v0.0.0-20251017004901-cb6247f72f1a h1:merq7OD3hQmgUQBZDQ3cJdirvGBZS9qUB6U+Emdh63I=
528+
github.com/werf/common-go v0.0.0-20251017004901-cb6247f72f1a/go.mod h1:MXS0JR9zut+oR9oEM8PEkdXXoEbKDILTmWopt0z1eZs=
529+
github.com/werf/kubedog v0.13.1-0.20251105104917-8615bb20d8c0 h1:7owKaBiK78CpIBr6tCzhSgcXDD25X6ZH0O4B+koBt+M=
530+
github.com/werf/kubedog v0.13.1-0.20251105104917-8615bb20d8c0/go.mod h1:gu4EY4hxtiYVDy5o6WE2lRZS0YWqrOV0HS//GTYyrUE=
531531
github.com/werf/lockgate v0.1.1 h1:S400JFYjtWfE4i4LY9FA8zx0fMdfui9DPrBiTciCrx4=
532532
github.com/werf/lockgate v0.1.1/go.mod h1:0yIFSLq9ausy6ejNxF5uUBf/Ib6daMAfXuCaTMZJzIE=
533533
github.com/werf/logboek v0.6.1 h1:oEe6FkmlKg0z0n80oZjLplj6sXcBeLleCkjfOOZEL2g=
534534
github.com/werf/logboek v0.6.1/go.mod h1:Gez5J4bxekyr6MxTmIJyId1F61rpO+0/V4vjCIEIZmk=
535-
github.com/werf/nelm v1.12.3 h1:RiF0kDjQhmHWcXHgPO+QHdvL8QgW61K8SuhCR0tNMqo=
536-
github.com/werf/nelm v1.12.3/go.mod h1:jsB+vAnwoSXvm3J3+mUsPBGH0XdCqumEsyDIJkcOzRE=
535+
github.com/werf/nelm v1.16.2-0.20251106110659-fb3b42bd8fba h1:1afKGS7rHV14veK0uGFKL62fpBlOYik4bFpRSjvMTII=
536+
github.com/werf/nelm v1.16.2-0.20251106110659-fb3b42bd8fba/go.mod h1:xagTj6aWTBe+EmzWBIhTydrXeiq47uVX8WISjxo9yIE=
537537
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
538538
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
539539
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=

pkg/helm/nelm/nelm.go

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
"github.com/deckhouse/deckhouse/pkg/log"
1616
"github.com/werf/nelm/pkg/action"
17+
"github.com/werf/nelm/pkg/common"
1718
nelmLog "github.com/werf/nelm/pkg/log"
1819
"helm.sh/helm/v3/pkg/cli"
1920
"k8s.io/cli-runtime/pkg/genericclioptions"
@@ -41,7 +42,7 @@ type NelmActions interface {
4142
ReleaseInstall(ctx context.Context, name, namespace string, opts action.ReleaseInstallOptions) error
4243
ReleaseUninstall(ctx context.Context, name, namespace string, opts action.ReleaseUninstallOptions) error
4344
ReleaseList(ctx context.Context, opts action.ReleaseListOptions) (*action.ReleaseListResultV1, error)
44-
ChartRender(ctx context.Context, opts action.ChartRenderOptions) (*action.ChartRenderResultV1, error)
45+
ChartRender(ctx context.Context, opts action.ChartRenderOptions) (*action.ChartRenderResultV2, error)
4546
}
4647

4748
type DefaultNelmActions struct{}
@@ -62,7 +63,7 @@ func (d *DefaultNelmActions) ReleaseList(ctx context.Context, opts action.Releas
6263
return action.ReleaseList(ctx, opts)
6364
}
6465

65-
func (d *DefaultNelmActions) ChartRender(ctx context.Context, opts action.ChartRenderOptions) (*action.ChartRenderResultV1, error) {
66+
func (d *DefaultNelmActions) ChartRender(ctx context.Context, opts action.ChartRenderOptions) (*action.ChartRenderResultV2, error) {
6667
return action.ChartRender(ctx, opts)
6768
}
6869

@@ -112,7 +113,9 @@ type NelmClient struct {
112113
// GetReleaseLabels returns a specific label value from the release.
113114
func (c *NelmClient) GetReleaseLabels(releaseName, labelName string) (string, error) {
114115
releaseGetResult, err := c.actions.ReleaseGet(context.TODO(), releaseName, *c.opts.Namespace, action.ReleaseGetOptions{
115-
KubeContext: c.opts.KubeContext,
116+
KubeConnectionOptions: common.KubeConnectionOptions{
117+
KubeContextCurrent: c.opts.KubeContext,
118+
},
116119
OutputNoPrint: true,
117120
ReleaseStorageDriver: c.opts.HelmDriver,
118121
})
@@ -165,7 +168,9 @@ func (c *NelmClient) GetAnnotations() map[string]string {
165168

166169
func (c *NelmClient) LastReleaseStatus(releaseName string) (string, string, error) {
167170
releaseGetResult, err := c.actions.ReleaseGet(context.TODO(), releaseName, *c.opts.Namespace, action.ReleaseGetOptions{
168-
KubeContext: c.opts.KubeContext,
171+
KubeConnectionOptions: common.KubeConnectionOptions{
172+
KubeContextCurrent: c.opts.KubeContext,
173+
},
169174
OutputNoPrint: true,
170175
ReleaseStorageDriver: c.opts.HelmDriver,
171176
})
@@ -204,7 +209,9 @@ func (c *NelmClient) UpgradeRelease(releaseName, modulePath string, valuesPaths
204209

205210
// First check if release exists
206211
_, err := c.actions.ReleaseGet(context.Background(), releaseName, namespace, action.ReleaseGetOptions{
207-
KubeContext: c.opts.KubeContext,
212+
KubeConnectionOptions: common.KubeConnectionOptions{
213+
KubeContextCurrent: c.opts.KubeContext,
214+
},
208215
OutputNoPrint: true,
209216
ReleaseStorageDriver: c.opts.HelmDriver,
210217
})
@@ -220,22 +227,28 @@ func (c *NelmClient) UpgradeRelease(releaseName, modulePath string, valuesPaths
220227
}
221228

222229
if err := c.actions.ReleaseInstall(context.TODO(), releaseName, namespace, action.ReleaseInstallOptions{
223-
Chart: modulePath,
224-
DefaultChartName: releaseName,
225-
DefaultChartVersion: "0.2.0",
226-
DefaultChartAPIVersion: "v2",
227-
ExtraLabels: c.labels,
228-
ExtraAnnotations: extraAnnotations,
229-
KubeContext: c.opts.KubeContext,
230-
NoInstallCRDs: true,
231-
ReleaseHistoryLimit: int(c.opts.HistoryMax),
232-
ReleaseLabels: releaseLabels,
233-
ReleaseStorageDriver: c.opts.HelmDriver,
234-
Timeout: c.opts.Timeout,
235-
ValuesFilesPaths: valuesPaths,
236-
ValuesSets: setValues,
237-
ForceAdoption: true,
238-
NoPodLogs: true,
230+
KubeConnectionOptions: common.KubeConnectionOptions{
231+
KubeContextCurrent: c.opts.KubeContext,
232+
},
233+
ValuesOptions: common.ValuesOptions{
234+
ValuesFiles: valuesPaths,
235+
ValuesSet: setValues,
236+
},
237+
TrackingOptions: common.TrackingOptions{
238+
NoPodLogs: true,
239+
},
240+
Chart: modulePath,
241+
DefaultChartName: releaseName,
242+
DefaultChartVersion: "0.2.0",
243+
DefaultChartAPIVersion: "v2",
244+
ExtraLabels: c.labels,
245+
ExtraAnnotations: extraAnnotations,
246+
NoInstallStandaloneCRDs: true,
247+
ReleaseHistoryLimit: int(c.opts.HistoryMax),
248+
ReleaseLabels: releaseLabels,
249+
ReleaseStorageDriver: c.opts.HelmDriver,
250+
Timeout: c.opts.Timeout,
251+
ForceAdoption: true,
239252
}); err != nil {
240253
return fmt.Errorf("install nelm release %q: %w", releaseName, err)
241254
}
@@ -250,7 +263,9 @@ func (c *NelmClient) UpgradeRelease(releaseName, modulePath string, valuesPaths
250263

251264
func (c *NelmClient) GetReleaseValues(releaseName string) (utils.Values, error) {
252265
releaseGetResult, err := c.actions.ReleaseGet(context.TODO(), releaseName, *c.opts.Namespace, action.ReleaseGetOptions{
253-
KubeContext: c.opts.KubeContext,
266+
KubeConnectionOptions: common.KubeConnectionOptions{
267+
KubeContextCurrent: c.opts.KubeContext,
268+
},
254269
OutputNoPrint: true,
255270
ReleaseStorageDriver: c.opts.HelmDriver,
256271
})
@@ -278,7 +293,9 @@ func (c *NelmClient) GetReleaseChecksum(releaseName string) (string, error) {
278293
logger := c.logger.With(slog.String("release_name", releaseName))
279294

280295
releaseGetResult, err := c.actions.ReleaseGet(context.TODO(), releaseName, *c.opts.Namespace, action.ReleaseGetOptions{
281-
KubeContext: c.opts.KubeContext,
296+
KubeConnectionOptions: common.KubeConnectionOptions{
297+
KubeContextCurrent: c.opts.KubeContext,
298+
},
282299
OutputNoPrint: true,
283300
ReleaseStorageDriver: c.opts.HelmDriver,
284301
})
@@ -309,11 +326,15 @@ func (c *NelmClient) DeleteRelease(releaseName string) error {
309326
c.logger.Debug("nelm release: execute nelm uninstall", slog.String("release", releaseName))
310327

311328
if err := c.actions.ReleaseUninstall(context.TODO(), releaseName, *c.opts.Namespace, action.ReleaseUninstallOptions{
312-
KubeContext: c.opts.KubeContext,
329+
KubeConnectionOptions: common.KubeConnectionOptions{
330+
KubeContextCurrent: c.opts.KubeContext,
331+
},
332+
TrackingOptions: common.TrackingOptions{
333+
NoPodLogs: true,
334+
},
313335
ReleaseHistoryLimit: int(c.opts.HistoryMax),
314336
ReleaseStorageDriver: c.opts.HelmDriver,
315337
Timeout: c.opts.Timeout,
316-
NoPodLogs: true,
317338
}); err != nil {
318339
return fmt.Errorf("nelm uninstall release %q: %w", releaseName, err)
319340
}
@@ -336,7 +357,9 @@ func (c *NelmClient) IsReleaseExists(releaseName string) (bool, error) {
336357

337358
func (c *NelmClient) ListReleasesNames() ([]string, error) {
338359
releaseListResult, err := c.actions.ReleaseList(context.TODO(), action.ReleaseListOptions{
339-
KubeContext: c.opts.KubeContext,
360+
KubeConnectionOptions: common.KubeConnectionOptions{
361+
KubeContextCurrent: c.opts.KubeContext,
362+
},
340363
OutputNoPrint: true,
341364
ReleaseStorageDriver: c.opts.HelmDriver,
342365
})
@@ -381,20 +404,24 @@ func (c *NelmClient) Render(releaseName, modulePath string, valuesPaths, setValu
381404
}
382405

383406
chartRenderResult, err := c.actions.ChartRender(context.TODO(), action.ChartRenderOptions{
407+
KubeConnectionOptions: common.KubeConnectionOptions{
408+
KubeContextCurrent: c.opts.KubeContext,
409+
},
410+
ValuesOptions: common.ValuesOptions{
411+
ValuesFiles: valuesPaths,
412+
ValuesSet: setValues,
413+
},
384414
OutputFilePath: "/dev/null", // No output file, we want to return the manifest as a string
385415
Chart: modulePath,
386416
DefaultChartName: releaseName,
387417
DefaultChartVersion: "0.2.0",
388418
DefaultChartAPIVersion: "v2",
389419
ExtraLabels: c.labels,
390420
ExtraAnnotations: extraAnnotations,
391-
KubeContext: c.opts.KubeContext,
392421
ReleaseName: releaseName,
393422
ReleaseNamespace: namespace,
394423
ReleaseStorageDriver: c.opts.HelmDriver,
395424
Remote: true,
396-
ValuesFilesPaths: valuesPaths,
397-
ValuesSets: setValues,
398425
ForceAdoption: true,
399426
})
400427
if err != nil {

0 commit comments

Comments
 (0)