question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pod naming ignores dashes and underscores

See original GitHub issue

Apache Airflow version: 2.0.2

Kubernetes version (if you are using Kubernetes) (use kubectl version): Client Version: version.Info{Major:“1”, Minor:“19”, GitVersion:“v1.19.11”, GitCommit:“c6a2f08fc4378c5381dd948d9ad9d1080e3e6b33”, GitTreeState:“clean”, BuildDate:“2021-05-12T12:27:07Z”, GoVersion:“go1.15.12”, Compiler:“gc”, Platform:“darwin/amd64”} Server Version: version.Info{Major:“1”, Minor:“19+”, GitVersion:“v1.19.10-gke.1600”, GitCommit:“7b8e568a7fb4c9d199c2ba29a5f7d76f6b4341c2”, GitTreeState:“clean”, BuildDate:“2021-05-07T09:18:53Z”, GoVersion:“go1.15.10b5”, Compiler:“gc”, Platform:“linux/amd64”}

What happened: I am running Airflow within GKE, one pod, a git-sync container for dags, two containers (same image) for the webserver and scheduler. I utilize Kubernetes Executor and Kubernetes Pod Operators. When I run task I see pod with the name matching the pattern dag_idtask_id.hash. But this naming ignores dashes and underscores. Example, dag_id='inititializer_prefix', and task_id='job_prefix'. In kubectl get pods I see initializerprefixjobprefix.6d5191b91782409082d46dd3b0ea97f9

What you expected to happen:

I expect executor pod to have name like initializer_prefixjob_prefix.6d5191b91782409082d46dd3b0ea97f9 at least, or initializer_prefix_job_prefix.6d5191b91782409082d46dd3b0ea97f9 (autoseparation of dag_id and task_id by underscore)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ashbcommented, Jun 22, 2021

Pod names need to be valid DNS labels, and so can’t have underscores in them anyway https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names.

We could make it more legabile by having _ -> -, and then also separating as OP suggestes

1reaction
uranusjrcommented, Jun 22, 2021

The docstring seems to suggest the original author knew, but didn’t want to deal with edge cases in the rules, and just took the simplest route by removing everything.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Underscores in pods name converted to hyphen ... - GitHub
My pod names have underscores, for example soort_boek. Now, when I save anything in the pod's settings, it converts the underscore to a...
Read more >
What characters are allowed in kubernetes port and container ...
I had underscores in the names of ports and containers and got an error. Replacing the underscores with hyphens worked.
Read more >
Object Names and IDs | Kubernetes
Each object in your cluster has a Name that is unique for that type of resource. Every Kubernetes object also has a UID...
Read more >
Advanced Scheduling and Taints and Tolerations
Taints and tolerations allow the node to control which pods should (or should not) be ... and may contain letters, numbers, hyphens, dots,...
Read more >
dashes-versus_underscores; The Definitive Guide - X-Equals
The topic of spaces vs. dashes vs. underscores continues on with respect to how to use them (or not) when naming your files....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found