Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: EC2 and EKS migration v2 #7198

Merged
merged 46 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
83ea515
EC2API migration
edibble21 Oct 10, 2024
c0f71ef
Migrated launchtemplate_counter
edibble21 Oct 10, 2024
9013225
fixing linter issues
edibble21 Oct 11, 2024
eea07e7
fixed client connectivity check
edibble21 Oct 11, 2024
c8a4cba
docs: clarify do-not-consolidate/do-not-evict was replaced, not remov…
njtran Oct 14, 2024
9b8c87f
test: Add e2e testing for deprecated AMIs (#6990)
engedaam Oct 14, 2024
1749533
chore(deps): bump actions/upload-artifact from 4.4.0 to 4.4.3 in the …
dependabot[bot] Oct 14, 2024
3012c72
chore(deps): bump actions/cache from 4.1.0 to 4.1.1 in /.github/actio…
dependabot[bot] Oct 14, 2024
2af93e2
chore(deps): bump actions/checkout from 4.2.0 to 4.2.1 in /.github/ac…
dependabot[bot] Oct 14, 2024
7225b43
chore: Migrated ssm, sts, fis, and sqs to v2 (#7197)
edibble21 Oct 14, 2024
57fb8ca
EC2API migration
edibble21 Oct 10, 2024
1aca482
Migrated launchtemplate_counter
edibble21 Oct 10, 2024
055fa0f
Fix dependency issues
edibble21 Oct 15, 2024
94cc9be
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 15, 2024
7c8cd8a
ci test fix
edibble21 Oct 15, 2024
364894b
fix before each issue
edibble21 Oct 16, 2024
1a95784
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 16, 2024
d98cd33
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 16, 2024
8a1b2c4
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 16, 2024
fbfbe9c
e2e test fixes
edibble21 Oct 16, 2024
8359885
nodeclaim e2e test fix
edibble21 Oct 17, 2024
823bb54
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 17, 2024
2ba1e82
prometheus fix
edibble21 Oct 17, 2024
3264099
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 22, 2024
e6a103f
ci-test fixes
edibble21 Oct 22, 2024
32e9703
Addressed feedback
edibble21 Oct 22, 2024
101fea3
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 23, 2024
10e4a66
Merge branch 'aws:main' into EC2MigrationV2
edibble21 Oct 25, 2024
14181dd
addressed more feedback
edibble21 Oct 29, 2024
03d7f22
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 29, 2024
e734605
fixed ci-test
edibble21 Oct 29, 2024
ef0edf4
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 29, 2024
b7746d9
Adressed New Feedback
edibble21 Oct 31, 2024
e1894a0
Merge branch 'main' into EC2MigrationV2
edibble21 Oct 31, 2024
c7cfda1
fix presubmit
edibble21 Oct 31, 2024
de7e1c5
Merge branch 'main' into EC2MigrationV2
edibble21 Nov 1, 2024
23a55e6
Merge branch 'main' into EC2MigrationV2
edibble21 Nov 1, 2024
11896da
Merge branch 'main' into EC2MigrationV2
edibble21 Nov 4, 2024
5134c22
Addressed feedback
edibble21 Nov 4, 2024
0d43d99
Merge branch 'main' into EC2MigrationV2
edibble21 Nov 5, 2024
df89470
Fix Error Code
edibble21 Nov 5, 2024
19eca8a
fix presubmit
edibble21 Nov 5, 2024
6d93d89
latest feedback changes
edibble21 Nov 6, 2024
321b04c
Merge branch 'main' into EC2MigrationV2
edibble21 Nov 6, 2024
0dc890a
feedback changes
edibble21 Nov 6, 2024
e9c9a88
fixed nit
edibble21 Nov 6, 2024
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 cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
WithControllers(ctx, controllers.NewControllers(
ctx,
op.Manager,
op.Session,
edibble21 marked this conversation as resolved.
Show resolved Hide resolved
op.Config,
op.Clock,
op.GetClient(),
op.EventRecorder,
Expand Down
31 changes: 26 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ require (
github.com/Pallinder/go-randomdata v1.2.0
github.com/PuerkitoBio/goquery v1.10.0
github.com/avast/retry-go v3.0.0+incompatible
github.com/aws/aws-sdk-go v1.55.5
github.com/aws/aws-sdk-go-v2 v1.32.3
github.com/aws/aws-sdk-go-v2/config v1.28.1
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18
github.com/aws/aws-sdk-go-v2/service/ec2 v1.187.0
github.com/aws/aws-sdk-go-v2/service/eks v1.50.2
github.com/aws/aws-sdk-go-v2/service/fis v1.30.3
github.com/aws/aws-sdk-go-v2/service/iam v1.37.3
github.com/aws/aws-sdk-go-v2/service/pricing v1.32.2
github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3
github.com/aws/aws-sdk-go-v2/service/ssm v1.55.3
github.com/aws/aws-sdk-go-v2/service/sts v1.32.3
github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.29.2
github.com/aws/karpenter-provider-aws/tools/kompat v0.0.0-20240410220356-6b868db24881
github.com/aws/smithy-go v1.22.0
github.com/awslabs/amazon-eks-ami/nodeadm v0.0.0-20240229193347-cfab22a10647
github.com/awslabs/operatorpkg v0.0.0-20240920182301-771460b3160b
github.com/go-logr/zapr v1.3.0
github.com/imdario/mergo v0.3.16
github.com/jonathan-innis/aws-sdk-go-prometheus v0.1.1-0.20240804232425-54c8227e0bab
github.com/mitchellh/hashstructure/v2 v2.0.2
github.com/onsi/ginkgo/v2 v2.21.0
github.com/onsi/gomega v1.35.1
Expand Down Expand Up @@ -48,6 +52,7 @@ require (
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3 // indirect
Expand All @@ -56,9 +61,6 @@ require (
require (
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/aws/aws-sdk-go-v2/service/fis v1.30.3
github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3
github.com/aws/aws-sdk-go-v2/service/ssm v1.55.3
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand All @@ -82,6 +84,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jonathan-innis/aws-sdk-go-prometheus v0.1.0
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
Expand Down Expand Up @@ -121,3 +124,21 @@ require (
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)

//Here until we can drop dependency on github.com/jonathan-innis/aws-sdk-go-prometheus
replace (
edibble21 marked this conversation as resolved.
Show resolved Hide resolved
github.com/aws/aws-sdk-go-v2 => github.com/aws/aws-sdk-go-v2 v1.30.5
github.com/aws/aws-sdk-go-v2/config => github.com/aws/aws-sdk-go-v2/config v1.27.34
github.com/aws/aws-sdk-go-v2/service/ec2 => github.com/aws/aws-sdk-go-v2/service/ec2 v1.177.0
github.com/aws/aws-sdk-go-v2/service/eks => github.com/aws/aws-sdk-go-v2/service/eks v1.48.0
github.com/aws/aws-sdk-go-v2/service/fis => github.com/aws/aws-sdk-go-v2/service/fis v1.27.0
github.com/aws/aws-sdk-go-v2/service/iam => github.com/aws/aws-sdk-go-v2/service/iam v1.35.0
github.com/aws/aws-sdk-go-v2/service/pricing => github.com/aws/aws-sdk-go-v2/service/pricing v1.28.0
github.com/aws/aws-sdk-go-v2/service/sqs => github.com/aws/aws-sdk-go-v2/service/sqs v1.34.6
github.com/aws/aws-sdk-go-v2/service/ssm => github.com/aws/aws-sdk-go-v2/service/ssm v1.52.4
github.com/aws/aws-sdk-go-v2/service/sso => github.com/aws/aws-sdk-go-v2/service/sso v1.15.0
github.com/aws/aws-sdk-go-v2/service/ssoadmin => github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.22.0
github.com/aws/aws-sdk-go-v2/service/ssooidc => github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.0
github.com/aws/aws-sdk-go-v2/service/sts => github.com/aws/aws-sdk-go-v2/service/sts v1.28.2
github.com/aws/aws-sdk-go-v2/service/timestreamwrite => github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.23.2
)
59 changes: 35 additions & 24 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,54 @@ github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsVi
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0=
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/aws/aws-sdk-go-v2 v1.32.3 h1:T0dRlFBKcdaUPGNtkBSwHZxrtis8CQU17UpNBZYd0wk=
github.com/aws/aws-sdk-go-v2 v1.32.3/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo=
github.com/aws/aws-sdk-go-v2/config v1.28.1 h1:oxIvOUXy8x0U3fR//0eq+RdCKimWI900+SV+10xsCBw=
github.com/aws/aws-sdk-go-v2/config v1.28.1/go.mod h1:bRQcttQJiARbd5JZxw6wG0yIK3eLeSCPdg6uqmmlIiI=
github.com/aws/aws-sdk-go-v2 v1.30.5 h1:mWSRTwQAb0aLE17dSzztCVJWI9+cRMgqebndjwDyK0g=
github.com/aws/aws-sdk-go-v2 v1.30.5/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0=
github.com/aws/aws-sdk-go-v2/config v1.27.34 h1:5sLceuETg/215nLtY/QIVB2O6cosS0iC/Tx5oyqUhbw=
github.com/aws/aws-sdk-go-v2/config v1.27.34/go.mod h1:kEqdYzRb8dd8Sy2pOdEbExTTF5v7ozEXX0McgPE7xks=
github.com/aws/aws-sdk-go-v2/credentials v1.17.42 h1:sBP0RPjBU4neGpIYyx8mkU2QqLPl5u9cmdTWVzIpHkM=
github.com/aws/aws-sdk-go-v2/credentials v1.17.42/go.mod h1:FwZBfU530dJ26rv9saAbxa9Ej3eF/AK0OAY86k13n4M=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18 h1:68jFVtt3NulEzojFesM/WVarlFpCaXLKaBxDpzkQ9OQ=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18/go.mod h1:Fjnn5jQVIo6VyedMc0/EhPpfNlPl7dHV916O6B+49aE=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22 h1:Jw50LwEkVjuVzE1NzkhNKkBf9cRN7MtE1F/b2cOKTUM=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22/go.mod h1:Y/SmAyPcOTmpeVaWSzSKiILfXTVJwrGmYZhcRbhWuEY=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22 h1:981MHwBaRZM7+9QSR6XamDzF/o7ouUGxFzr+nVSIhrs=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22/go.mod h1:1RA1+aBEfn+CAB/Mh0MB6LsdCYCnjZm7tKXtnk499ZQ=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.187.0 h1:cA4hWo269CN5RY7Arqt8BfzXF0KIN8DSNo/KcqHKkWk=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.187.0/go.mod h1:ossaD9Z1ugYb6sq9QIqQLEOorCGcqUoxlhud9M9yE70=
github.com/aws/aws-sdk-go-v2/service/fis v1.30.3 h1:ePY232tW0O4pq0oeXFNqsjixQqX+g8+vTgu72og4RtM=
github.com/aws/aws-sdk-go-v2/service/fis v1.30.3/go.mod h1:Xwo+AAp9l2Li0t9mFQRdtMqRtNb4AL0s6c6fHr0iF9E=
github.com/aws/aws-sdk-go-v2/service/iam v1.37.3 h1:uuoXyOwX2ReYgHJW0W84cKDUrvQNQA2l9KhkXUgT+R4=
github.com/aws/aws-sdk-go-v2/service/iam v1.37.3/go.mod h1:RCrjvkN/ZpVAzW3ZmIlyflv7MUM45YlWx3v+6MaVX2w=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.177.0 h1:LAdDRIj5BEZM9fLDTUWUyPzWvv5A++nCEps/RGmZNOo=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.177.0/go.mod h1:ISODge3zgdwOEa4Ou6WM9PKbxJWJ15DYKnr2bfmCAIA=
github.com/aws/aws-sdk-go-v2/service/eks v1.48.0 h1:KuCjjkUNMUn8RV5ncnJ5rUlkkzKqS5qod67jgU4k/aA=
github.com/aws/aws-sdk-go-v2/service/eks v1.48.0/go.mod h1:awleuSoavuUt32hemzWdSrI47zq7slFtIj8St07EXpE=
github.com/aws/aws-sdk-go-v2/service/fis v1.27.0 h1:UfzjSUfxR7Suy/t1OfkExG0s1vxPgIP1//gIYutlZ9I=
github.com/aws/aws-sdk-go-v2/service/fis v1.27.0/go.mod h1:QmdVf0N/vrhckZLHK4x+f+u9EUuMhetsRgu1rjU1eL0=
github.com/aws/aws-sdk-go-v2/service/iam v1.35.0 h1:xIjTizH74aMNQBjp9D5cvjRZmOYtnrpjOGU3xkVqrjk=
github.com/aws/aws-sdk-go-v2/service/iam v1.35.0/go.mod h1:IdHqqRLKgxYR4IY7Omd7SuV4SJzJ8seF+U5PW+mvtP4=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ=
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 h1:1G7TTQNPNv5fhCyIQGYk8FOggLgkzKq6c4Y1nOGzAOE=
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2/go.mod h1:+ybYGLXoF7bcD7wIcMcklxyABZQmuBf1cHUhvY6FGIo=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3 h1:qcxX0JYlgWH3hpPUnd6U0ikcl6LLA9sLkXE2w1fpMvY=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3/go.mod h1:cLSNEmI45soc+Ef8K/L+8sEA3A3pYFEYf5B5UI+6bH4=
github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3 h1:H1bCg79Q4PDtxQH8Fn5kASQlbVv2WGP5o5IEFEBNOAs=
github.com/aws/aws-sdk-go-v2/service/sqs v1.36.3/go.mod h1:W6Uy6OWgxF9RZuHoikthB6f+A0oYXqnfWmFl5m7E2G4=
github.com/aws/aws-sdk-go-v2/service/ssm v1.55.3 h1:nbFGlCxyyFe2cgg8WNQQtzDRVczO4+1dL4hd3TDU6MM=
github.com/aws/aws-sdk-go-v2/service/ssm v1.55.3/go.mod h1:nzUlOBAMlQx9zKwtI10FOzJa2phU6bmFbXhD6LLbr/A=
github.com/aws/aws-sdk-go-v2/service/sso v1.24.3 h1:UTpsIf0loCIWEbrqdLb+0RxnTXfWh2vhw4nQmFi4nPc=
github.com/aws/aws-sdk-go-v2/service/sso v1.24.3/go.mod h1:FZ9j3PFHHAR+w0BSEjK955w5YD2UwB/l/H0yAK3MJvI=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3 h1:2YCmIXv3tmiItw0LlYf6v7gEHebLY45kBEnPezbUKyU=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3/go.mod h1:u19stRyNPxGhj6dRm+Cdgu6N75qnbW7+QN0q0dsAk58=
github.com/aws/aws-sdk-go-v2/service/sts v1.32.3 h1:wVnQ6tigGsRqSWDEEyH6lSAJ9OyFUsSnbaUWChuSGzs=
github.com/aws/aws-sdk-go-v2/service/sts v1.32.3/go.mod h1:VZa9yTFyj4o10YGsmDO4gbQJUvvhY72fhumT8W4LqsE=
github.com/aws/aws-sdk-go-v2/service/pricing v1.28.0 h1:fvHH3/l0qhZs4bEEkNJx/ljs9vpXtfJacUhNAQTS9bE=
github.com/aws/aws-sdk-go-v2/service/pricing v1.28.0/go.mod h1:oB3Na0szArXW5rngmmBdNdJN4jsMvRTFpWZ6sGaqDDk=
github.com/aws/aws-sdk-go-v2/service/sqs v1.34.6 h1:DbjODDHumQBdJ3T+EO7AXVoFUeUhAsJYOdjStH5Ws4A=
github.com/aws/aws-sdk-go-v2/service/sqs v1.34.6/go.mod h1:7idt3XszF6sE9WPS1GqZRiDJOxw4oPtlRBXodWnCGjU=
github.com/aws/aws-sdk-go-v2/service/ssm v1.52.4 h1:hgSBvRT7JEWx2+vEGI9/Ld5rZtl7M5lu8PqdvOmbRHw=
github.com/aws/aws-sdk-go-v2/service/ssm v1.52.4/go.mod h1:v7NIzEFIHBiicOMaMTuEmbnzGnqW0d+6ulNALul6fYE=
github.com/aws/aws-sdk-go-v2/service/sso v1.15.0 h1:vuGK1vHNP9zx0PfOrtPumbwR2af0ATQ1Z2H6p75AgRQ=
github.com/aws/aws-sdk-go-v2/service/sso v1.15.0/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.0 h1:/XiEU7VIFcVWRDQLabyrSjBoKIm8UkYgsvWDuFW8Img=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.0/go.mod h1:dWqm5G767qwKPuayKfzm4rjzFmVjiBFbOJrpSPnAMDs=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.2 h1:0YjXuWdYHvsm0HnT4vO8XpwG1D+i2roxSCBoN6deJ7M=
github.com/aws/aws-sdk-go-v2/service/sts v1.28.2/go.mod h1:jI+FWmYkSMn+4APWmZiZTgt0oM0TrvymD51FMqCnWgA=
github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.23.2 h1:iQLzzfvdcTNhzQsLit7zAYfepsfBMOtKRW6kFBcOQrY=
github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.23.2/go.mod h1:Pb7gC2/opbYq9ynlFP0VC5moP16oT6rWPCW6dsY3Cyw=
github.com/aws/karpenter-provider-aws/tools/kompat v0.0.0-20240410220356-6b868db24881 h1:m9rhsGhdepdQV96tZgfy68oU75AWAjOH8u65OefTjwA=
github.com/aws/karpenter-provider-aws/tools/kompat v0.0.0-20240410220356-6b868db24881/go.mod h1:+Mk5k0b6HpKobxNq+B56DOhZ+I/NiPhd5MIBhQMSTSs=
github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM=
github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/awslabs/amazon-eks-ami/nodeadm v0.0.0-20240229193347-cfab22a10647 h1:8yRBVsjGmI7qQsPWtIrbWP+XfwHO9Wq7gdLVzjqiZFs=
Expand Down Expand Up @@ -94,6 +104,7 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
Expand All @@ -112,8 +123,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jonathan-innis/aws-sdk-go-prometheus v0.1.1-0.20240804232425-54c8227e0bab h1:3eIYcxyYhgZEmXLn6Es74ztsfW+2SFd9WR2HwfEGumk=
github.com/jonathan-innis/aws-sdk-go-prometheus v0.1.1-0.20240804232425-54c8227e0bab/go.mod h1:DDom1Ae898wsni+arqgipv+JgtDtVDmbJB5YLOQz25s=
github.com/jonathan-innis/aws-sdk-go-prometheus v0.1.0 h1:6eJFFxJ+2hbSEshwyLCLGUAf4/tXq8vpajf5QxcL8ew=
github.com/jonathan-innis/aws-sdk-go-prometheus v0.1.0/go.mod h1:DDom1Ae898wsni+arqgipv+JgtDtVDmbJB5YLOQz25s=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down
41 changes: 24 additions & 17 deletions hack/code/bandwidth_gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
package main

import (
"context"
"flag"
"fmt"
"go/format"
Expand All @@ -26,8 +27,9 @@ import (
"strings"

"github.com/PuerkitoBio/goquery"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ec2"
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
edibble21 marked this conversation as resolved.
Show resolved Hide resolved
"github.com/samber/lo"
)

Expand Down Expand Up @@ -62,8 +64,8 @@ func main() {
log.Fatalf("Usage: `bandwidth_gen.go pkg/providers/instancetype/zz_generated.bandwidth.go`")
}

bandwidth := map[string]int64{}
vagueBandwidth := map[string]string{}
bandwidth := map[ec2types.InstanceType]int64{}
vagueBandwidth := map[ec2types.InstanceType]string{}

for uri, selector := range uriSelectors {
func() {
Expand All @@ -76,33 +78,37 @@ func main() {
// description for bandwidth such as "Very Low", "Low", "Low to Moderate", etc. These instance types
// will be ignored since we don't know the exact bandwidth for these instance types
for _, row := range doc.Find(selector).NextAllFiltered(".table-container").Eq(0).Find("tbody").Find("tr").Nodes {
instanceTypeData := strings.TrimSpace(row.FirstChild.NextSibling.FirstChild.Data)
if !strings.ContainsAny(instanceTypeData, ".") {
instanceTypeName := strings.TrimSpace(row.FirstChild.NextSibling.FirstChild.Data)
if !strings.ContainsAny(instanceTypeName, ".") {
continue
}
bandwidthData := row.FirstChild.NextSibling.NextSibling.NextSibling.FirstChild.Data
// exclude all rows that contain any of the following strings
if containsAny(bandwidthData, "Low", "Moderate", "High", "Up to") {
vagueBandwidth[instanceTypeData] = bandwidthData
vagueBandwidth[ec2types.InstanceType(instanceTypeName)] = bandwidthData
continue
}
bandwidthSlice := strings.Split(bandwidthData, " ")
// if the first value contains a multiplier i.e. (4x 100 Gigabit)
if strings.HasSuffix(bandwidthSlice[0], "x") {
multiplier := lo.Must(strconv.ParseFloat(bandwidthSlice[0][:len(bandwidthSlice[0])-1], 64))
bandwidth[instanceTypeData] = int64(lo.Must(strconv.ParseFloat(bandwidthSlice[1], 64)) * 1000 * multiplier)
bandwidth[ec2types.InstanceType(instanceTypeName)] = int64(lo.Must(strconv.ParseFloat(bandwidthSlice[1], 64)) * 1000 * multiplier)
// Check row for instancetype for described network performance value i.e (2 Gigabit)
} else {
bandwidth[instanceTypeData] = int64(lo.Must(strconv.ParseFloat(bandwidthSlice[0], 64)) * 1000)
bandwidth[ec2types.InstanceType(instanceTypeName)] = int64(lo.Must(strconv.ParseFloat(bandwidthSlice[0], 64)) * 1000)
}
}
}()
}
allInstanceTypes := getAllInstanceTypes()
instanceTypes := lo.Keys(bandwidth)
// 2d sort for readability
sort.Strings(allInstanceTypes)
sort.Strings(instanceTypes)
sort.SliceStable(allInstanceTypes, func(i, j int) bool {
return allInstanceTypes[i] < allInstanceTypes[j]
edibble21 marked this conversation as resolved.
Show resolved Hide resolved
})
sort.SliceStable(instanceTypes, func(i, j int) bool {
return instanceTypes[i] < instanceTypes[j]
})
sort.SliceStable(instanceTypes, func(i, j int) bool {
return bandwidth[instanceTypes[i]] < bandwidth[instanceTypes[j]]
})
Expand Down Expand Up @@ -138,22 +144,23 @@ func containsAny(value string, excludedSubstrings ...string) bool {
return false
}

func getAllInstanceTypes() []string {
func getAllInstanceTypes() []ec2types.InstanceType {
if err := os.Setenv("AWS_SDK_LOAD_CONFIG", "true"); err != nil {
log.Fatalf("setting AWS_SDK_LOAD_CONFIG, %s", err)
}
if err := os.Setenv("AWS_REGION", "us-east-1"); err != nil {
log.Fatalf("setting AWS_REGION, %s", err)
}
sess := session.Must(session.NewSession())
ec2api := ec2.New(sess)
var allInstanceTypes []string
ctx := context.Background()
cfg := lo.Must(config.LoadDefaultConfig(ctx))
ec2api := ec2.NewFromConfig(cfg)
var allInstanceTypes []ec2types.InstanceType

params := &ec2.DescribeInstanceTypesInput{}
// Retrieve the instance types in a loop using NextToken
for {
result := lo.Must(ec2api.DescribeInstanceTypes(params))
allInstanceTypes = append(allInstanceTypes, lo.Map(result.InstanceTypes, func(info *ec2.InstanceTypeInfo, _ int) string { return *info.InstanceType })...)
result := lo.Must(ec2api.DescribeInstanceTypes(ctx, params))
allInstanceTypes = append(allInstanceTypes, lo.Map(result.InstanceTypes, func(info ec2types.InstanceTypeInfo, _ int) ec2types.InstanceType { return info.InstanceType })...)
// Check if they are any instances left
if result.NextToken != nil {
params.NextToken = result.NextToken
Expand Down
Loading
Loading