ghp: use the estate templated default Vault convention
Drop the bespoke ghp SA/role/policy (terraform-vault#120 closed). The default
k8s auth role, bound to SA default in every namespace, already has a templated
read grant on kv/kubernetes/namespace/<ns>/default/*, so ghp needs zero
terraform-vault change.
- Remove the custom ServiceAccount; run as the namespace default SA.
- Deployment + migrate Job: serviceAccountName default.
- VaultAuth: role/serviceAccount default (mirrors artifactapi).
- VaultStaticSecrets: source paths move to the templated location
kubernetes/namespace/ghp/default/{github-app,app}; Secret names unchanged.
This commit is contained in:
@@ -23,7 +23,7 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: ghp
|
app: ghp
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: ghp
|
serviceAccountName: default
|
||||||
automountServiceAccountToken: true
|
automountServiceAccountToken: true
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsNonRoot: true
|
runAsNonRoot: true
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ kind: Kustomization
|
|||||||
|
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- serviceaccount.yaml
|
|
||||||
- configmap.yaml
|
- configmap.yaml
|
||||||
- cnpg_cluster.yaml
|
- cnpg_cluster.yaml
|
||||||
- cnpg_backup.yaml
|
- cnpg_backup.yaml
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: ghp-migrate
|
app: ghp-migrate
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: ghp
|
serviceAccountName: default
|
||||||
automountServiceAccountToken: true
|
automountServiceAccountToken: true
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
securityContext:
|
securityContext:
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
# Bound to the Vault K8s auth role "ghp" (added in terraform-vault); VSO uses the
|
|
||||||
# VaultAuth below to exchange this SA's token for a Vault token and sync kv.
|
|
||||||
apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: ghp
|
|
||||||
namespace: ghp
|
|
||||||
@@ -12,8 +12,8 @@ spec:
|
|||||||
kubernetes:
|
kubernetes:
|
||||||
audiences:
|
audiences:
|
||||||
- vault
|
- vault
|
||||||
role: ghp
|
role: default
|
||||||
serviceAccount: ghp
|
serviceAccount: default
|
||||||
tokenExpirationSeconds: 600
|
tokenExpirationSeconds: 600
|
||||||
method: kubernetes
|
method: kubernetes
|
||||||
mount: k8s/au/syd1
|
mount: k8s/au/syd1
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
# GitHub App credentials (app_id, client_id, client_secret, private_key).
|
# GitHub App credentials (app_id, client_id, client_secret, private_key). Ben
|
||||||
# Ben populates kv/kubernetes/ghp/github-app via the runbook; VSO syncs it here.
|
# populates kv/kubernetes/namespace/ghp/default/github-app via the runbook; the
|
||||||
|
# default k8s role's templated policy already grants read here, so no
|
||||||
|
# terraform-vault change is needed. VSO syncs it into the ghp-github-app Secret.
|
||||||
apiVersion: secrets.hashicorp.com/v1beta1
|
apiVersion: secrets.hashicorp.com/v1beta1
|
||||||
kind: VaultStaticSecret
|
kind: VaultStaticSecret
|
||||||
metadata:
|
metadata:
|
||||||
@@ -15,12 +17,13 @@ spec:
|
|||||||
overwrite: true
|
overwrite: true
|
||||||
hmacSecretData: true
|
hmacSecretData: true
|
||||||
mount: kv
|
mount: kv
|
||||||
path: kubernetes/ghp/github-app
|
path: kubernetes/namespace/ghp/default/github-app
|
||||||
refreshAfter: 5m
|
refreshAfter: 5m
|
||||||
type: kv-v2
|
type: kv-v2
|
||||||
vaultAuthRef: default
|
vaultAuthRef: default
|
||||||
---
|
---
|
||||||
# Application encryption key (encryption_key) from kv/kubernetes/ghp/app.
|
# Application encryption key (encryption_key) from
|
||||||
|
# kv/kubernetes/namespace/ghp/default/app.
|
||||||
apiVersion: secrets.hashicorp.com/v1beta1
|
apiVersion: secrets.hashicorp.com/v1beta1
|
||||||
kind: VaultStaticSecret
|
kind: VaultStaticSecret
|
||||||
metadata:
|
metadata:
|
||||||
@@ -35,7 +38,7 @@ spec:
|
|||||||
overwrite: true
|
overwrite: true
|
||||||
hmacSecretData: true
|
hmacSecretData: true
|
||||||
mount: kv
|
mount: kv
|
||||||
path: kubernetes/ghp/app
|
path: kubernetes/namespace/ghp/default/app
|
||||||
refreshAfter: 5m
|
refreshAfter: 5m
|
||||||
type: kv-v2
|
type: kv-v2
|
||||||
vaultAuthRef: default
|
vaultAuthRef: default
|
||||||
|
|||||||
Reference in New Issue
Block a user