Kubeclient::HttpError: HTTP status code 422, Namespace "project-with-autodevops-2417b721e00913fd-b18526a4fed9649a-446282...

It looks like a long project name might be a problem when trying to create a K8s namespace: Kubeclient::HttpError: HTTP status code 422, Namespace "project-with-autodevops-2417b721e00913fd-b18526a4fed9649a-4462826-dast-default" is invalid: metadata.name: Invalid value: "project-with-autodevops-2417b721e00913fd-b18526a4fed9649a-4462826-dast-default": must be no more than 63 characters for POST https://34.68.29.49/api/v1/namespaces

https://sentry.gitlab.net/gitlab/staginggitlabcom/issues/1153548/

RestClient::UnprocessableEntity: 422 Unprocessable Entity
  restclient/abstract_response.rb:223:in `exception_with_response'
    raise klass.new(self, code)
  restclient/abstract_response.rb:103:in `return!'
    raise exception_with_response
  restclient/request.rb:809:in `process_result'
    response.return!(&block)
  restclient/request.rb:725:in `block in transmit'
    process_result res, & block
  net/http.rb:920:in `start'
    return yield(self)
...
(81 additional frame(s) were not displayed)

Kubeclient::HttpError: HTTP status code 422, Namespace "project-with-autodevops-2417b721e00913fd-b18526a4fed9649a-4462826-dast-default" is invalid: metadata.name: Invalid value: "project-with-autodevops-2417b721e00913fd-b18526a4fed9649a-4462826-dast-default": must be no more than 63 characters for POST https://34.68.29.49/api/v1/namespaces
  kubeclient/common.rb:130:in `rescue in handle_exception'
    raise error_klass.new(e.http_code, err_message, e.response)
  kubeclient/common.rb:120:in `handle_exception'
    def handle_exception
  kubeclient/common.rb:385:in `create_entity'
    response = handle_exception do
  kubeclient/common.rb:236:in `block (2 levels) in define_entity_methods'
    create_entity(entity.entity_type, entity.resource_name, entity_config)
  gitlab/kubernetes/kube_client.rb:35:in `create_namespace'
    delegate :get_pods,
...
(71 additional frame(s) were not displayed)

Kubeclient::HttpError: Namespace "project-with-autodevops-2417b721e00913fd-b18526a4fed9649a-4462826-dast-default" is invalid: metadata.name: Invalid value: "project-with-autodevops-2417b721e00913fd-b18526a4fed9649a-4462826-dast-default": must be no more than 63 characters
Edited by Rémy Coutable