0130d538f5
## Why The `ghp` app is deployed but its pods are stuck 0/1 Ready (and were ImagePullBackOff), for three separate reasons this PR fixes: - **ImagePullBackOff:** kubelet anonymous pulls fail on the artifactapi ghcr pull-through because ghcr.io's per-scope token auth is not proxied. The direct public image pulls anonymously, so switch to it. - **Pods never Ready:** ghp serves its metrics endpoint over **HTTPS** (TLS is configured globally), but the liveness/readiness probes used the default HTTP scheme, so the kubelet probe got an HTTPS-server error and the pods never went Ready. - **Scrape failure:** the VMServiceScrape hits that same HTTPS endpoint and needs a matching scheme/TLS config, or VM scraping of ghp fails. - The `GHP_ADMINS` value was still a placeholder. ## How - `deployment.yaml`: image -> `ghcr.io/goodtune/ghp:0.20.0`; liveness + readiness probe `scheme: HTTP` -> `HTTPS` (kubelet does not verify the probe cert). - `migrate-job.yaml`: image -> `ghcr.io/goodtune/ghp:0.20.0` (shared image). - `vmservicescrape.yaml`: endpoint `scheme: https` + `tlsConfig.insecureSkipVerify: true` (internal-CA cert; pod-IP target not in SANs). - `configmap.yaml`: `GHP_ADMINS` -> `neoloc`. Validated: `kustomize build apps/overlays/au-syd1/ghp` renders clean, kubeconform + pre-commit pass. Not applied. ## Follow-up (not fixed here) The artifactapi ghcr pull-through does not proxy ghcr.io's per-scope token auth for anonymous kubelet pulls — worth closing that gap so estate images can go back through artifactapi. Reviewed-on: #359 Co-authored-by: unkin-agent <unkin-agent@unkin.net> Co-committed-by: unkin-agent <unkin-agent@unkin.net>
146 lines
4.3 KiB
YAML
146 lines
4.3 KiB
YAML
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: ghp
|
|
namespace: ghp
|
|
annotations:
|
|
# Wave 2: serve only after the wave-1 migrate Job completes.
|
|
argocd.argoproj.io/sync-wave: "2"
|
|
configmap.reloader.stakater.com/auto: "true"
|
|
secret.reloader.stakater.com/reload: "ghp-github-app,ghp-app,ghp-tls,postgres-app"
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: ghp
|
|
strategy:
|
|
rollingUpdate:
|
|
maxUnavailable: 1
|
|
type: RollingUpdate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: ghp
|
|
spec:
|
|
serviceAccountName: default
|
|
automountServiceAccountToken: true
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 65532
|
|
runAsGroup: 65532
|
|
fsGroup: 65532
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
containers:
|
|
- name: ghp
|
|
image: ghcr.io/goodtune/ghp:0.20.0
|
|
imagePullPolicy: IfNotPresent
|
|
# Drop the image's default --migrate so replicas never race migrations;
|
|
# schema is applied by the wave-1 migrate hook Job instead.
|
|
command: ["/ghp", "serve"]
|
|
ports:
|
|
- containerPort: 8443
|
|
name: https
|
|
protocol: TCP
|
|
- containerPort: 8080
|
|
name: http
|
|
protocol: TCP
|
|
- containerPort: 9136
|
|
name: metrics
|
|
protocol: TCP
|
|
envFrom:
|
|
- configMapRef:
|
|
name: ghp-env
|
|
optional: false
|
|
env:
|
|
# DSN assembled from the CNPG-generated postgres-app Secret; $(VAR)
|
|
# expansion resolves the two env entries defined above it.
|
|
- name: GHP_DB_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-app
|
|
key: username
|
|
- name: GHP_DB_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-app
|
|
key: password
|
|
- name: GHP_DATABASE_DSN
|
|
value: "postgres://$(GHP_DB_USER):$(GHP_DB_PASSWORD)@postgres-rw.ghp.svc:5432/ghp?sslmode=require"
|
|
- name: GHP_GITHUB_APP_ID
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ghp-github-app
|
|
key: app_id
|
|
- name: GHP_GITHUB_CLIENT_ID
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ghp-github-app
|
|
key: client_id
|
|
- name: GHP_GITHUB_CLIENT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ghp-github-app
|
|
key: client_secret
|
|
- name: GHP_ENCRYPTION_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: ghp-app
|
|
key: encryption_key
|
|
volumeMounts:
|
|
- name: github-app
|
|
mountPath: /etc/ghp/github-app
|
|
readOnly: true
|
|
- name: tls
|
|
mountPath: /etc/ghp/tls
|
|
readOnly: true
|
|
- name: tmp
|
|
mountPath: /tmp
|
|
livenessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /metrics
|
|
port: metrics
|
|
scheme: HTTPS
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 30
|
|
successThreshold: 1
|
|
timeoutSeconds: 5
|
|
readinessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /metrics
|
|
port: metrics
|
|
scheme: HTTPS
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 5
|
|
successThreshold: 1
|
|
timeoutSeconds: 5
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
resources:
|
|
limits:
|
|
cpu: "2"
|
|
memory: 2Gi
|
|
requests:
|
|
cpu: "1"
|
|
memory: 512Mi
|
|
volumes:
|
|
- name: github-app
|
|
secret:
|
|
secretName: ghp-github-app
|
|
- name: tls
|
|
secret:
|
|
secretName: ghp-tls
|
|
# Writable scratch: root FS is read-only. Disk-backed (not memory medium)
|
|
# so codeload tarball staging doesn't count against the pod memory limit.
|
|
- name: tmp
|
|
emptyDir:
|
|
sizeLimit: 2Gi
|
|
restartPolicy: Always
|