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 1809354: dns: Avoid unnecessary updates #390
Bug 1809354: dns: Avoid unnecessary updates #390
Conversation
As discussed offline: this doesn't address a perhaps bigger problem which is that we're still unnecessarily updating the cloud provider every time because we're not comparing spec to status to identify diffs. If we did, not only would we only update the cloud provider when we think there's a change to be made, we could remove the AWS provider's internal caching logic. We also discussed how when Ensure() fails, we should only update the condition last transition time if the condition has a material change, and in the face of repeated failures, we should log events so that a timeline of failure can be established. |
a5e8142
to
9997222
Compare
@Miciah: This pull request references Bugzilla bug 1809354, which is valid. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@Miciah: This pull request references Bugzilla bug 1809354, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The test failure should be resolved by #396. /test e2e-aws-operator This change should also fix https://bugzilla.redhat.com/show_bug.cgi?id=1837324. /retitle Bug 1809354, 1837324: dns: Avoid unnecessary updates |
@Miciah: No Bugzilla bug is referenced in the title of this pull request. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Apparently support for linking multiple bugs was never merged. /retitle Bug 1809354: dns: Avoid unnecessary updates |
@Miciah: This pull request references Bugzilla bug 1809354, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I forgot that the reason that this was marked WIP was that it was blocked on openshift/api#644. /retitle WIP: Bug 1809354: dns: Avoid unnecessary updates |
9997222
to
3af46dc
Compare
@Miciah regarding #390 (comment), yes that's my understanding. Then the go.mod/go.sum in this PR needs to be updated to use openshift/api instead of your modified version. |
3af46dc
to
5876f2f
Compare
@Miciah: This pull request references Bugzilla bug 1809354, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Rebased onto github.com/openshift/api@17ada6e4245b4cc7a1f81ec04228e9093ec4f89e. |
5876f2f
to
4e7bcd6
Compare
Rebased to resolve a conflict in |
/retest |
4e7bcd6
to
3c839e6
Compare
I added a test case to |
* pkg/operator/controller/dns/controller.go (Reconcile): Use the new dnsZoneStatusSlicesEqual function to check whether an update is needed, and skip the update if it not. (publishRecordToZones): Use the new mergeStatuses function to merge the new zone statuses into the existing ones. (mergeStatuses): New function. Merge a slice of updated zone statuses into a slice of old zone statuses, using the new mergeConditions function. (clock): New variable. (mergeConditions): New function. Merge a slice of updated zone status conditions into an slice of old status conditions, using conditionChanged. (conditionChanged): New function. Return a Boolean value indicating whether two zone status conditions should be considered equal. (dnsZoneStatusSlicesEqual): New function. Return a Boolean value indicating whether two slices of zone statuses should be considered equal for the purpose of determining whether a status update is needed. * pkg/operator/controller/dns/controller_test.go (TestPublishRecordToZonesMergesStatus): New test. Verify that publishRecordToZones correctly merges status updates. (TestDnsZoneStatusSlicesEqual): New test. Verify that dnsZoneStatusSlicesEqual behaves correctly.
* pkg/operator/controller/dns/controller.go (publishRecordToZones): Log success or failure to publish the DNS record to a given DNS zone.
Bump to github.com/openshift/api@17ada6e4245b4cc7a1f81ec04228e9093ec4f89e to get DNSRecordStatus's ObservedGeneration field. * go.mod: Bump. * go.sum: * manifests/00-custom-resource-definition-internal.yaml: * pkg/manifests/bindata.go: * vendor/*: Regenerate.
When publishing a DNSRecord to a zone, check its status to determine whether the DNSRecord is already published to that zone, and if it is, skip publishing it to that zone. This commit fixes bug 1809354. https://bugzilla.redhat.com/show_bug.cgi?id=1809354 * pkg/operator/controller/dns/controller.go (Reconcile): Update the DNSRecord's observed generation. (publishRecordToZones): Use the observed generation and the new recordIsAlreadyPublishedToZone function to skip publishing the DNSRecord to a zone if the DNSRecord has previously been observed and its status conditions indicate that it is already published to the zone. (recordIsAlreadyPublishedToZone): New function. Use the provided DNSRecord's status to determine whether the DNSRecord is already published to the provided zone. * pkg/operator/controller/dns/controller_test.go (TestRecordIsAlreadyPublishedToZone): New test.
Delete caching in the DNS provider implementation for AWS now that the DNS controller uses the DNSRecord's status to avoid performing unnecessary updates. * pkg/dns/aws/dns.go (Provider): Delete the updatedRecords field. (NewProvider): Delete initialization of updatedRecords. (change): Delete updating of updatedRecords.
3c839e6
to
8cae0a4
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danehans, Miciah The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@Miciah: All pull requests linked via external trackers have merged: openshift/api#644, openshift/cluster-ingress-operator#390. Bugzilla bug 1809354 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
dns: Avoid spuriously updating a
DNSRecord
's statuspkg/operator/controller/dns/controller.go
(Reconcile
): Use the newdnsZoneStatusSlicesEqual
function to check whether an update is needed, and skip the update if it not.(
publishRecordToZones
): Use the newmergeStatuses
function to merge the new zone statuses into the existing ones.(
mergeStatuses
): New function. Merge a slice of updated zone statuses into a slice of old zone statuses, using the newmergeConditions
function.(
clock
): New variable.(
mergeConditions
): New function. Merge a slice of updated zone status conditions into an slice of old status conditions, usingconditionChanged
.(
conditionChanged
): New function. Return a Boolean value indicating whether two zone status conditions should be considered equal.(
dnsZoneStatusSlicesEqual
): New function. Return a Boolean value indicating whether two slices of zone statuses should be considered equal for the purpose of determining whether a status update is needed.pkg/operator/controller/dns/controller_test.go
(TestPublishRecordToZonesMergesStatus
): New test. Verify thatpublishRecordToZones
correctly merges status updates.(
TestDnsZoneStatusSlicesEqual
): New test. Verify thatdnsZoneStatusSlicesEqual
behaves correctly.dns: Log success or failure to publish record
pkg/operator/controller/dns/controller.go
(publishRecordToZones
): Log success or failure to publish the DNS record to a given DNS zone.Bump openshift/api for DNSRecord observedGeneration
Bump to github.com/openshift/api@17ada6e4245b4cc7a1f81ec04228e9093ec4f89e to get
DNSRecordStatus
'sObservedGeneration
field.go.mod
: Bump.go.sum
:manifests/00-custom-resource-definition-internal.yaml
:pkg/manifests/bindata.go
:vendor/*
: Regenerate.dns: Avoid publishing already published DNSRecords
When publishing a
DNSRecord
to a zone, check its status to determine whether theDNSRecord
is already published to that zone, and if it is, skip publishing it to that zone.pkg/operator/controller/dns/controller.go
(Reconcile
): Update theDNSRecord
's observed generation.(
publishRecordToZones
): Use the observed generation and the newrecordIsAlreadyPublishedToZone
function to skip publishing theDNSRecord
to a zone if theDNSRecord
has previously been observed and its status conditions indicate that it is already published to the zone.(
recordIsAlreadyPublishedToZone
): New function. Use the providedDNSRecord
's status to determine whether theDNSRecord
is already published to the provided zone.pkg/operator/controller/dns/controller_test.go
(TestRecordIsAlreadyPublishedToZone
): New test.dns/aws: Delete record caching
Delete caching in the DNS provider implementation for AWS now that the DNS controller uses the
DNSRecord
's status to avoid performing unnecessary updates.pkg/dns/aws/dns.go
(Provider
): Delete theupdatedRecords
field.(
NewProvider
): Delete initialization ofupdatedRecords
.(
change
): Delete updating ofupdatedRecords
.