ripe-smartphone-56353
08/22/2024, 1:22 PM002_serviceaccount.yaml: |
apiVersion: v1
kind: ServiceAccount
metadata:
name: extra
namespace: '{{ namespace }}'
annotations:
iam.gke.io/gcp-service-account: '{{ project }}-{{ domain }}@gcp-project.iam.gserviceaccount.com'
But if I'm trying to use some go template functions (and I might be using them wrong since my go knowledge is not great) it doesn't seem to work
002_serviceaccount.yaml: |
apiVersion: v1
kind: ServiceAccount
metadata:
name: extra
namespace: '{{ namespace }}'
annotations:
iam.gke.io/gcp-service-account: '{{printf "%q" "output"}}-{{ printf "%.9s" project }}-{{ domain }}@gcp-project.iam.gserviceaccount.com'
average-finland-92144
08/22/2024, 11:18 PMannotations:
iam.gke.io/gcp-service-account: '{{ project | trunc 9 }}-{{ domain }}@gcp-project.iam.gserviceaccount.com'
ripe-smartphone-56353
08/23/2024, 7:58 AM002_serviceaccount.yaml: |
apiVersion: v1
kind: ServiceAccount
metadata:
name: extra
namespace: '{{ namespace }}'
annotations:
iam.gke.io/gcp-service-account: '{{- .project | trunc 9 }}-{{ .project | trunc 9 }}-{{ $project | trunc 9 }}-{{- printf "%s-%s" .Release.Name $name | trunc 9 }}-{{ domain }}@prod.iam.gserviceaccount.com'
which results in
kubectl describe serviceaccounts extra -n flytesnacks-live
Name: extra
Namespace: flytesnacks-live
Labels: <none>
Annotations: iam.gke.io/gcp-service-account: {{- .project | trunc 9 }}-{{ .project | trunc 9 }}-{{ $project | trunc 9 }}-{{- printf "%s-%s" .Release.Name $name | trunc 9 }}-live@prod.iam.gserviceaccount.com
Image pull secrets: <none>
Mountable secrets: <none>
Tokens: <none>
Events: <none>