Fix Kubernetes resource name and label length limits for long pipelin…#27059
Fix Kubernetes resource name and label length limits for long pipelin…#27059Esvanth wants to merge 1 commit intoopen-metadata:mainfrom
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| labels.put(LABEL_COMPONENT, LABEL_VALUE_INGESTION); | ||
| labels.put(LABEL_MANAGED_BY, LABEL_VALUE_OPENMETADATA); | ||
| labels.put(LABEL_PIPELINE, sanitizeName(pipeline.getName())); | ||
| labels.put(LABEL_PIPELINE, buildKubernetesName("", pipeline.getName())); |
There was a problem hiding this comment.
🚨 Bug: Label selector mismatch: query uses raw sanitizeName but labels use buildKubernetesName
The buildLabels() method (line 1998) now uses buildKubernetesName("", pipeline.getName()) for the LABEL_PIPELINE value, which truncates long names to 63 chars. However, several methods that query by label selector still use sanitizeName() directly (which no longer truncates):
killIngestion(line 796):LABEL_PIPELINE + "=" + pipelineNamegetQueuedPipelineStatusInternal(line 898):LABEL_PIPELINE + "=" + pipelineNamegetLastIngestionLogs(line 1083):labelSelectorMap.put(LABEL_PIPELINE, pipelineName)deleteJobsForPipeline(called from deletePipeline):LABEL_PIPELINE + "=" + pipelineName
For long pipeline names, the label value stored on the resource is truncated but the label selector used in queries is not, so queries will return zero results. This means: kill won't find running jobs, delete won't clean up jobs, queued status returns empty, and logs can't be retrieved.
Suggested fix:
Use buildKubernetesName("", pipeline.getName()) consistently
for label values and selectors, or extract a shared helper:
private String buildPipelineLabel(String name) {
return buildKubernetesName("", name);
}
Then use it in both buildLabels() and all query methods.
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
Code Review 🚫 Blocked 0 resolved / 1 findingsFixes Kubernetes resource name and label length limits for long pipeline names but introduces a critical label selector mismatch where queries use raw sanitizeName while labels use buildKubernetesName, causing selector failures. 🚨 Bug: Label selector mismatch: query uses raw sanitizeName but labels use buildKubernetesName📄 openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/k8s/K8sPipelineClient.java:796 📄 openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/k8s/K8sPipelineClient.java:898 📄 openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/k8s/K8sPipelineClient.java:1083 📄 openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/k8s/K8sPipelineClient.java:1998 The
For long pipeline names, the label value stored on the resource is truncated but the label selector used in queries is not, so queries will return zero results. This means: kill won't find running jobs, delete won't clean up jobs, queued status returns empty, and logs can't be retrieved. Suggested fix🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
Summary of what was accomplished: Added Unit Tests: Included new test cases in K8sPipelineClientTest.java that verify the truncation logic for pipeline names up to 95 characters. Successfully Pushed: Your changes are now live on your repository at https://github.com/Esvanth/OpenMetadata. Next Steps: #Please do assign the task to me and add an label to it actually safe to go. |
Refactored Naming Logic: Updated K8sPipelineClient.java to ensure all Kubernetes resource names and labels (Jobs, CronJobs, ConfigMaps, Secrets) strictly adhere to the 63-character limit, even with long pipeline names.
Added Unit Tests: Included new test cases in K8sPipelineClientTest.java that verify the truncation logic for pipeline names up to 95 characters.
Successfully Pushed: Your changes are now live on your repository at https://github.com/Esvanth/OpenMetadata.
Next Steps:
If you are the original author of PR 27012, your PR should now show these new commits.
If you are not the author, you can now open a new Pull Request or ask the original author to pull these fixes from your branch: Esvanth/OpenMetadata:fix-27004-pod-name-limit.