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

Support commas in tag annotation. #983

Merged
merged 3 commits into from
Jan 24, 2022
Merged

Support commas in tag annotation. #983

merged 3 commits into from
Jan 24, 2022

Conversation

lkysow
Copy link
Member

@lkysow lkysow commented Jan 20, 2022

Commas can be set by escaping with backslash. Fixes #719

Example:

annotation: "this,supports,commas\,now"

Becomes:

["this", "supports", "commas,now"]

How I've tested this PR:

  • unit tests

How I expect reviewers to test this PR:

  • code

Checklist:

  • Tests added
  • CHANGELOG entry added

    HashiCorp engineers only, community PRs should not add a changelog entry.
    Entries should use present tense (e.g. Add support for...)

@lkysow lkysow requested review from a team, ndhanushkodi and t-eckert and removed request for a team January 20, 2022 21:26
Copy link
Contributor

@t-eckert t-eckert left a comment

Choose a reason for hiding this comment

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

Very clean! I like it!

Copy link
Contributor

@ndhanushkodi ndhanushkodi 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!!

control-plane/catalog/to-consul/resource.go Outdated Show resolved Hide resolved
lkysow and others added 3 commits January 24, 2022 09:03
Commas can be set by escaping with backslash.
Example:
	annotation: "this,supports,commas\,now"
Becomes:
	["this", "supports", "commas,now"]
Co-authored-by: Nitya Dhanushkodi <nitya@hashicorp.com>
@lkysow lkysow force-pushed the lkysow/tag-commas branch from 7924fd5 to 45eb49a Compare January 24, 2022 17:04
@lkysow lkysow merged commit eb263d9 into main Jan 24, 2022
@lkysow lkysow deleted the lkysow/tag-commas branch January 24, 2022 17:04
geobeau pushed a commit to geobeau/consul-k8s that referenced this pull request May 20, 2022
* Update test/unit/server-acl-init-job.bats
Co-authored-by: Luke Kysow <1034429+lkysow@users.noreply.github.com>
@erdanzhang
Copy link
Contributor

@lkysow Thanks for fixing!!
However, when I tried to add service tags into my k8s services like

template:
    metadata:
      annotations:
        consul.hashicorp.com/service-tags: mid\,dle,com\,ma

When I use curl to get the service tags, http://127.0.0.1:8500/v1/catalog/services

{
    "test-svc": [
        "dle",
        "com\\",
        "ma",
        "mid\\"
    ],
}

You can see the tag is incorrectly parsed. I suspect it may be related to the double slash \, wondering if that is a known bug/issue, can I resolve it by upgrading the version or is there some clever workaround?

Thanks for the helping, this is current the blocker for our team to onboard using Consul :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Service tags containing a comma
4 participants