-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Support SRV record creation with cloudflare provider #4754
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
base: master
Are you sure you want to change the base?
Support SRV record creation with cloudflare provider #4754
Conversation
Welcome @starcraft66! |
Hi @starcraft66. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
78a12d5
to
5f828ae
Compare
provider/cloudflare/cloudflare.go
Outdated
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.
Wdyt of checking IP format with ParseIP ?
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.
It wouldn't really make sense here afaik because the the target could be a hostname that would have to be resolved, so pretty much anything goes.
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.
Thanks for this PR. Overall it looks good, and it's tested 👍.
Wdyt of updating documentation in order to show how to create a SRV record ?
/ok-to-test |
Just added documentation |
docs/sources/srv-record.md
Outdated
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.
This might not be completely accurate but I can't test every provider, I just built this list by grepping for mentions of SRV
in the providers folder and searching the issue tracker.
@starcraft66 Thanks for the documentation. See my comments for a first review of the code. |
@starcraft66 Do you need any help with this PR, glad to help if possible. |
8dd6fe6
to
7372d50
Compare
@mloiseleur ready for review |
Hi. Nice on, I'll do an initial review. /label tide/merge-method-squash |
In order to start managing MX records you need to set the `--managed-record-types SRV` flag. | ||
|
||
```console | ||
external-dns --source crd --provider {akamai|civo|cloudflare|ibmcloud|linode|rfc2136|pdns} --managed-record-types A --managed-record-types CNAME --managed-record-types SRV |
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.
are we sure all this providers support SRV?
- dnsName: _sip._udp.example.com | ||
recordTTL: 180 | ||
recordType: SRV | ||
targets: |
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.
Would it be possible to share smoke tests as well, could you please also provide a way to test this manually with manifests and kubectl commands? Similar to this example #5111 (comment)
for cloudflare is enough, I'll do for aws or google?
I'm unsure where or not multiple targets supported, never tried that case.
Content: cfc.ResourceRecord.Content, | ||
} | ||
|
||
if cfc.ResourceRecord.Type == "SRV" { |
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.
this seems identical to cloudflare.CreateDNSRecordParams. Shell we create a shared method?
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.
} | ||
|
||
// parseSRVContent parses the SRV record content string into the structured data required by the Cloudflare API | ||
func parseSRVContent(content string) (map[string]interface{}, error) { |
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.
|
||
target := parts[3] | ||
|
||
return map[string]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.
Could we have a struct instead?
if endpoint.RecordType == "SRV" { | ||
srvData, err := parseSRVContent(target) | ||
if err != nil { | ||
log.Errorf("Error parsing SRV content: %v", err) |
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.
for i, record := range records { | ||
targets[i] = record.Content | ||
if record.Type == "SRV" { | ||
if dataMap, ok := record.Data.(map[string]interface{}); ok { |
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.
targets[i] = record.Content | ||
if record.Type == "SRV" { | ||
if dataMap, ok := record.Data.(map[string]interface{}); ok { | ||
priority, _ := dataMap["priority"].(float64) |
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.
same apply, could we have a concrete struct, so we do not need to cast?
PR needs rebase. 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-sigs/prow repository. |
@starcraft66 Do you think you can address review comments ? |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
@starcraft66 Any plans to continue work on this? |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. 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-sigs/prow repository. |
/reopen |
@starcraft66: Reopened this PR. 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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
Implements SRV record creation when using the cloudflare provider. Cloudflare's API requires sending SRV record data in structured fields rather than a bare string with the record.
I'm not a Go developer and just did the bare minimum to get this working and tested, I've confirmed this works on my personal cluster. Feel free to suggest improvements.
Fixes #4751
Checklist