apiVersion: apps/v1 kind: Deployment metadata: name: forgejo namespace: forgejo spec: strategy: type: Recreate replicas: 1 selector: matchLabels: app: forgejo template: metadata: labels: app: forgejo spec: nodeSelector: kubernetes.io/hostname: siriussec containers: - name: forgejo image: codeberg.org/forgejo/forgejo:16 imagePullPolicy: IfNotPresent ports: - containerPort: 3000 name: http env: - name: FORGEJO__database__DB_TYPE value: postgres - name: FORGEJO__database__HOST value: pg-rw:5432 - name: FORGEJO__database__NAME value: forgejo - name: FORGEJO__database__USER valueFrom: secretKeyRef: name: forgejo-pg-app key: username - name: FORGEJO__database__PASSWD valueFrom: secretKeyRef: name: forgejo-pg-app key: password - name: FORGEJO__server__ROOT_URL value: https://forgejo.siriusdevops.com/ - name: FORGEJO__server__DOMAIN value: forgejo.siriusdevops.com - name: FORGEJO__server__SSH_DOMAIN value: forgejo.siriusdevops.com - name: FORGEJO__server__SSH_PORT value: "222" - name: FORGEJO__server__PROTOCOL value: http - name: FORGEJO__security__INSTALL_LOCK value: "true" - name: FORGEJO__packages__ENABLED value: "true" # Bot signup lockdown: admin-only account creation (web + API). - name: FORGEJO__service__DISABLE_REGISTRATION value: "true" # Registry hardening (audit F11): Forgejo hands an anonymous # ("ghost user") token to /v2/token and grants Read on every # package, regardless of the owning repo's visibility, so all app # images were world-downloadable. With REQUIRE_SIGNIN_VIEW the # token endpoint answers UNAUTHORIZED to anonymous clients and # containerd pulls need a dockerconfigjson secret per namespace # (`forgejo-pull`, created out of band — docs/registry-pull-auth.md). # Side effect: the Forgejo web UI/API is login-only for anonymous # visitors, including the public repos. - name: FORGEJO__service__REQUIRE_SIGNIN_VIEW value: "true" volumeMounts: - name: data mountPath: /data # Custom site-root assets (robots.txt). GITEA_CUSTOM=/data/gitea, # so Forgejo serves /data/gitea/public/robots.txt at /robots.txt. - name: custom-public mountPath: /data/gitea/public readOnly: true readinessProbe: httpGet: path: / port: 3000 initialDelaySeconds: 20 periodSeconds: 10 resources: requests: cpu: 100m memory: 256Mi limits: memory: 2Gi volumes: - name: data persistentVolumeClaim: claimName: forgejo-data - name: custom-public configMap: name: forgejo-custom-public