in appconfigmgrv2/api/webhooks/builtins/pod_webhook.go [614:629]
func (a *podAnnotator) handleServiceAccount(ctx context.Context, pod *corev1.Pod, appcfg *appconfig.AppEnvConfigTemplateV2) error {
// Find the service spec that matches the pod.
app := pod.GetLabels()["app"]
for _, s := range appcfg.Spec.Services {
if app != s.DeploymentApp {
continue
}
if s.ServiceAccount == "" {
return nil
}
pod.Spec.ServiceAccountName = s.ServiceAccount
}
return nil
}