'Is there a way to access k8 pod metadata(specifically pod name) in helm template file

Basically i am doing a poc where i need to get the k8 pod name and trim the prefix part (to be specific ) the release name of the deployment . For example , my deployment name is alpha and app name is beta so the pod name comes to be something like

"alpha-beta-23jgoi-23ngo" .

Now i want to trim the podname inside my helm yaml file to something like "beta-23jgoi-23ngo".Note that i want to store this value as part of some other variable in values.yaml , not modify the pod name itself

Can anyone suggest something . So far i have been able to get the pod name using fieldref (metadata.name) , in helm yaml file but not able to pass it to some tpl file to trim. Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source