Skip to content

Fix invalid K8s label value error#232

Merged
jogrogan merged 1 commit into
mainfrom
jogrogan/fixK8sLabel
Jun 15, 2026
Merged

Fix invalid K8s label value error#232
jogrogan merged 1 commit into
mainfrom
jogrogan/fixK8sLabel

Conversation

@jogrogan

@jogrogan jogrogan commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Fixes the following error we ran into:

a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?'

Issue is that the label appender was truncating labels blindly over 64 characters with no regards to the new ending character.

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

Code Coverage

Overall Project 84.51% 🟢
Files changed 100% 🟢

File Coverage
DependencyLabels.java 95.51% 🟢

@jogrogan jogrogan merged commit f9dc295 into main Jun 15, 2026
1 check passed
@jogrogan jogrogan deleted the jogrogan/fixK8sLabel branch June 15, 2026 16:43

@ryannedolan ryannedolan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For follow up -- probably should move this to K8sUtils:

public static String canonicalizeName(String name) {

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.

3 participants