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(oci): records with multiple IP addresses #4993

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 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.

@jrosinsk jrosinsk force-pushed the oci-provider-handle-multiple-ip-4940 branch from ac11c50 to d854cef Compare January 23, 2025 18:02
Copy link
Contributor

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

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

Just a single change request, rest lgm

provider/oci/oci.go Show resolved Hide resolved
@mloiseleur
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 28, 2025
@mloiseleur
Copy link
Contributor

/retitle fix(oci): records with multiple IP addresses

@k8s-ci-robot k8s-ci-robot changed the title Fix:If multiple targets are part of an OCI provider record operation, create a new record for each target. fix(oci): records with multiple IP addresses Jan 28, 2025
@jrosinsk jrosinsk force-pushed the oci-provider-handle-multiple-ip-4940 branch from d854cef to 71db397 Compare January 28, 2025 19:47
provider/oci/oci.go Show resolved Hide resolved
provider/oci/oci.go Show resolved Hide resolved
@jrosinsk jrosinsk force-pushed the oci-provider-handle-multiple-ip-4940 branch 2 times, most recently from 2206609 to 6797848 Compare January 29, 2025 01:50
Copy link
Contributor

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

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

/lgtm

cc: @mloiseleur

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 29, 2025
@jrosinsk jrosinsk force-pushed the oci-provider-handle-multiple-ip-4940 branch from 6797848 to 97a9054 Compare February 2, 2025 22:53
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2025
@jrosinsk
Copy link
Contributor Author

jrosinsk commented Feb 2, 2025

New changes are detected. LGTM label has been removed.

Added a couple more tests.

Copy link
Contributor

@jlamillan jlamillan left a comment

Choose a reason for hiding this comment

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

Looks good to me!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 4, 2025
@jrosinsk
Copy link
Contributor Author

jrosinsk commented Feb 4, 2025

/assign @Raffo

@mloiseleur
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ivankatliarchuk, jlamillan, mloiseleur

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2025
@k8s-ci-robot k8s-ci-robot merged commit b9d033b into kubernetes-sigs:master Feb 5, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. ok-to-test Indicates a non-member PR verified by an org member that 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
6 participants