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?