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

Fix:If multiple targets are part of an OCI provider record operation, create a new record for each target. #4993

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrosinsk
Copy link
Contributor

@jrosinsk jrosinsk commented Jan 6, 2025

Description

The OCI provider currently does not support creating DNS records with multiple IP addresses. Below is example output from the current master branch code showing the failure.

Error returned by Dns Service. Http Status Code: 400. Error Code: InvalidParameter. Opc request id: xxxxxxx. Message: Error returned by PatchForwardedZoneRecords operation in Dns service.(400, InvalidParameter, false) Record (my-local-nginx-lhr.jrosinsk.developers.oracledx.com, A) contained invalid rdata (10.244.0.138 10.244.0.15)

This fix handles the case where multiple IP's are part of the operation request by breaking them apart into individual newRecordOperations and adjusts the endpoints so the records can be rectified accordingly.

Also adds a warning message, since OCI DNS does not support the set-identifier field in the actual DNS Record.

Below is the output and result of the same request that failed above on current master, but produces the expected results from this branch.

INFO[0005] { Domain=my-local-nginx-lhr.jrosinsk.developers.oracledx.com RecordHash=<nil> IsProtected=<nil> Rdata=10.244.0.138 RrsetVersion=<nil> Rtype=A Ttl=60 Operation=ADD } 
INFO[0005] { Domain=my-local-nginx-lhr.jrosinsk.developers.oracledx.com RecordHash=<nil> IsProtected=<nil> Rdata=10.244.0.15 RrsetVersion=<nil> Rtype=A Ttl=60 Operation=ADD } 
INFO[0005] { Domain=_sauron-jmr-lhr_my-local-nginx-lhr.jrosinsk.developers.oracledx.com RecordHash=<nil> IsProtected=<nil> Rdata="heritage=external-dns,external-dns/owner=sauron-jmr-lhr,external-dns/resource=service/default/my-local-nginx-lhr-svc" RrsetVersion=<nil> Rtype=TXT Ttl=300 Operation=ADD } 
INFO[0005] { Domain=_sauron-jmr-lhr_a-my-local-nginx-lhr.jrosinsk.developers.oracledx.com RecordHash=<nil> IsProtected=<nil> Rdata="heritage=external-dns,external-dns/owner=sauron-jmr-lhr,external-dns/resource=service/default/my-local-nginx-lhr-svc" RrsetVersion=<nil> Rtype=TXT Ttl=300 Operation=ADD } 
INFO[0009] All records are already up to date  

And here are the expected DNS results.

oci dns record domain get --zone-name-or-id jrosinsk.developers.oracledx.com --domain my-local-nginx-lhr.jrosinsk.developers.oracledx.com | yq '.data.items[] | .domain, .rdata , .rtype, .ttl'
"my-local-nginx-lhr.jrosinsk.developers.oracledx.com"
"10.244.0.15"
"A"
60
"my-local-nginx-lhr.jrosinsk.developers.oracledx.com"
"10.244.0.138"
"A"
60

Updated the test framework and added tests to verify multiple records. Improved test code coverage from 67.2% -> 78.2%.
Also tested this change extensively in an OCI development cluster environment.

Fixes #4940

Checklist

  • Unit tests updated
  • End user documentation updated

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 6, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @jrosinsk. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign raffo for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 6, 2025
@mloiseleur
Copy link
Contributor

mloiseleur commented Jan 7, 2025

Hello @jrosinsk,

Thanks for this PR. Maybe you have noticed that we have started the process to move the providers out of tree (#4347).

Do you think you/Oracle can host its own webhook providers ?

When there is already a provider, the conversion to webhook one is (relatively) easy.

That's what has been done for infoblox, see #4513 and #4516

@jrosinsk
Copy link
Contributor Author

jrosinsk commented Jan 7, 2025

Hi @mloiseleur, this change will definitely impact a wide range of users who are dependent on the in-tree OCI provider.
Unfortunately, I can't agree to this work at this point. I would need to talk it over internally and plan for it
separately outside of this PR.

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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OCI provider does not handle multiple A/AAAA records correctly
3 participants