diff --git a/go.mod b/go.mod index 15d04820d..bf49fc087 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.11.1 github.com/tidwall/gjson v1.18.0 - github.com/werf/nelm v1.17.2-0.20251113141246-0e0ea9049efe + github.com/werf/nelm v1.18.1-0.20251128101624-0116483ae155 google.golang.org/protobuf v1.36.5 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index 550a3b5c9..fc0955271 100644 --- a/go.sum +++ b/go.sum @@ -544,8 +544,8 @@ github.com/werf/lockgate v0.1.1 h1:S400JFYjtWfE4i4LY9FA8zx0fMdfui9DPrBiTciCrx4= github.com/werf/lockgate v0.1.1/go.mod h1:0yIFSLq9ausy6ejNxF5uUBf/Ib6daMAfXuCaTMZJzIE= github.com/werf/logboek v0.6.1 h1:oEe6FkmlKg0z0n80oZjLplj6sXcBeLleCkjfOOZEL2g= github.com/werf/logboek v0.6.1/go.mod h1:Gez5J4bxekyr6MxTmIJyId1F61rpO+0/V4vjCIEIZmk= -github.com/werf/nelm v1.17.2-0.20251113141246-0e0ea9049efe h1:buWARaRTc8Xlq9rlTsHUrLsrFGstC7nupSCkophOxv4= -github.com/werf/nelm v1.17.2-0.20251113141246-0e0ea9049efe/go.mod h1:nMH3ZVono+IUvun+RaSCvZCWkGUOfAMhPNkOI+UPeJA= +github.com/werf/nelm v1.18.1-0.20251128101624-0116483ae155 h1:gWWIJdgawfb1dvqQWpZ4jzm4sOHgnDp7HQF95+jAgzw= +github.com/werf/nelm v1.18.1-0.20251128101624-0116483ae155/go.mod h1:V3fEi7u60qJvHnMLyXyuKjMDMSFy54vFMgyIgHjBGGU= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= diff --git a/pkg/helm/client/client.go b/pkg/helm/client/client.go index b541ed69d..ad989dc09 100644 --- a/pkg/helm/client/client.go +++ b/pkg/helm/client/client.go @@ -16,5 +16,4 @@ type HelmClient interface { IsReleaseExists(releaseName string) (bool, error) WithLogLabels(map[string]string) WithExtraLabels(map[string]string) - WithExtraAnnotations(map[string]string) } diff --git a/pkg/helm/helm.go b/pkg/helm/helm.go index a204ef0f1..b5f072ef9 100644 --- a/pkg/helm/helm.go +++ b/pkg/helm/helm.go @@ -32,25 +32,11 @@ func WithLogLabels(logLabels map[string]string) ClientOption { } } -func WithExtraAnnotations(annotations map[string]string) ClientOption { - return func(c client.HelmClient) { - c.WithExtraAnnotations(annotations) - } -} - func (f *ClientFactory) NewClient(logger *log.Logger, options ...ClientOption) client.HelmClient { if f.NewClientFn != nil { labels := maps.Clone(f.labels) c := f.NewClientFn(logger, labels) - // Add werf.io/skip-logs and werf.io/track-termination-mode annotations when using nelm - if f.ClientType == Nelm { - c.WithExtraAnnotations(map[string]string{ - "werf.io/skip-logs": "true", - "werf.io/track-termination-mode": "NonBlocking", - }) - } - for _, option := range options { option(c) } diff --git a/pkg/helm/nelm/nelm.go b/pkg/helm/nelm/nelm.go index 636474e52..3dea5eb16 100644 --- a/pkg/helm/nelm/nelm.go +++ b/pkg/helm/nelm/nelm.go @@ -15,6 +15,7 @@ import ( "github.com/deckhouse/deckhouse/pkg/log" "github.com/werf/nelm/pkg/action" "github.com/werf/nelm/pkg/common" + "github.com/werf/nelm/pkg/featgate" nelmLog "github.com/werf/nelm/pkg/log" "helm.sh/helm/v3/pkg/cli" "k8s.io/cli-runtime/pkg/genericclioptions" @@ -93,6 +94,8 @@ func NewNelmClient(opts *CommonOptions, logger *log.Logger, labels map[string]st maps.Copy(clientLabels, labels) } + featgate.FeatCleanNullFields.Enable() + return &NelmClient{ logger: logger.With("operator.component", "nelm"), labels: clientLabels, @@ -235,20 +238,22 @@ func (c *NelmClient) UpgradeRelease(releaseName, modulePath string, valuesPaths ValuesSet: setValues, }, TrackingOptions: common.TrackingOptions{ - NoPodLogs: true, + NoPodLogs: true, + NoFinalTracking: true, }, - Chart: modulePath, - DefaultChartName: releaseName, - DefaultChartVersion: "0.2.0", - DefaultChartAPIVersion: "v2", - ExtraLabels: c.labels, - ExtraAnnotations: extraAnnotations, - NoInstallStandaloneCRDs: true, - ReleaseHistoryLimit: int(c.opts.HistoryMax), - ReleaseLabels: releaseLabels, - ReleaseStorageDriver: c.opts.HelmDriver, - Timeout: c.opts.Timeout, - ForceAdoption: true, + Chart: modulePath, + DefaultChartName: releaseName, + DefaultChartVersion: "0.2.0", + DefaultChartAPIVersion: "v2", + DefaultDeletePropagation: "Background", + ExtraLabels: c.labels, + ExtraAnnotations: extraAnnotations, + NoInstallStandaloneCRDs: true, + ReleaseHistoryLimit: int(c.opts.HistoryMax), + ReleaseLabels: releaseLabels, + ReleaseStorageDriver: c.opts.HelmDriver, + Timeout: c.opts.Timeout, + ForceAdoption: true, }); err != nil { return fmt.Errorf("install nelm release %q: %w", releaseName, err) } @@ -330,11 +335,13 @@ func (c *NelmClient) DeleteRelease(releaseName string) error { KubeContextCurrent: c.opts.KubeContext, }, TrackingOptions: common.TrackingOptions{ - NoPodLogs: true, + NoPodLogs: true, + NoFinalTracking: true, }, - ReleaseHistoryLimit: int(c.opts.HistoryMax), - ReleaseStorageDriver: c.opts.HelmDriver, - Timeout: c.opts.Timeout, + ReleaseHistoryLimit: int(c.opts.HistoryMax), + DefaultDeletePropagation: "Background", + ReleaseStorageDriver: c.opts.HelmDriver, + Timeout: c.opts.Timeout, }); err != nil { return fmt.Errorf("nelm uninstall release %q: %w", releaseName, err) } diff --git a/pkg/helm/test/mock/mock.go b/pkg/helm/test/mock/mock.go index 0424c591e..10d150a0a 100644 --- a/pkg/helm/test/mock/mock.go +++ b/pkg/helm/test/mock/mock.go @@ -68,9 +68,6 @@ func (c *Client) WithLogLabels(_ map[string]string) { func (c *Client) WithExtraLabels(_ map[string]string) { } -func (c *Client) WithExtraAnnotations(_ map[string]string) { -} - func (c *Client) GetReleaseLabels(_, _ string) (string, error) { return "", nil }