-
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
Webhook provider #3063
Merged
+990
−2
Merged
Webhook provider #3063
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
8c864e4
initial plugin implementation
Raffo dd170b9
rename to webhook
Raffo e9430b1
json encoder changes
Raffo 1bf2f55
addressing review comments
Raffo 41fda59
changes according to ionos review
Raffo aab165c
Merge branch 'master' into raffo/plugin-provider
Raffo 376f947
fix to accomodate changes in master
Raffo b3290c6
Merge branch 'master' into raffo/plugin-provider
Raffo 918b996
fixes to accomodate master changes
Raffo e263339
remove all propertyvaluesequals leftovers
Raffo 8f02beb
readd negotiation to pass the domain filter around
Raffo 36b29bf
fix domain filter passing
Raffo 8476822
webhook fixes
Raffo 38d671a
fix tests
Raffo d58bb11
fix docs
Raffo 590dafd
docs fixes
Raffo 0ce7433
Merge branch 'master' into raffo/plugin-provider
Raffo ee56947
code review comments on json unmarshal
Raffo c678912
Merge branch 'master' into raffo/plugin-provider
Raffo 7e35d6c
handle error in adjustendpoints
Raffo 62540d2
fix a bunch of wrong require
Raffo e4bd3ad
tests and docs
Raffo 344679c
fix typo
Raffo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Webhook provider | ||
|
||
The "Webhook" provider allows integrating ExternalDNS with DNS providers through an HTTP interface. | ||
The Webhook provider implements the `Provider` interface. Instead of implementing code specific to a provider, it implements an HTTP client that sends requests to an HTTP API. | ||
The idea behind it is that providers can be implemented in separate programs: these programs expose an HTTP API that the Webhook provider interacts with. The ideal setup for providers is to run as a sidecar in the same pod of the ExternalDNS container, listening only on localhost. This is not strictly a requirement, but we do not recommend other setups. | ||
|
||
## Architectural diagram | ||
|
||
![Webhook provider](../img/webhook-provider.png) | ||
|
||
## API guarantees | ||
|
||
Providers implementing the HTTP API have to keep in sync with changes to the JSON serialization of Go types `plan.Changes`, `endpoint.Endpoint`, and `endpoint.DomainFilter`. Given the maturity of the project, we do not expect to make significant changes to those types, but can't exclude the possibility that changes will need to happen. We commit to publishing changes to those in the release notes, to ensure that providers implementing the API can keep providers up to date quickly. | ||
|
||
## Implementation requirements | ||
|
||
The following table represents the methods to implement mapped to their HTTP method and route. | ||
|
||
| Provider method | HTTP Method | Route | | ||
| --- | --- | --- | | ||
| Records | GET | /records | | ||
| AdjustEndpoints | POST | /adjustendpoints | | ||
| ApplyChanges | POST | /records | | ||
|
||
ExternalDNS will also make requests to the `/` endpoint for negotiation and for deserialization of the `DomainFilter`. | ||
|
||
The server needs to respond to those requests by reading the `Accept` header and responding with a corresponding `Content-Type` header specifying the supported media type format and version. | ||
|
||
**NOTE**: only `5xx` responses will be retried and only `20x` will be considered as successful. All status codes different from those will be considered a failure on ExternalDNS's side. | ||
|
||
## Provider registry | ||
|
||
To simplify the discovery of providers, we will accept pull requests that will add links to providers in the [README](../../README.md) file. This list will only serve the purpose of simplifying finding providers and will not constitute an official endorsement of any of the externally implemented providers unless otherwise stated. | ||
|
||
## Run the AWS provider with the webhook provider. | ||
|
||
To test the Webhook provider and provide a reference implementation, we added the functionality to run the AWS provider as a webhook. To run the AWS provider as a webhook, you need the following flags: | ||
|
||
```yaml | ||
- --provider=webhook | ||
- --run-aws-provider-as-webhook | ||
``` | ||
|
||
What will happen behind the scenes is that the AWS provider will be be started as an HTTP server exposed only on localhost and the webhook provider will be configured to talk to it. This is the same setup that we recommend for other providers and a good way to test the Webhook provider. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 suspect we'll want to move to a
--webhook
mechanism, where the binary only runs as the webhook. That would be helpful for building out the Helm chart support. I don't think this blocks this PR.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.
That's a good idea, I think we can refactor this later.