9330107fcc
Implements Option A: move Vault (3x GCE e2-small) and Gitea (Legion k8s) onto a new GKE Autopilot cluster (neuron-platform, us-central1) managed through Legion Argo CD. Terraform (servers/gcp/): - gke.tf: GKE Autopilot cluster, Workload Identity bindings for Vault (KMS) and Gitea (Cloud SQL) - cloud-sql.tf: gitea database + user on neuron-prod-pg15, gitea GCP SA, gitea-database-url and gitea-db-password Secret Manager secrets - vault-nodes.tf: PENDING DECOMMISSION comment with migration checklist k8s manifests (servers/gcp/k8s/): - vault/: namespace.yaml - gitea/: namespace, serviceaccount (Workload Identity annotation), pvc (50Gi standard-rwo), deployment (Gitea + Cloud SQL Auth Proxy sidecar), service, configmap (custom CSS carried from Legion), external-secrets (GCP SM provider) - argocd-apps/: vault-gke.yaml, vault-helm-gke.yaml (Helm chart, HA Raft 3 replicas, GCP KMS auto-unseal, topologySpread across zones, 10Gi premium-rwo), gitea-gke.yaml — all target GKE_CLUSTER_ENDPOINT placeholder Legion (servers/legion/): - apps/gke-apps.yaml: App-of-Apps entry point on Legion Argo CD that syncs the GKE Application manifests - k8s/gitea-runner/Dockerfile: add system-level git insteadOf so GKE CI runners resolve Gitea in-cluster without Cloudflare Access headers
156 lines
4.5 KiB
YAML
156 lines
4.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: gitea
|
|
namespace: gitea
|
|
labels:
|
|
app: gitea
|
|
spec:
|
|
replicas: 1
|
|
# Recreate — only one pod can hold the RWO PVC at a time.
|
|
# Scale to multiple replicas only after adding shared storage (e.g. Filestore).
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app: gitea
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: gitea
|
|
spec:
|
|
serviceAccountName: gitea
|
|
|
|
containers:
|
|
- name: gitea
|
|
image: gitea/gitea:1.25.5
|
|
ports:
|
|
- name: http
|
|
containerPort: 3000
|
|
- name: ssh
|
|
containerPort: 22
|
|
env:
|
|
# Database — connect through the Cloud SQL Auth Proxy unix socket
|
|
- name: GITEA__database__DB_TYPE
|
|
value: postgres
|
|
# Unix socket path used by the Cloud SQL Auth Proxy sidecar
|
|
- name: GITEA__database__HOST
|
|
value: /cloudsql/neuron-785695:us-central1:neuron-prod-pg15
|
|
- name: GITEA__database__NAME
|
|
value: gitea
|
|
- name: GITEA__database__USER
|
|
value: gitea
|
|
- name: GITEA__database__PASSWD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: gitea-db
|
|
key: password
|
|
# Server
|
|
- name: GITEA__server__DOMAIN
|
|
value: git.neuralplatform.ai
|
|
- name: GITEA__server__ROOT_URL
|
|
value: https://git.neuralplatform.ai
|
|
- name: GITEA__server__SSH_DOMAIN
|
|
value: git.neuralplatform.ai
|
|
- name: GITEA__server__SSH_PORT
|
|
value: "22"
|
|
- name: GITEA__server__START_SSH_SERVER
|
|
value: "false"
|
|
# Service
|
|
- name: GITEA__service__DISABLE_REGISTRATION
|
|
value: "true"
|
|
- name: GITEA__service__REQUIRE_SIGNIN_VIEW
|
|
value: "false"
|
|
# Security
|
|
- name: GITEA__security__INSTALL_LOCK
|
|
value: "true"
|
|
# Packages
|
|
- name: GITEA__packages__ENABLED
|
|
value: "true"
|
|
# Webhooks — allow calls back into the cluster and GKE VPC
|
|
- name: GITEA__webhook__ALLOWED_HOST_LIST
|
|
value: 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
|
|
# Actions
|
|
- name: GITEA__actions__DEFAULT_ACTIONS_URL
|
|
value: https://code.forgejo.org
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /data
|
|
- name: cloudsql-socket
|
|
mountPath: /cloudsql
|
|
- name: custom-css
|
|
mountPath: /data/gitea/custom/public/assets/css/custom.css
|
|
subPath: custom.css
|
|
- name: custom-css
|
|
mountPath: /data/gitea/custom/templates/custom/header.tmpl
|
|
subPath: header.tmpl
|
|
resources:
|
|
requests:
|
|
memory: 256Mi
|
|
cpu: 100m
|
|
limits:
|
|
memory: 512Mi
|
|
cpu: 500m
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 3000
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
failureThreshold: 3
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 3000
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 15
|
|
failureThreshold: 3
|
|
|
|
# Cloud SQL Auth Proxy sidecar — provides unix socket at /cloudsql/
|
|
# Authenticates to Cloud SQL using Workload Identity (no key file).
|
|
- name: cloud-sql-proxy
|
|
image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2
|
|
args:
|
|
- "--structured-logs"
|
|
- "--unix-socket=/cloudsql"
|
|
- "neuron-785695:us-central1:neuron-prod-pg15"
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
volumeMounts:
|
|
- name: cloudsql-socket
|
|
mountPath: /cloudsql
|
|
resources:
|
|
requests:
|
|
memory: 32Mi
|
|
cpu: 10m
|
|
limits:
|
|
memory: 128Mi
|
|
cpu: 100m
|
|
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: gitea-data
|
|
- name: cloudsql-socket
|
|
emptyDir: {}
|
|
- name: custom-css
|
|
configMap:
|
|
name: gitea-custom-css
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: gitea
|
|
namespace: gitea
|
|
spec:
|
|
selector:
|
|
app: gitea
|
|
ports:
|
|
- name: http
|
|
port: 3000
|
|
targetPort: 3000
|
|
- name: ssh
|
|
port: 22
|
|
targetPort: 22
|
|
type: ClusterIP
|