-
Notifications
You must be signed in to change notification settings - Fork 112
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
Share common types between Autoscaler versions #1663
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1663 +/- ##
=======================================
Coverage 49.49% 49.49%
=======================================
Files 218 218
Lines 21244 21244
=======================================
Hits 10515 10515
Misses 10182 10182
Partials 547 547
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
|
1f18c4b
to
bcee78a
Compare
ceeeba6
to
1c6451e
Compare
1c6451e
to
380fff1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit on possibly defining solely uint64pointer while relying on other existing utils
// NewPointer returns a pointer to a new value instance | ||
func NewPointer[T any](v T) *T { | ||
return &v | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// NewPointer returns a pointer to a new value instance | |
func NewPointer[T any](v T) *T { | |
return &v | |
} | |
// NewUInt64Pointer returns pointer on a new uint64 value instance | |
func NewUInt64Pointer(i uint64) *uint64 { | |
return &i | |
} |
This NewPointer is solely used for uint64 as a new "case", while all other uses can be replaced with existing NewInt32Pointer
, NewBoolPointer
, but no strong opinion
APIVersion: "apps/v1", | ||
}, | ||
Owner: "test-owner", | ||
RemoteVersion: utils.NewPointer[uint64](10), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RemoteVersion: utils.NewPointer[uint64](10), | |
RemoteVersion: utils.NewUInt64Pointer(10), |
See comment on utils.go
file
Name: v1.ResourceCPU, | ||
Value: common.DatadogPodAutoscalerTargetValue{ | ||
Type: common.DatadogPodAutoscalerUtilizationTargetValueType, | ||
Utilization: utils.NewPointer[int32](80), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utilization: utils.NewPointer[int32](80), | |
Utilization: utils.NewInt32Pointer(80), |
Ditto
return nil | ||
} | ||
|
||
// As many type are shared, we'll assign the deep copied value to the new object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// As many type are shared, we'll assign the deep copied value to the new object | |
// As many types are shared, we'll assign the deep copied value to the new object |
return nil | ||
} | ||
|
||
// As many type are shared, we'll assign the deep copied value to the new object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// As many type are shared, we'll assign the deep copied value to the new object | |
// As many types are shared, we'll assign the deep copied value to the new object |
What does this PR do?
Share common types between Autoscaler versions to avoid useless conversions.
Motivation
Additional Notes
Minimum Agent Versions
Describe your test plan
Checklist
bug
,enhancement
,refactoring
,documentation
,tooling
, and/ordependencies
qa/skip-qa
label