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

K8s Function Name Length Check Allows Invalid StatefulSet #10531

Merged
merged 1 commit into from
May 15, 2021

Conversation

cdbartholomew
Copy link
Contributor

Motivation

When using the Kubernetes runtime, there is a check that the function name to ensure that it will create valid Kubernetes objects. It is currently set to check for the length to be less than 55. If a function is submitted with this length, a StatefulSet is created that is unable to spawn pods. This is the error you will get:

Warning  FailedCreate  1s (x13 over 22s)  statefulset-controller  create Pod pf-1234-1234-123456789012345678901234567890123456789012-0 in StatefulSet pf-1234-1234-123456789012345678901234567890123456789012 failed error: Pod "pf-1234-1234-123456789012345678901234567890123456789012-0" is invalid: metadata.labels: Invalid value: "pf-1234-1234-123456789012345678901234567890123456789012-7476d599d9": must be no more than 63 characters

This is because one of the generated labels for the pod name will exceed the label length of 63 characters. I have reproduced in Kubernetes 1.16 and 1.18.

Reducing the function name by 2 characters avoids the problem.

Since the check is intended to prevent the user from making input changes that will not work in k8s, fixing this will make using functions in k8s less error-prone.

Modifications

Changed the maximum function name size from 55 to 53 characters. When using k8s runtime, function names exceeding 52 characters will be rejected.

Verifying this change

This change is already covered by existing tests, such as verifyCreateJobNameWithNameOverMaxCharLimit.

Does this pull request potentially affect one of the following parts:

No

Documentation

  • Does this pull request introduce a new feature? (no)

@zymap zymap added this to the 2.8.0 milestone May 11, 2021
@codelipenghui codelipenghui merged commit 74c0c31 into apache:master May 15, 2021
codelipenghui pushed a commit that referenced this pull request Jun 26, 2021
@codelipenghui codelipenghui added the cherry-picked/branch-2.7 Archived: 2.7 is end of life label Jun 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants