-
Notifications
You must be signed in to change notification settings - Fork 9
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
Bug: ensure we watch health probes in dnsrecord controller #308
Conversation
6fe3e24
to
8430c7c
Compare
logger.V(1).Info("unexpected object type", "error", fmt.Sprintf("%T is not a *v1alpha1.DNSHealthCheckProbe", o)) | ||
} | ||
|
||
records := &v1alpha1.DNSRecordList{} |
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 here we could do a get based on the owner ref on the probe? We only have one probe here and that probe can only belong to one record right? So :
- get fresh copy probe from cluster
- check status healthy against the one received in the watch function
- If different than the fresh copy, get dnsrecord based on ownerref of probe and requeue?
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.
Not fetching records in the watch at all now. Using owner reference for it
@@ -446,7 +505,7 @@ func setStatusConditions(record *v1alpha1.DNSRecord, hadChanges bool, notHealthy | |||
setDNSRecordCondition(record, string(v1alpha1.ConditionTypeReady), metav1.ConditionTrue, string(v1alpha1.ConditionReasonProviderSuccess), "Provider ensured the dns record") | |||
|
|||
// probes are disabled or not defined, or this is a wildcard record | |||
if record.Spec.HealthCheck == nil || strings.HasPrefix(record.Spec.RootHost, v1alpha1.WildcardPrefix) { | |||
if record.Spec.HealthCheck == nil || strings.HasPrefix(record.Spec.RootHost, v1alpha1.WildcardPrefix) || !probesEnabled { |
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.
starting to think we might remove the probes enabled flag soon
8430c7c
to
2cc4821
Compare
} | ||
|
||
probes := &v1alpha1.DNSHealthCheckProbeList{} |
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.
if we defined this early would it help with readability. IE jusst pass in the empty list of probes to updateStatus? as passing in nil is a bit obscure
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.
defined up top and passing it always into the update status func
Signed-off-by: Maskym Vavilov <[email protected]>
2cc4821
to
62a73b7
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.
Looks good tried a few scenrios DNSRecord and Policy ended up as expectd
status:
conditions:
- lastTransitionTime: "2024-11-20T07:14:32Z"
message: DNSPolicy has been accepted
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: "2024-11-21T08:15:08Z"
message: DNSPolicy has been successfully enforced
reason: Enforced
status: "True"
type: Enforced
- lastTransitionTime: "2024-11-22T11:20:05Z"
message: 'DNSPolicy has encountered some issues: not all sub-resources of policy
are passing the policy defined health check. Not healthy DNSRecords are: external-t1c
external-t1d '
reason: Unknown
status: "False"
type: SubResourcesHealthy
observedGeneration: 1
recordConditions:
t1c.cb.hcpapps.net:
- lastTransitionTime: "2024-11-22T11:20:03Z"
message: 'Not healthy addresses: [af2b62688c5454c35a1827a82e7d7c68-1089732621.eu-west-1.elb.amazonaws.com]'
observedGeneration: 1
reason: HealthChecksFailed
status: "False"
type: Healthy
t1d.cb.hcpapps.net:
- lastTransitionTime: "2024-11-22T11:20:03Z"
message: 'Not healthy addresses: [af2b62688c5454c35a1827a82e7d7c68-1089732621.eu-west-1.elb.amazonaws.com]'
observedGeneration: 1
reason: HealthChecksFailed
status: "False"
type: Healthy
totalRecords: 2
status:
conditions:
- lastTransitionTime: "2024-11-20T07:14:32Z"
message: DNSPolicy has been accepted
reason: Accepted
status: "True"
type: Accepted
- lastTransitionTime: "2024-11-21T08:15:08Z"
message: DNSPolicy has been successfully enforced
reason: Enforced
status: "True"
type: Enforced
- lastTransitionTime: "2024-11-22T14:06:42Z"
message: All sub-resources are healthy
reason: SubResourcesHealthy
status: "True"
type: SubResourcesHealthy
observedGeneration: 1
totalRecords: 2
Changes:
receivedPrematurely
to consult a list of probes (and not to retrieve probes twice I'm not passing them around)probes-enabled
flag set to true we now will ignore healthcheck spec. Before we would be waiting for probes to be created (they will not be created)