Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Force annotations to end strictly with alphanumeric characters #353

Merged
merged 1 commit into from Apr 28, 2020

Conversation

nolar
Copy link
Contributor

@nolar nolar commented Apr 28, 2020

What do these changes do?

Force annotation names to end strictly with alphanumeric characters, not only to fit into 63 chars.

"Learning Kubernetes the hard way."

Description

The annotation names are not only limited to 63 characters, and not only to a specific alphabet, but also to the beginning/ending characters. Otherwise, it fails to patch:

$ kubectl patch … --type=merge -p '{"metadata": {"annotations": {"kopf.zalando.org/long.handler.id.here-WumEzA--": "{}"}}}'

The … is invalid: metadata.annotations: Invalid value: "kopf.zalando.org/long.handler.id.here-WumEzA--": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')

Since base64 of a digest was used to make the shortened annotations names unique in #346, it can end with = characters, for example.

In this case, we do not need the actual base64'ed value, we just need a persistent and unique suffix. So, cutting those special non-alphanumeric characters is fine.

The change is backward compatible (despite the hashing function change since 0.27rc4): first, it was never released beyond RC; second, it was not working for non-alphanumeric annotations anyway. Proper alphanumeric annotations will remain the same as in 0.27rc4.

Issues/PRs

Issues: #331

Related: #346

Type of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • The code addresses only the mentioned problem, and this problem only
  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt

@nolar nolar added the bug Something isn't working label Apr 28, 2020
@zincr
Copy link

zincr bot commented Apr 28, 2020

🤖 zincr found 0 problems , 0 warnings

✅ Large Commits
✅ Approvals
✅ Specification
✅ Dependency Licensing

@zincr
Copy link

zincr bot commented Apr 28, 2020

🤖 zincr found 1 problem , 0 warnings

❌ Approvals
✅ Large Commits
✅ Specification
✅ Dependency Licensing

Details on how to resolve are provided below


Approvals

All proposed changes must be reviewed by project maintainers before they can be merged

Not enough people have approved this pull request - please ensure that 1 additional user, who have not contributed to this pull request approve the changes.

  • ✅ Approved by PR author @nolar
  • ❌ 1 additional approval needed
     

Copy link

@stehem stehem left a comment

Choose a reason for hiding this comment

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

👍

@nolar nolar merged commit e81c109 into zalando-incubator:master Apr 28, 2020
@nolar nolar deleted the annotations-charsets branch April 28, 2020 12:31
@nolar nolar added this to the 0.27 milestone May 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants