A way to indicate the node operating system and architecture in name of the pod?

Hello k8s community! I’m trying to implement a custom name for my pods spun up by my deployment and daemonset controller to take the form of

app-name-<os-name>-<arch-name>-UID

e.g.

foobar-linux-amd64-xaqw2112

where the os-name = the node operating system and the arch-name = worker node arch (amd64/arm64/mips)

The requirement is to determine the names dynamically, depending on which worker node, the scheduler could potentially schedule the pod. Our environment could be hybrid cluster with a mix of amd64/arm64 and a mix of linux/windows nodes.

Using the client-go API, I could parse the output of kubectl version and get the control plane OS and the arch details and the same way use the detailed output of kubectl get nodes to parse the OS and the arch of the worker nodes. But I will not know the decision of the scheduler to understand which node will be used to spin up the pod and name it accordingly.

Is there a YAML trick I can use to solve this?

For Deployment & Stateful set, there is no way to figure out the node to be selected by the scheduler before hand. Also another major issue I’m seeing here is the container image for different arch. You will be anywaysn needing 2 deployments/statefulsets inorder to run those containers specific to arch and using node selector this can be achieved. But a single deployment across different arch node isn’t gonna work.