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

TXT registry: metadata format #4624

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

mcharriere
Copy link
Contributor

@mcharriere mcharriere commented Jul 19, 2024

Description

This PR is the continuation of the work done in #3774

It includes a new option to select between 2 different modes:

  • transition: Old and new formats are created.
  • only-metadata: only metadata format is created.

I mostly resolved conflicts with master. Docs are still missing, but I think that all of the comments in the previous PR have been addressed. Including the integration with the AWS Alias behavior change.

Ref https://app.slack.com/client/T09NY5SBT/C771MKDKQ

Fixes #3757

Checklist

  • Unit tests updated
  • End user documentation updated

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 19, 2024
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 19, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @mcharriere. 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 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. labels Jul 19, 2024
@danielloader
Copy link

Would be good to keep this going, having duplicated TXT records following both formats is creating a lot of visual pollution in the zone.

@mcharriere mcharriere force-pushed the txt-registry-format-metadata branch from 350852a to 151cfe7 Compare September 3, 2024 09:12
@mcharriere mcharriere marked this pull request as ready for review September 3, 2024 09:12
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 3, 2024
@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 Sep 7, 2024
@mloiseleur
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 14, 2024
@szuecs
Copy link
Contributor

szuecs commented Sep 19, 2024

The reference to slack does not work for me in the browser. Can you post a link to the discussion for weblicents?

registry/txt.go Outdated

const (
TXTFormatTransition TXTFormat = "transition"
TXTFormatOnlyMetadata TXTFormat = "only-metadata"
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like an enum and we should use this:

type TXTFormat int

const (
	TXTFormatTransition TXTFormat = iota + 1
	TXTFormatOnlyMetadata
)

func (t TXTFormat) String() string {
	switch t {
	case TXTFormatTransition:
		return "transition"
	case TXTFormatOnlyMetadata:
                return "only-metadata"
	}
        return "unknown"
}

Copy link
Contributor Author

@mcharriere mcharriere Oct 9, 2024

Choose a reason for hiding this comment

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

I decided to simplify and stick to strings, in alignment with the code style of the project (as in here)

Validation of these values is done as per user input, as calling external-dns with an invalid input fails with:

build/external-dns --txt-format invalid-format
FATA[0000] flag parsing error: enum value must be one of transition,only-metadata, got 'invalid-format'

registry/txt.go Outdated
txtNew.ProviderSpecific = r.ProviderSpecific
endpoints = append(endpoints, txtNew)

// "new" (version 2) TXT record format (containing record type)
Copy link
Contributor

Choose a reason for hiding this comment

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

better to have a reference to a doc where "new" (version 2) is defined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAICT there are no docs referencing this format in the master branch, but all I can find is this doc that was removed some time ago.
The new term was introduced during the proposal and it's probably not the best way to describe it, as this PR adds yet another new format.
I could link that file or we could name the format differently. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say write a section in a doc about it and reference that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a reference.

registry/txt.go Outdated
switch name {
case TXTFormatTransition.String():
return TXTFormatTransition
default:
Copy link
Contributor

Choose a reason for hiding this comment

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

so if we do things wrong we hide errors by choosing TXTFormatOnlyMetadata, IMO wrong choice.
Be explicit and have an UknownFormat for example in the enum that is the 0-value.

registry/txt.go Outdated
}
}

// Metadata TXT record format
Copy link
Contributor

Choose a reason for hiding this comment

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

which version ? old/new?
The comment I can get from the variable name txtMetadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As old and new age badly, the name metadata for this format was introduced (see the PR and issues referenced above). This is the format that is supposed to replace the other 2 at some point in time, meaning that the old and new should be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then I would just drop the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opted for keeping the comment, the purpose is mostly to demarcate the 3 different code blocks (each TXTFormat). To make it consistent I added a reference to the docs that describes the Metadata TXTFormat.

@mcharriere mcharriere force-pushed the txt-registry-format-metadata branch from 4b8a6a1 to cf0c3a6 Compare October 9, 2024 20:39
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 9, 2024
@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 ask for approval from mloiseleur. For more information see the Kubernetes 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

@mcharriere mcharriere force-pushed the txt-registry-format-metadata branch from c25a544 to 952739b Compare November 24, 2024 08:08
@mcharriere
Copy link
Contributor Author

I just rebased to master to keep up to date.

@mloiseleur @szuecs when you have some time, could you please take a look into this PR? thank you!

docs/registry/txt.md Outdated Show resolved Hide resolved
docs/registry/txt.md Outdated Show resolved Hide resolved
Co-authored-by: Michel Loiseleur <[email protected]>
@mloiseleur
Copy link
Contributor

/lgtm
/assign @Raffo

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 25, 2024
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. 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.

Multiple design failures in new-format TXT registry ownership records
6 participants