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 updates of unchanged records for Azure Private DNS #1377

Merged
merged 2 commits into from
Feb 12, 2020

Conversation

jasper-d
Copy link
Contributor

Due to the missing / the record type of existing records had / as a prefix (i.e. /A). Condition in

external-dns/plan/plan.go

Lines 236 to 238 in f400ded

switch record.RecordType {
case endpoint.RecordTypeA, endpoint.RecordTypeCNAME:
filtered = append(filtered, record)
was therefore never true.

Fixes #1373

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 16, 2020
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 16, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @jasper-d!

It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 16, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jan 16, 2020
@jasper-d
Copy link
Contributor Author

I signed it

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 16, 2020
@jasper-d
Copy link
Contributor Author

/assign @hjacobs

@saidst
Copy link
Contributor

saidst commented Jan 17, 2020

Hi Jasper,
thanks for your investigations. I also see this behaviour with the latest version.

I verify with a late 2019-version of the master-branch.

Regards

@saidst
Copy link
Contributor

saidst commented Jan 17, 2020

I think we have this behaviour since bf4b176

maybee because of bf4b176#diff-d47c04ae82fc597ab54c2b7998616f1fL109-L110:

-			recordType = strings.TrimLeft(*recordSet.Type, "Microsoft.Network/privateDnsZones")
+			recordType = strings.TrimPrefix(*recordSet.Type, "Microsoft.Network/privateDnsZones")

@jasper-d
Copy link
Contributor Author

@saidst Looks like it. I wasn't sure why it worked before, had to look up what TrimLeft actually does :/

@saidst
Copy link
Contributor

saidst commented Jan 17, 2020

I will also investigate.
We need to figure whether we can apply your fix or whether to revert to TrimLeft.

@jasper-d
Copy link
Contributor Author

@saidst Do you think that the Azure API could return something other than "Microsoft.Network/privateDnsZones/<record-type>" as the type property? The API docs aren't really specific, they just define type as "The type of the record set." but I would be suprised if it was anything else.

I think the only other information that could be used to determine the record type is the actual property used for the targets (i.e. properties.aRecords, properties.txtRecords etc.).

@saidst
Copy link
Contributor

saidst commented Jan 20, 2020

I'll debug the concerned piece of code hopefully this afternoon.
After that, I should be able to answer your question.

In any case, I want to complete a fix this week. No matter of which type it is.

@saidst
Copy link
Contributor

saidst commented Jan 20, 2020

Your changes look good. Thanks!

No, Azure's API is OK.

The reason is that TrimLeft cannot simply be substituted by TrimPrefix.
For this case, TrimPrefix would have been more appropriate. But TrimLeft worked with the original pattern too.

@linki: This PR shows room for improvement in the unit-tests of this provider but also that late large-scale "code improvements" without practical checks are risky (bf4b176).

@jasper-d
Copy link
Contributor Author

The reason is that TrimLeft cannot simply be substituted by TrimPrefix.
For this case, TrimPrefix would have been more appropriate. But TrimLeft worked with the original pattern too.

Agree:

I wasn't sure why it worked before, had to look up what TrimLeft actually does :/

Just my 2 cents: How about adding some debug level logging to plan.go? Currently it is kinda a black box. It most certainly works as expected but we don't know the inputs (from logs) and therefore can't tell why it actually behaves the way it does.

@saidst
Copy link
Contributor

saidst commented Feb 11, 2020

@njuettner, thanks for releasing 0.6.0!

This one is really important. Is it feasible to bundle this in a 0.6.1?

Copy link
Member

@njuettner njuettner left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jasper-d, njuettner

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 12, 2020
@k8s-ci-robot k8s-ci-robot merged commit b8d018f into kubernetes-sigs:master Feb 12, 2020
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. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure Private DNS unchanged records updated
5 participants