Skip to content
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

[Cloudflare] Custom record TTL #572

Merged
merged 2 commits into from
May 28, 2018
Merged

[Cloudflare] Custom record TTL #572

merged 2 commits into from
May 28, 2018

Conversation

njuettner
Copy link
Member

Custom record TTL annotation should be noted by Cloudflare provider

TTL min value is 120 everything below will take the default TTL which is 1 (automatic which means 300)

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 26, 2018
@njuettner njuettner changed the title Custom record TTL for Cloudflare [Cloudflare] Custom record TTL May 26, 2018
if proxied && (cloudFlareTypeNotSupported[endpoint.RecordType] || strings.Contains(endpoint.DNSName, "*")) {
proxied = false
}
//// min value:120
if endpoint.RecordTTL.IsConfigured() && endpoint.RecordTTL >= 120 {
Copy link

@ideahitme ideahitme May 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this logic belongs in External-DNS. I don't think we should try to do validation on behalf of DNS provider. This value might change and we don't want to keep track of it. If a user specifies a value under 120, then we should provide a reasonable error log message and ask user to fix it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree, usually I would expect this to be handled by the DNS provider. However if you would not implement it and you would set the TTL below 120 it will fail:

ERRO[0302] failed to create record: error from makeRequest: HTTP status 400: content "{\"success\":false,\"errors\":[{\"code\":1004,\"message\":\"DNS Validation Error\",\"error_chain\":[{\"code\":9021,\"message\":\"Invalid TTL. Must be between 120 and 2,147,483,647 seconds, or 1 for automatic\"}]}],\"messages\":[],\"result\":null}"

I can remove the && endpoint.RecordTTL >= 120 part and document it in docs/tutorials/cloudflare.md to make people aware of it.

WDYT?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah i think having a documentation plus handling the error with proper log message would be enough in my opinion.

@njuettner
Copy link
Member Author

@ideahitme I removed the part and added some context in the Cloudflare tutorial.

I checked external-dns again and it seems like the error is already logged and I think it's pretty understandable that you have to change the TTL at least to 120 or higher.

@ideahitme
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2018
@njuettner njuettner merged commit 43649f0 into master May 28, 2018
lou-lan pushed a commit to lou-lan/external-dns that referenced this pull request May 11, 2022
* refactor AssertPluginFromIndex
  * no need to pass t
  * mark as helper
  * swap parameter order to match method name + more intuitive

* refactor existing "krew install" integ tests to use this

Signed-off-by: Ahmet Alp Balkan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. provider/cloudflare size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants