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
1 change: 1 addition & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ core,github.com/aws/aws-sdk-go-v2/service/eks,Apache-2.0
core,github.com/aws/aws-sdk-go-v2/service/iam,Apache-2.0
core,github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding,Apache-2.0
core,github.com/aws/aws-sdk-go-v2/service/internal/presigned-url,Apache-2.0
core,github.com/aws/aws-sdk-go-v2/service/signin,Apache-2.0
core,github.com/aws/aws-sdk-go-v2/service/sso,Apache-2.0
core,github.com/aws/aws-sdk-go-v2/service/ssooidc,Apache-2.0
core,github.com/aws/aws-sdk-go-v2/service/sts,Apache-2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ func detectAMIFamilyFromImage(imageName string) string {
return "AL2"
case strings.Contains(lowerName, "bottlerocket"):
return "Bottlerocket"
case strings.Contains(imageName, "Windows_Server-2025"):
return "Windows2025"
case strings.Contains(imageName, "Windows_Server-2022"):
return "Windows2022"
case strings.Contains(imageName, "Windows_Server-2019"):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package guess

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestDetectAMIFamilyFromImage(t *testing.T) {
for _, tc := range []struct {
imageName string
expected string
}{
{"amazon-linux-2023-x86_64-standard", "AL2023"},
{"al2023-ami-2023.7.20250512.0-kernel-6.1-x86_64", "AL2023"},
{"amazon-linux-2-x86_64-gpu", "AL2"},
{"amzn2-ami-hvm-2.0.20250101.0-x86_64-gp2", "AL2"},
{"bottlerocket-aws-k8s-1.30-x86_64-v1.25.0", "Bottlerocket"},
{"BOTTLEROCKET-aws-k8s-1.30-aarch64-v1.25.0", "Bottlerocket"},
{"Windows_Server-2025-English-Full-EKS_Optimized-1.30", "Windows2025"},
{"Windows_Server-2022-English-Full-EKS_Optimized-1.30", "Windows2022"},
{"Windows_Server-2019-English-Full-EKS_Optimized-1.30", "Windows2019"},
{"some-custom-ami-name", "Custom"},
} {
t.Run(tc.imageName, func(t *testing.T) {
assert.Equal(t, tc.expected, detectAMIFamilyFromImage(tc.imageName))
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func amiFamilyToAlias(amiFamily string) string {
return "windows2019@latest"
case "Windows2022":
return "windows2022@latest"
case "Windows2025":
return "windows2025@latest"
default:
return "" // Custom or unknown families don't have aliases
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package k8s

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestAmiFamilyToAlias(t *testing.T) {
for _, tc := range []struct {
amiFamily string
expected string
}{
{"AL2", "al2@latest"},
{"AL2023", "al2023@latest"},
{"Bottlerocket", "bottlerocket@latest"},
{"Windows2019", "windows2019@latest"},
{"Windows2022", "windows2022@latest"},
{"Windows2025", "windows2025@latest"},
{"Custom", ""},
{"Unknown", ""},
} {
t.Run(tc.amiFamily, func(t *testing.T) {
assert.Equal(t, tc.expected, amiFamilyToAlias(tc.amiFamily))
})
}
}
45 changes: 25 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/DataDog/datadog-operator

go 1.25.6
go 1.25.7

toolchain go1.25.9

Expand All @@ -16,7 +16,7 @@ require (
github.com/google/uuid v1.6.0
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b
github.com/mholt/archiver/v3 v3.5.1
github.com/olekukonko/tablewriter v0.0.5
github.com/olekukonko/tablewriter v1.1.0
github.com/onsi/gomega v1.39.1
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/cobra v1.10.2
Expand Down Expand Up @@ -44,14 +44,14 @@ require (
github.com/DataDog/datadog-agent/pkg/proto v0.63.0-rc.1
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.59.0-rc.5
github.com/DataDog/datadog-operator/api v0.0.0-20250130131115-7f198adcc856
github.com/aws/aws-sdk-go-v2 v1.39.6
github.com/aws/aws-sdk-go-v2/config v1.29.17
github.com/aws/aws-sdk-go-v2 v1.41.1
github.com/aws/aws-sdk-go-v2/config v1.32.7
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.68.3
github.com/aws/aws-sdk-go-v2/service/ec2 v1.206.0
github.com/aws/aws-sdk-go-v2/service/eks v1.60.0
github.com/aws/aws-sdk-go-v2/service/iam v1.40.0
github.com/aws/aws-sdk-go-v2/service/sts v1.34.0
github.com/aws/karpenter-provider-aws v1.3.6
github.com/aws/aws-sdk-go-v2/service/ec2 v1.279.2
github.com/aws/aws-sdk-go-v2/service/eks v1.77.0
github.com/aws/aws-sdk-go-v2/service/iam v1.53.2
github.com/aws/aws-sdk-go-v2/service/sts v1.41.6
github.com/aws/karpenter-provider-aws v1.9.0
github.com/aws/smithy-go v1.24.0
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
Expand All @@ -60,7 +60,7 @@ require (
github.com/gobuffalo/flect v1.0.3
github.com/google/go-containerregistry v0.6.0
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/mattn/go-runewidth v0.0.16
github.com/mattn/go-runewidth v0.0.17
github.com/onsi/ginkgo/v2 v2.28.1
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
github.com/prometheus/client_golang v1.23.2
Expand Down Expand Up @@ -104,15 +104,16 @@ require (
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.70 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.32 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.17 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.25.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.3 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.7 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.9 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.13 // indirect
github.com/awslabs/operatorpkg v0.0.0-20251222193911-34e9a1898737 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down Expand Up @@ -183,7 +184,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/compress v1.18.1 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
Expand Down Expand Up @@ -297,3 +298,7 @@ require (
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.1 // indirect
)

// karpenter-provider-aws v1.9.0 transitively pulls in tablewriter v1.1.0 (breaking API change);
// pin to v0.0.5 which matches the replace directive in karpenter-provider-aws's own go.mod.
replace github.com/olekukonko/tablewriter => github.com/olekukonko/tablewriter v0.0.5
Loading
Loading