{"record":{"id":"e74db21c6c2b3d38","repo":"apache/pulsar","slug":"kubernetes-job-name-size-should-be-less-than-s","errorCode":null,"errorMessage":"Kubernetes job name size should be less than %s","messagePattern":"Kubernetes job name size should be less than (.+?)","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntime.java","lineNumber":1172,"sourceCode":"        return convertedJobName + \"-\" + shortHash;\n    }\n    @VisibleForTesting\n    String getServiceUrl(String jobName, String jobNamespace, int instanceId) {\n        String suffix = isNotBlank(kubernetesServiceDomainSuffix) ? kubernetesServiceDomainSuffix : \"svc.cluster.local\";\n        return String.format(\"%s-%d.%s.%s.%s\", jobName, instanceId, jobName, jobNamespace, suffix);\n    }\n    public static void doChecks(FunctionDetails functionDetails, String overridenJobName) {\n        final String jobName = createJobName(functionDetails, overridenJobName);\n        if (!jobName.equals(jobName.toLowerCase())) {\n            throw new RuntimeException(\"Kubernetes does not allow upper case jobNames.\");\n        }\n        final Matcher matcher = VALID_POD_NAME_REGEX.matcher(jobName);\n        if (!matcher.matches()) {\n            throw new RuntimeException(\"Kubernetes only admits lower case and numbers. \"\n                    + \"(jobName=\" + jobName + \")\");\n        }\n        if (jobName.length() > maxJobNameSize) {\n            throw new RuntimeException(\"Kubernetes job name size should be less than \" + maxJobNameSize);\n        }\n    }\n}\n","sourceCodeStart":1154,"sourceCodeEnd":1176,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntime.java#L1154-L1176","documentation":"KubernetesRuntime.getJobName-like validation checks the generated job/pod name against Kubernetes naming rules and a configured maximum size. Kubernetes only admits DNS-1123 labels (lowercase letters, numbers, hyphens) for object names, and names are capped in length. Pulsar throws a RuntimeException instead of submitting a job Kubernetes would reject.","triggerScenarios":"Deploying a function/connector/source/sink to Kubernetes whose derived job name (function name, tenant, namespace, plus random suffix) fails to match VALID_POD_NAME_REGEX or exceeds maxJobNameSize (checked in doAdmissionChecks/validation path at KubernetesRuntime.java:1172).","commonSituations":"Function or tenant names containing uppercase letters, underscores, dots, or other invalid characters; very long tenant/namespace/function names pushing the composed job name past the size limit (default 55); renaming conventions applied by CI that introduce invalid characters.","solutions":["Rename the function (and tenant/namespace components) to contain only lowercase alphanumerics and '-', e.g. 'my-func-1'.","Shorten the tenant/namespace/function names so the composed job name is under maxJobNameSize (check runtime customizer or factory config).","If the name is fixed, set a shorter tenant/namespace prefix or use a custom KubernetesManifestCustomizer to control naming.","Catch the RuntimeException in the submission path and surface a clear 'invalid function name' error to the user before submitting."],"exampleFix":"// before\nfunctions: myFunction_WithCaps\n// after\nfunctions: myfunction-with-caps","handlingStrategy":"validation","validationCode":"Pattern DNS = Pattern.compile(\"[a-z0-9]([-a-z0-9]*[a-z0-9])?\");\nString jobName = (tenant + \"-\" + namespace + \"-\" + functionName + \"-\" + suffix).toLowerCase();\nif (!DNS.matcher(jobName).matches()) throw new IllegalArgumentException(\"invalid chars: \" + jobName);\nif (jobName.length() > 55) throw new IllegalArgumentException(\"job name too long: \" + jobName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict tenant/namespace/function names to lowercase alphanumerics and hyphens at creation time","Keep name segments short; remember the random suffix is appended to the job name","Document the maxJobNameSize (default ~55) in your naming conventions"],"tags":["kubernetes","validation","naming","pulsar-functions"],"backgroundTag":"invalid-kubernetes-resource-name","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}