Skip to content

image/label: print more characters of label keys#7618

Merged
dmcgowan merged 1 commit intocontainerd:mainfrom
changweige:enlarge-limit-key
Dec 23, 2022
Merged

image/label: print more characters of label keys#7618
dmcgowan merged 1 commit intocontainerd:mainfrom
changweige:enlarge-limit-key

Conversation

@changweige
Copy link
Copy Markdown
Member

@changweige changweige commented Nov 2, 2022

Like stargz and nydus remote snapshotter, some snapshots lables are introduced and passed to snapshotter from containerd automatically. The label keys' lengths are all longer than 10. Most of them are around 40-50 chars.

The limitation of 10 characters makes it harder to debug what label is not appropriate. So we'd better print more of the wrong label.

Signed-off-by: Changwei Ge [email protected]

Copy link
Copy Markdown
Member

@kzys kzys left a comment

Choose a reason for hiding this comment

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

Can you add some tests?

@changweige
Copy link
Copy Markdown
Member Author

Can you add some tests?

Sure. Will add some tests for it later in this PR of next version

@fuweid
Copy link
Copy Markdown
Member

fuweid commented Nov 11, 2022

@changweige would you just add unit case in this pr? the change is small. it is no need to seperate it.

@changweige
Copy link
Copy Markdown
Member Author

@changweige would you just add unit case in this pr? the change is small. it is no need to seperate it.

Yes. I am intending to add UT for it but was occupied these days. I will soon re-push the PR with a UT case

@changweige changweige force-pushed the enlarge-limit-key branch 2 times, most recently from c4a8025 to f9b3bfa Compare November 11, 2022 11:34
@changweige
Copy link
Copy Markdown
Member Author

@kzys @fuweid UT was added, please take another look.

Copy link
Copy Markdown
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

nit comment to explain the new const

Comment thread labels/validate.go
const (
maxSize = 4096
maxSize = 4096
keyMaxLen = 64
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggest comment line ... // maximum length of key portion of error message if len of key + len of value > maxSize

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for your suggestion. The comment has been added.

Like stargz and nydus remote snapshotter, some snapshots
lables are introduced and passed to snapshotter from containerd
automatically. The label keys' length are all longer than 10.

The limitation of 10 characters makes it harder to debug what label
is not appropriate. So we'd better to print more of the wrong label.

Signed-off-by: Changwei Ge <[email protected]>
@dmcgowan dmcgowan self-assigned this Nov 30, 2022
@dmcgowan dmcgowan merged commit 6c8c427 into containerd:main Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants