-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
DiscoveryConfigStatus: update even when no resource is found #50433
DiscoveryConfigStatus: update even when no resource is found #50433
Conversation
0b9f6d7
to
a9ab5d1
Compare
730cad4
to
0ace00a
Compare
74eed50
to
119ec30
Compare
lib/utils/slices/slices.go
Outdated
for _, t := range ts { | ||
if s, include := fn(t); include { | ||
ss = append(ss, s) | ||
if _, ok := seen[s]; !ok { |
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.
suggestion: so it's readable
if _, ok := seen[s]; !ok { | |
if _, seen := seen[s]; !seen { |
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.
This redefines the seen
identifier to be a boolean, and then we can't access the seen
map.
I'll change it to found
:
if _, found := seen[s]; !found {
seen[s] = struct{}{}
ss = append(ss, s)
}
During Auto Discover, when using a DiscoveryConfig, if no resources are found, the DiscoveryConfigStatus is not updated accordingly. This PR ensures that, even when no resources are found, the status will report so.
119ec30
to
0316455
Compare
@marcoandredinis See the table below for backport results.
|
* DiscoveryConfigStatus: update even when no resource is found During Auto Discover, when using a DiscoveryConfig, if no resources are found, the DiscoveryConfigStatus is not updated accordingly. This PR ensures that, even when no resources are found, the status will report so. * use comparable instead of any for generic method * remove useless un-named function on PreFetchHooks * prevent call to ssm:SendCommand with 0 instances * rename var from ok to found
* DiscoveryConfigStatus: update even when no resource is found During Auto Discover, when using a DiscoveryConfig, if no resources are found, the DiscoveryConfigStatus is not updated accordingly. This PR ensures that, even when no resources are found, the status will report so. * use comparable instead of any for generic method * remove useless un-named function on PreFetchHooks * prevent call to ssm:SendCommand with 0 instances * rename var from ok to found
* DiscoveryConfigStatus: update even when no resource is found During Auto Discover, when using a DiscoveryConfig, if no resources are found, the DiscoveryConfigStatus is not updated accordingly. This PR ensures that, even when no resources are found, the status will report so. * use comparable instead of any for generic method * remove useless un-named function on PreFetchHooks * prevent call to ssm:SendCommand with 0 instances * rename var from ok to found
…#50766) * DiscoveryConfigStatus: update even when no resource is found During Auto Discover, when using a DiscoveryConfig, if no resources are found, the DiscoveryConfigStatus is not updated accordingly. This PR ensures that, even when no resources are found, the status will report so. * use comparable instead of any for generic method * remove useless un-named function on PreFetchHooks * prevent call to ssm:SendCommand with 0 instances * rename var from ok to found
During Auto Discover, when using a DiscoveryConfig, if no resources are found, the DiscoveryConfigStatus is not updated accordingly.
This PR ensures that, even when no resources are found, the status will report so.
Demo:
![image](https://private-user-images.githubusercontent.com/689271/397368855-bee0af92-f5a7-4bb1-9cdd-7c19ba9811da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NDk3MDYsIm5iZiI6MTczODg0OTQwNiwicGF0aCI6Ii82ODkyNzEvMzk3MzY4ODU1LWJlZTBhZjkyLWY1YTctNGJiMS05Y2RkLTdjMTliYTk4MTFkYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwNlQxMzQzMjZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01ZGYzYzQ2NmQxNmYwNzdjNGJmYzBmNjhlZGRkNDE4Y2YwMzFkNjNlNzM5NzRkYzZlNjc2MjdjYjNjNWVhMGIyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ncKsqdmCsAG35i5hoMU2yFgyTN7UqsSwA165TscJ-ak)
There's also a fix for the EC2 flow where we could call
ssm:SendCommand
with 0 instances. This caused a bad reporting of the status.