-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Reduce AWS Route53 API calls #2010
Reduce AWS Route53 API calls #2010
Conversation
b10bf4b
to
11e44d3
Compare
/assign @njuettner |
11e44d3
to
5afaa9c
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.
Hey thanks your awesome work, really appreciated. I added some comments.
I'm happy to merge it if we can address my comments 🙂
@@ -40,7 +43,7 @@ type Plan struct { | |||
// Populated after calling Calculate() | |||
Changes *Changes | |||
// DomainFilter matches DNS names | |||
DomainFilter endpoint.DomainFilter | |||
DomainFilter endpoint.DomainFilterInterface |
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.
nit, I wouldn't name it Interface. Just change the description showing it's an interface
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 thought about changing endpoints.DomainFilter
to be an interface. The problem I face is that it is several providers like AlibabaCloud are relying on the internals ( mostly the Filters entry) I would like to keep the PR as small as possible even though it may lead to a need fo refactoring
controller/controller_test.go
Outdated
@@ -192,3 +216,44 @@ func TestShouldRunOnce(t *testing.T) { | |||
// But not two times | |||
assert.False(t, ctrl.ShouldRunOnce(now)) | |||
} | |||
|
|||
func TestControllerSkipsEmptyChanges(t *testing.T) { |
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.
Can you add tests for several domain filter and without a domain filter?
provider/dyn/dyn.go
Outdated
@@ -145,7 +154,14 @@ type ZonePublishResponse struct { | |||
// NewDynProvider initializes a new Dyn Provider. | |||
func NewDynProvider(config DynConfig) (provider.Provider, error) { | |||
return &dynProviderState{ |
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.
Please create a separate PR for dyn provider, I'd like to keep the PR as small as possible
/kind bug |
@tjamet 👋🏻 any progress since my last my comment? anything we can help with? We'd really like to merge it ❤️ . Is it possible to split it into smaller PR's, so we can focus for now only on Route53 changes? |
Hi @njuettner |
Currently, planning instructs to create all records even those which does not match any zone. Later, those records will be checked towards the existing records and filtered whether they match or not a hosted zone. This causes a problem, at least in the specific case of the Route53 implementation as it always calls the ApplyChanges method, which in its turn always retrieves all records in all zones. This causes high pressure on Route53 APIs, for non-necessary actions. By being able to filter all unmanaged records from the plan, we can prevent from calling ApplyChanges when nothing has to be done and hence prevent an unnecessary listing of records. By doing so, the rate of API calls to AWS Route53 is expected to be reduced by 2
5afaa9c
to
17fb881
Compare
Hi .. please could you advise when you think this PR will be merged? Many thanks. |
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.
small nit
Co-authored-by: Nick Jüttner <nick@juni.io>
@tjamet is this ready for another review? Will the DomainFilterInterface break anything for other providers? You mentioned it is used by different providers? Anything we need to test here as well? |
I think it is ready for review yes. |
Thanks again, as long we don't introduce a break and all providers keep running, I'm fine merging it 🙂 |
Indeed, I have been careful to do the smallest change possible and keep backward compatibility for this specific purpose. This makes me think this change should be safe for other providers |
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.
Ok @tjamet you wanted long enough, sorry about that. Once again thank you for your contribution and sorry about taking longer to merge this PR.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: njuettner, tjamet 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 |
no worries @njuettner thanks for yout support |
Currently, planning instructs to create all records even
those which does not match any zone.
Later, those records will be checked towards the existing
records and filtered whether they match or not a hosted zone.
This causes a problem, at least in the specific case of the Route53
implementation as it always calls the ApplyChanges method, which in its
turn always retrieves all records in all zones.
This causes high pressure on Route53 APIs, for non-necessary actions.
By being able to filter all unmanaged records from the plan, we can
prevent from calling ApplyChanges when nothing has to be done and hence
prevent an unnecessary listing of records.
By doing so, the rate of API calls to AWS Route53 is expected to be
reduced by 2
To do this change, providers now export, through registries, a DomainFilter, empty by default, provided by the BaseProvider.
This caused some conflicts on
dyn
andrcode0
provider structures that have been adapted to be closer to other provider ones.Any provider may now implement such a feature to restrict the planning output before it enters the registry.
Helps to improve #1293
With this change, in the case of a single instance of external-dns running for a single owner, we can expect no-op changes to reduce by 2 the number of calls to the AWS Route53 API while there are no changes to perform.
Checklist