Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
1 change: 0 additions & 1 deletion pkg/helm/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ type HelmClient interface {
IsReleaseExists(releaseName string) (bool, error)
WithLogLabels(map[string]string)
WithExtraLabels(map[string]string)
WithExtraAnnotations(map[string]string)
}
14 changes: 0 additions & 14 deletions pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
41 changes: 24 additions & 17 deletions pkg/helm/nelm/nelm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/helm/test/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Loading