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
addon: Add support for logging agent health checking #42
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 9196016992Details
💛 - Coveralls |
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.
General comment, currently MCOA supports having multiple signals enabled or disabled so in the ideal scenario the health prober should consider that all signals might not always be enabled (if possible).
OtelcolName = "spoke-otelcol" | ||
OtelcolNS = "spoke-otelcol" |
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.
We need to get this information from the ManagedClusterAddOn
object. The same for Logging
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.
Good job! Looks promising 👀
if *value.Value.String == "Ready" { | ||
return nil | ||
} | ||
|
||
return fmt.Errorf("%w: status condition type is %s for %s/%s", ErrWrongType, *value.Value.String, identifier.Namespace, identifier.Name) |
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.
I feel this way it's easier to understand the code path
if *value.Value.String == "Ready" { | |
return nil | |
} | |
return fmt.Errorf("%w: status condition type is %s for %s/%s", ErrWrongType, *value.Value.String, identifier.Namespace, identifier.Name) | |
if *value.Value.String != "Ready" { | |
return fmt.Errorf("%w: status condition type is %s for %s/%s", ErrWrongType, *value.Value.String, identifier.Namespace, identifier.Name) | |
} | |
return nil |
if *value.Value.Integer >= 1 { | ||
return nil | ||
} | ||
|
||
return fmt.Errorf("%w: replicas is %d for %s/%s", ErrWrongType, *value.Value.Integer, identifier.Namespace, identifier.Name) |
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.
Same here
if *value.Value.Integer >= 1 { | |
return nil | |
} | |
return fmt.Errorf("%w: replicas is %d for %s/%s", ErrWrongType, *value.Value.Integer, identifier.Namespace, identifier.Name) | |
if *value.Value.Integer < 1 { | |
return fmt.Errorf("%w: replicas is %d for %s/%s", ErrWrongType, *value.Value.Integer, identifier.Namespace, identifier.Name) | |
} | |
return nil |
}, | ||
HealthCheck: func(identifier workapiv1.ResourceIdentifier, result workapiv1.StatusFeedbackResult) error { | ||
for _, value := range result.Values { | ||
if identifier.Resource == ClfResource { |
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.
I think I would change the if... else if... else to a switch statement, that might make it more easy read
Co-authored-by: Joao Marcal <joao.marcal12@gmail.com>
Co-authored-by: Joao Marcal <joao.marcal12@gmail.com>
Co-authored-by: Joao Marcal <joao.marcal12@gmail.com>
Co-authored-by: Joao Marcal <joao.marcal12@gmail.com>
With this PR, the addon agent will perform health checks on the spoke-cluster's ClusterLogForwarder and OTEL collector instances.
For the OTEL collector, if the
.spec.replicas
field is 0, it will reportAVAILABLE = False
to the addon:For the ClusterLogForwarder resource, the health is based on the status fields
.status.conditions.type
and.status.conditions.status