Route gitea-proxy directly to GKE LB IP, drop CF Access
CF Access was blocking /api/actions/* even with the correct service-token headers — the gRPC Actions ping endpoint returns 403 through Cloudflare. Direct connection to the GKE Network LB IP (34.31.145.131) bypasses CF entirely. Verified /api/actions/ping returns 200 from the LB IP directly.
This commit is contained in:
@@ -1,47 +1,39 @@
|
|||||||
---
|
---
|
||||||
# gitea-proxy — nginx CF Access header-injecting proxy
|
# gitea-proxy — plain nginx proxy to GKE Gitea LB IP
|
||||||
#
|
#
|
||||||
# act_runner cannot add custom HTTP headers, so it can't send the
|
# Routes directly to the GKE Network LB IP, bypassing Cloudflare entirely.
|
||||||
# CF-Access-Client-Id / CF-Access-Client-Secret headers that Cloudflare
|
# No CF Access service-token auth needed. The runners can't add custom HTTP
|
||||||
# Access requires for service-to-service access to git.neuralplatform.ai.
|
# headers, so going through Cloudflare Access is not viable for the gRPC
|
||||||
|
# Actions ping endpoint (/api/actions/*).
|
||||||
#
|
#
|
||||||
# This proxy sits in the ci namespace. Runners use:
|
# Runners use:
|
||||||
# GITEA_INSTANCE_URL: http://gitea-proxy.ci.svc.cluster.local:3000
|
# GITEA_INSTANCE_URL: http://gitea-proxy.ci.svc.cluster.local:3000
|
||||||
#
|
#
|
||||||
# nginx:alpine processes *.conf.template files in /etc/nginx/templates/ via
|
# The GKE Gitea LB IP (34.31.145.131) is the external IP of the
|
||||||
# envsubst at startup — so CF Access credentials come from the Secret as env
|
# gitea Service in the gitea namespace on the GKE cluster.
|
||||||
# vars and get interpolated into the nginx config before nginx starts.
|
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
name: gitea-proxy-config
|
name: gitea-proxy-config
|
||||||
namespace: ci
|
namespace: ci
|
||||||
data:
|
data:
|
||||||
# Placed at /etc/nginx/templates/default.conf.template — nginx:alpine
|
default.conf: |
|
||||||
# runs envsubst on this and writes the result to /etc/nginx/conf.d/default.conf
|
|
||||||
default.conf.template: |
|
|
||||||
server {
|
server {
|
||||||
listen 3000;
|
listen 3000;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass https://git.neuralplatform.ai;
|
# Direct to GKE Gitea LB IP — bypasses Cloudflare/CF Access entirely.
|
||||||
|
proxy_pass http://34.31.145.131;
|
||||||
|
|
||||||
# Inject CF Access service-token headers so Cloudflare lets
|
# Tell Gitea which hostname it's being served as so self-referencing
|
||||||
# the request through without interactive auth.
|
# URLs (clone URLs, webhook URLs) are generated correctly.
|
||||||
proxy_set_header CF-Access-Client-Id "${CF_ACCESS_CLIENT_ID}";
|
|
||||||
proxy_set_header CF-Access-Client-Secret "${CF_ACCESS_CLIENT_SECRET}";
|
|
||||||
|
|
||||||
# Send SNI so Cloudflare routes the TLS connection correctly.
|
|
||||||
proxy_ssl_server_name on;
|
|
||||||
|
|
||||||
# Preserve Host so Gitea/CF edge routes correctly.
|
|
||||||
proxy_set_header Host git.neuralplatform.ai;
|
proxy_set_header Host git.neuralplatform.ai;
|
||||||
|
|
||||||
# Forward all original request headers (auth tokens, etc).
|
# Forward all original request headers (auth tokens, etc).
|
||||||
proxy_pass_request_headers on;
|
proxy_pass_request_headers on;
|
||||||
|
|
||||||
# Rewrite Location headers in redirects back to the proxy URL.
|
# Rewrite Location headers in redirects back to the proxy URL.
|
||||||
proxy_redirect https://git.neuralplatform.ai/
|
proxy_redirect http://34.31.145.131/
|
||||||
http://gitea-proxy.ci.svc.cluster.local:3000/;
|
http://gitea-proxy.ci.svc.cluster.local:3000/;
|
||||||
|
|
||||||
# Standard proxy headers.
|
# Standard proxy headers.
|
||||||
@@ -54,32 +46,6 @@ data:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
# ExternalSecret — CF Access service token for the proxy
|
|
||||||
apiVersion: external-secrets.io/v1beta1
|
|
||||||
kind: ExternalSecret
|
|
||||||
metadata:
|
|
||||||
name: gitea-proxy-secret
|
|
||||||
namespace: ci
|
|
||||||
annotations:
|
|
||||||
force-sync: "2026-05-05-sni-fix"
|
|
||||||
spec:
|
|
||||||
refreshInterval: 1h
|
|
||||||
secretStoreRef:
|
|
||||||
name: vault
|
|
||||||
kind: ClusterSecretStore
|
|
||||||
target:
|
|
||||||
name: gitea-proxy-secret
|
|
||||||
creationPolicy: Owner
|
|
||||||
data:
|
|
||||||
- secretKey: CF_ACCESS_CLIENT_ID
|
|
||||||
remoteRef:
|
|
||||||
key: secret/data/gitea-runner-cf-access
|
|
||||||
property: client_id
|
|
||||||
- secretKey: CF_ACCESS_CLIENT_SECRET
|
|
||||||
remoteRef:
|
|
||||||
key: secret/data/gitea-runner-cf-access
|
|
||||||
property: client_secret
|
|
||||||
---
|
|
||||||
# Deployment
|
# Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -98,7 +64,7 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: gitea-proxy
|
app: gitea-proxy
|
||||||
annotations:
|
annotations:
|
||||||
config-version: "2026-05-05-sni-fix"
|
config-version: "2026-05-05-direct-lb"
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: nginx
|
- name: nginx
|
||||||
@@ -106,11 +72,8 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config-template
|
- name: config
|
||||||
mountPath: /etc/nginx/templates
|
mountPath: /etc/nginx/conf.d
|
||||||
envFrom:
|
|
||||||
- secretRef:
|
|
||||||
name: gitea-proxy-secret
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 50m
|
cpu: 50m
|
||||||
@@ -119,7 +82,7 @@ spec:
|
|||||||
cpu: 200m
|
cpu: 200m
|
||||||
memory: 64Mi
|
memory: 64Mi
|
||||||
volumes:
|
volumes:
|
||||||
- name: config-template
|
- name: config
|
||||||
configMap:
|
configMap:
|
||||||
name: gitea-proxy-config
|
name: gitea-proxy-config
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user