Skip to content

Resource creation can fail if the application name is over 63 characters #2509

@jacobsalway

Description

@jacobsalway

What happened?

  • ✋ I have searched the open/closed issues and my issue is not listed.

When an application has a name that is over 63 characters, labels on resources that are derived from the app name (e.g. pods, services) exceed the maximum length allowed by Kubernetes as according to RFC 1123. This causes resource creation to fail.

Reproduction Code

Create an application with a name over 63 characters e.g. this-is-the-name-of-an-app-that-is-exactly-sixty-four-characters.

Expected behavior

The creation of the resource should either be denied by a validating admission webhook, or the application name should be truncated before it is used in any labels.

Actual behavior

Example of a creation error:

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://10.96.0.1:443/api/v1/namespaces/default/pods. Message: Pod "this-is-the-name-of-an-app-that-is-exactly-sixt │
│ y-four-characters-driver" is invalid: metadata.labels: Invalid value: "this-is-the-name-of-an-app-that-is-exactly-sixty-four-characters": must be no more than 63 characters. Received status: Status(apiVersion=v │
│ 1, code=422, details=StatusDetails(causes=[StatusCause(field=metadata.labels, message=Invalid value: "this-is-the-name-of-an-app-that-is-exactly-sixty-four-characters": must be no more than 63 characters, reaso │
│ n=FieldValueInvalid, additionalProperties={})], group=null, kind=Pod, name=this-is-the-name-of-an-app-that-is-exactly-sixty-four-characters-driver, retryAfterSeconds=null, uid=null, additionalProperties={}), ki │
│ nd=Status, message=Pod "this-is-the-name-of-an-app-that-is-exactly-sixty-four-characters-driver" is invalid: metadata.labels: Invalid value: "this-is-the-name-of-an-app-that-is-exactly-sixty-four-characters": m │
│ ust be no more than 63 characters, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties= │
│ {})

Environment & Versions

  • Kubernetes Version: 1.32
  • Spark Operator Version: master
  • Apache Spark Version: 3.5.5

Additional context

No response

Impacted by this bug?

Give it a 👍 We prioritize the issues with most 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions