Skip to content
Draft
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
13 changes: 7 additions & 6 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ core,github.com/docker/cli/cli/config,Apache-2.0
core,github.com/docker/docker-credential-helpers,MIT
core,github.com/dsnet/compress,BSD-3-Clause
core,github.com/dustin/go-humanize,MIT
core,github.com/dylibso/observe-sdk/go,Apache-2.0
core,github.com/ebitengine/purego,Apache-2.0
core,github.com/emicklei/go-restful/v3,MIT
core,github.com/evanphx/json-patch,BSD-3-Clause
core,github.com/evanphx/json-patch/v5,BSD-3-Clause
core,github.com/exponent-io/jsonpath,MIT
core,github.com/extism/go-sdk,BSD-3-Clause
core,github.com/fatih/color,MIT
core,github.com/felixge/httpsnoop,MIT
core,github.com/fluxcd/cli-utils/pkg,Apache-2.0
core,github.com/fsnotify/fsnotify,BSD-3-Clause
core,github.com/fxamacker/cbor/v2,MIT
core,github.com/go-errors/errors,MIT
Expand Down Expand Up @@ -164,13 +166,11 @@ core,github.com/gosuri/uitable/util/wordwrap,MIT
core,github.com/grpc-ecosystem/go-grpc-middleware/v2,Apache-2.0
core,github.com/grpc-ecosystem/grpc-gateway/v2,BSD-3-Clause
core,github.com/hako/durafmt,MIT
core,github.com/hashicorp/errwrap,MPL-2.0
core,github.com/hashicorp/go-cleanhttp,MPL-2.0
core,github.com/hashicorp/go-multierror,MPL-2.0
core,github.com/hashicorp/go-retryablehttp,MPL-2.0
core,github.com/hashicorp/go-version,MPL-2.0
core,github.com/huandu/xstrings,MIT
core,github.com/imdario/mergo,BSD-3-Clause
core,github.com/ianlancetaylor/demangle,BSD-3-Clause
core,github.com/inconshreveable/mousetrap,Apache-2.0
core,github.com/jmoiron/sqlx,MIT
core,github.com/json-iterator/go,MIT
Expand Down Expand Up @@ -249,6 +249,8 @@ core,github.com/stretchr/objx,MIT
core,github.com/stretchr/testify,MIT
core,github.com/stretchr/testify/internal/difflib,BSD-3-Clause
core,github.com/stretchr/testify/internal/spew,ISC
core,github.com/tetratelabs/wabin,Apache-2.0
core,github.com/tetratelabs/wazero,Apache-2.0
core,github.com/tinylib/msgp/msgp,MIT
core,github.com/tklauser/go-sysconf,BSD-3-Clause
core,github.com/tklauser/numcpus,Apache-2.0
Expand Down Expand Up @@ -303,9 +305,8 @@ core,google.golang.org/grpc,Apache-2.0
core,google.golang.org/protobuf,BSD-3-Clause
core,gopkg.in/evanphx/json-patch.v4,BSD-3-Clause
core,gopkg.in/inf.v0,BSD-3-Clause
core,gopkg.in/yaml.v2,Apache-2.0
core,gopkg.in/yaml.v3,MIT
core,helm.sh/helm/v3,Apache-2.0
core,helm.sh/helm/v4,Apache-2.0
core,k8s.io/api,Apache-2.0
core,k8s.io/apiextensions-apiserver/pkg,Apache-2.0
core,k8s.io/apimachinery/pkg,Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubectl-datadog/autoscaling/cluster/apply/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/davecgh/go-spew/spew"
"github.com/fatih/color"
"github.com/pkg/browser"
"helm.sh/helm/v3/pkg/registry"
"helm.sh/helm/v4/pkg/registry"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/client-go/discovery"
"k8s.io/client-go/kubernetes"
Expand Down
40 changes: 24 additions & 16 deletions cmd/kubectl-datadog/autoscaling/cluster/common/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"os"
"time"

"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/storage/driver"
"helm.sh/helm/v4/pkg/action"
"helm.sh/helm/v4/pkg/chart/loader"
"helm.sh/helm/v4/pkg/cli"
"helm.sh/helm/v4/pkg/kube"
releasecommon "helm.sh/helm/v4/pkg/release/common"
"helm.sh/helm/v4/pkg/storage/driver"
"k8s.io/cli-runtime/pkg/genericclioptions"
)

Expand All @@ -37,12 +38,19 @@ func Exists(_ context.Context, ac *action.Configuration, releaseName string) (bo
versions, err := historyAction.Run(releaseName)

if err != nil {
if errors.Is(err, driver.ErrReleaseNotFound) || (len(versions) > 0 && versions[len(versions)-1].Info.Status == release.StatusUninstalled) {
if errors.Is(err, driver.ErrReleaseNotFound) {
return false, nil
}
return false, fmt.Errorf("failed to get Helm release %s history: %w", releaseName, err)
}

type hasStatus interface{ Status() string }
if len(versions) > 0 {
if acc, ok := versions[len(versions)-1].(hasStatus); ok && acc.Status() == string(releasecommon.StatusUninstalled) {
return false, nil
}
}

return true, nil
}

Expand All @@ -58,7 +66,7 @@ func install(ctx context.Context, ac *action.Configuration, releaseName, namespa
installAction.CreateNamespace = true
installAction.Namespace = namespace
installAction.Version = version
installAction.Wait = true
installAction.WaitStrategy = kube.StatusWatcherStrategy
installAction.WaitForJobs = true
installAction.Timeout = 30 * time.Minute

Expand All @@ -78,12 +86,12 @@ func install(ctx context.Context, ac *action.Configuration, releaseName, namespa
ctx, cancel := context.WithTimeout(ctx, installAction.Timeout)
defer cancel()

release, err := installAction.RunWithContext(ctx, chart, values)
_, err = installAction.RunWithContext(ctx, chart, values)
if err != nil {
return fmt.Errorf("failed to install Helm release %s: %w", releaseName, err)
}

log.Printf("Installed Helm release %s.", release.Name)
log.Printf("Installed Helm release %s.", releaseName)

return nil
}
Expand All @@ -98,7 +106,7 @@ func upgrade(ctx context.Context, ac *action.Configuration, releaseName, namespa
upgradeAction := action.NewUpgrade(ac)
upgradeAction.Namespace = namespace
upgradeAction.Version = version
upgradeAction.Wait = true
upgradeAction.WaitStrategy = kube.StatusWatcherStrategy
upgradeAction.WaitForJobs = true
upgradeAction.Timeout = 30 * time.Minute

Expand All @@ -118,12 +126,12 @@ func upgrade(ctx context.Context, ac *action.Configuration, releaseName, namespa
ctx, cancel := context.WithTimeout(ctx, upgradeAction.Timeout)
defer cancel()

release, err := upgradeAction.RunWithContext(ctx, releaseName, chart, values)
_, err = upgradeAction.RunWithContext(ctx, releaseName, chart, values)
if err != nil {
return fmt.Errorf("failed to upgrade Helm release %s: %w", releaseName, err)
}

log.Printf("Upgraded Helm release %s.", release.Name)
log.Printf("Upgraded Helm release %s.", releaseName)

return nil
}
Expand All @@ -142,15 +150,15 @@ func Uninstall(ctx context.Context, ac *action.Configuration, releaseName string
log.Printf("Uninstalling Helm release %s…", releaseName)

uninstallAction := action.NewUninstall(ac)
uninstallAction.Wait = true
uninstallAction.WaitStrategy = kube.StatusWatcherStrategy
uninstallAction.Timeout = 30 * time.Minute

response, err := uninstallAction.Run(releaseName)
_, err = uninstallAction.Run(releaseName)
if err != nil {
return fmt.Errorf("failed to uninstall Helm release %s: %w", releaseName, err)
}

log.Printf("Uninstalled Helm release %s.", response.Release.Name)
log.Printf("Uninstalled Helm release %s.", releaseName)

return nil
}
Expand All @@ -159,7 +167,7 @@ func Uninstall(ctx context.Context, ac *action.Configuration, releaseName string
func NewActionConfig(configFlags *genericclioptions.ConfigFlags, namespace string) (*action.Configuration, error) {
actionConfig := new(action.Configuration)

if err := actionConfig.Init(configFlags, namespace, os.Getenv("HELM_DRIVER"), log.Printf); err != nil {
if err := actionConfig.Init(configFlags, namespace, os.Getenv("HELM_DRIVER")); err != nil {
return nil, fmt.Errorf("failed to initialize Helm configuration: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/yaml-mapper/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"strings"
"time"

"helm.sh/helm/v3/pkg/chartutil"
chartutil "helm.sh/helm/v4/pkg/chart/common"

"github.com/DataDog/datadog-operator/cmd/yaml-mapper/constants"
"github.com/DataDog/datadog-operator/cmd/yaml-mapper/utils"
Expand Down
2 changes: 1 addition & 1 deletion cmd/yaml-mapper/mapper/mapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/DataDog/datadog-operator/cmd/yaml-mapper/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"helm.sh/helm/v3/pkg/chartutil"
chartutil "helm.sh/helm/v4/pkg/chart/common"
)

func TestRun(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/yaml-mapper/utils/charts_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"time"

"github.com/hashicorp/go-retryablehttp"
"helm.sh/helm/v3/pkg/chartutil"
chartutil "helm.sh/helm/v4/pkg/chart/v2/util"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/yaml-mapper/utils/deprecations.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package utils
import (
"log/slog"

"helm.sh/helm/v3/pkg/chartutil"
chartutil "helm.sh/helm/v4/pkg/chart/common"
)

// DepAction Action to perform on deprecated keys
Expand Down
2 changes: 1 addition & 1 deletion cmd/yaml-mapper/utils/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package utils
import (
"strings"

"helm.sh/helm/v3/pkg/chartutil"
chartutil "helm.sh/helm/v4/pkg/chart/common"
)

// InsertAtPath inserts a value into a nested map at a dotted path, creating
Expand Down
2 changes: 1 addition & 1 deletion cmd/yaml-mapper/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package utils

import "helm.sh/helm/v3/pkg/chartutil"
import chartutil "helm.sh/helm/v4/pkg/chart/common"

// GetPathVal safely traverses nested maps and retrieves the value at the given path.
// It supports map[string]interface{} and chartutil.Values.
Expand Down
18 changes: 11 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ require (
github.com/stretchr/testify v1.12.1
go.uber.org/zap v1.28.0
gopkg.in/yaml.v3 v3.0.1
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.37.0
k8s.io/apiextensions-apiserver v0.37.0
k8s.io/apimachinery v0.37.0
Expand All @@ -34,6 +33,7 @@ require (
)

require (
dario.cat/mergo v1.0.2
github.com/DataDog/agent-payload/v5 v5.0.207
github.com/DataDog/datadog-agent/pkg/config/create v0.83.2
github.com/DataDog/datadog-agent/pkg/config/model v0.83.2
Expand Down Expand Up @@ -63,7 +63,6 @@ require (
github.com/gobuffalo/flect v1.0.3
github.com/google/go-containerregistry v0.22.1
github.com/hashicorp/go-retryablehttp v0.7.8
github.com/imdario/mergo v1.0.2
github.com/mattn/go-runewidth v0.0.30
github.com/onsi/ginkgo/v2 v2.33.0
github.com/opencontainers/go-digest v1.0.0
Expand All @@ -82,13 +81,21 @@ require (
sigs.k8s.io/karpenter v1.14.1
)

require (
github.com/dylibso/observe-sdk/go v0.0.0-20240819160327-2d926c5d788a // indirect
github.com/extism/go-sdk v1.7.1 // indirect
github.com/fluxcd/cli-utils v1.2.2 // indirect
github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b // indirect
github.com/tetratelabs/wabin v0.0.0-20230304001439-f6f874872834 // indirect
github.com/tetratelabs/wazero v1.12.0 // indirect
)

require (
cel.dev/expr v0.25.2 // indirect
cloud.google.com/go/auth v0.20.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute v1.64.0 // indirect
cloud.google.com/go/compute/metadata v0.9.0 // indirect
dario.cat/mergo v1.0.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
github.com/BurntSushi/toml v1.6.0 // indirect
github.com/DataDog/datadog-agent/comp/core/delegatedauth v0.83.2 // indirect
Expand Down Expand Up @@ -174,12 +181,11 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ebitengine/purego v0.10.2 // indirect
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.10.1 // indirect
github.com/fxamacker/cbor/v2 v2.9.1 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
Expand Down Expand Up @@ -213,9 +219,7 @@ require (
github.com/gosuri/uitable v0.0.4 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-version v1.9.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
Expand Down
Loading
Loading