Skip to content

Git designed for AI agents.

1.8 KB
Raw Blame
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: ${SA_NAME}
  namespace: ${KUBE_NAMESPACE}
  annotations:
    # Workload Identity binding. The GCP service account named here must
    # have roles/storage.objectAdmin on gs://${BENCHMARK_RESULTS_BUCKET}
    # and must have the Kubernetes ServiceAccount above bound to it via
    # roles/iam.workloadIdentityUser. See README for one-time setup.
    iam.gke.io/gcp-service-account: ${WORKLOAD_IDENTITY_GSA}
---
# Access for the benchmark Job to inspect the Gitaly pod it targets:
#   - get/list pods: locate the Gitaly pod by label selector and resolve
#                    each pod IP for HTTP pprof scraping
#   - pods/log:      pull Gitaly logs into the run artifacts
#   - endpoints:     resolve which pods back the benchmarked Service, so log
#                    harvesting excludes co-deployed Gitalys with the same labels
# Profiling is done over HTTP against each pod's /debug/pprof endpoint, so
# pods/exec is intentionally NOT granted - the Job never execs into the
# Gitaly container. Scoped to the namespace the Job runs in (which is also
# the Gitaly namespace; the wrapper co-locates them to avoid cross-
# namespace RBAC).
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: gitaly-benchmark-gitaly-access
  namespace: ${KUBE_NAMESPACE}
rules:
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "list"]
  - apiGroups: [""]
    resources: ["pods/log"]
    verbs: ["get"]
  - apiGroups: [""]
    resources: ["endpoints"]
    verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: gitaly-benchmark-gitaly-access
  namespace: ${KUBE_NAMESPACE}
subjects:
  - kind: ServiceAccount
    name: ${SA_NAME}
    namespace: ${KUBE_NAMESPACE}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: gitaly-benchmark-gitaly-access