Skip to content

fix(load-balancer): trim spaces in comma separated annotations - #1411

Merged
lukasmetzner merged 2 commits into
hetznercloud:mainfrom
lbarrosby:fix/annotation-trim-list-items
Nov 5, 2026
Merged

lukasmetzner merged 2 commits into
hetznercloud:mainfrom
lbarrosby:fix/annotation-trim-list-items

Conversation

@lbarrosby

Copy link
Copy Markdown
Contributor

The list annotations (http-managed-certificate-domains, http-status-codes, http-certificates) are split on , without trimming. Writing them with a space after the comma, which is easy to do in YAML, gives:

  • example.com, www.example.com: managed certificate requested for " www.example.com"
  • 2??, 3??: health check status code " 3??"
  • 3, cert-2: certificate looked up by the name " cert-2"

and the Load Balancer reconcile fails with an API error that does not point at the space.

This trims the whitespace around each item in annotation.Strings and annotation.Certificates. Values without spaces are parsed as before.

Tests: added a "spaces around items" case to TestStrings and TestCertificates; both fail on main and pass with the change. go test ./internal/annotation/ ./internal/lbspec/ and golangci-lint are clean.

Comma separated annotations were split without trimming, so
"example.com, www.example.com" requested a managed certificate for
" www.example.com", "2??, 3??" sent " 3??" as health check status code
and "3, cert-2" looked up a certificate named " cert-2".

Trim the whitespace around each item of the list.
@lbarrosby
lbarrosby requested a review from a team as a code owner November 5, 2026 04:17
@lukasmetzner

Copy link
Copy Markdown
Member

Hey @lbarrosby, thank you for the contribution. I made a little refactor use our sliceutil package. The e2e are expected to fail here, due to permissions. I will run them for you and if everything is looking good, I will merge it.

@lukasmetzner
lukasmetzner merged commit 2f59dd9 into hetznercloud:main Nov 5, 2026
4 of 9 checks passed
@lbarrosby

Copy link
Copy Markdown
Contributor Author

Late note for the record, per the org contributing guide: this was written with the help of Claude Code, and I reviewed and tested it before opening.

lukasmetzner pushed a commit that referenced this pull request Nov 6, 2026
### Bug Fixes

- **load-balancer**: name env vars in missing location error (#1405)
([9697df9](9697df9))
- **load-balancer**: trim spaces in comma separated annotations (#1411)
([2f59dd9](2f59dd9))

This branch had an error being deployed

1 failed deployment
e2e-robot — 3a0cd142 Deployed Nov 5, 2026 by lukasmetzner via e2e robot #1777
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.

2 participants