Initial commit

This commit is contained in:
sarodz
2026-02-14 10:46:57 -05:00
commit 4426274448
30 changed files with 1149 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
# Gitea deployment.
# Replace <YOUR_DOMAIN> with your domain (e.g. git.example.com).
# Replace <YOUR_DB_PASSWORD> with the same password used in postgresql.yaml.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-data
namespace: gitea
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: gitea-http
namespace: gitea
spec:
type: ClusterIP
ports:
- port: 3000
targetPort: 3000
selector:
app: gitea
---
apiVersion: v1
kind: Service
metadata:
name: gitea-ssh
namespace: gitea
spec:
type: ClusterIP
ports:
- port: 22
targetPort: 22
selector:
app: gitea
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea
namespace: gitea
spec:
replicas: 1
selector:
matchLabels:
app: gitea
template:
metadata:
labels:
app: gitea
spec:
initContainers:
- name: wait-for-db
image: busybox:1.36
command: ['sh', '-c', 'until nc -z postgresql 5432; do sleep 2; done']
containers:
- name: gitea
image: gitea/gitea:1.23
ports:
- containerPort: 3000
name: http
- containerPort: 22
name: ssh
env:
- name: GITEA__database__DB_TYPE
value: postgres
- name: GITEA__database__HOST
value: postgresql:5432
- name: GITEA__database__NAME
value: gitea
- name: GITEA__database__USER
value: gitea
- name: GITEA__database__PASSWD
value: <YOUR_DB_PASSWORD>
- name: GITEA__server__DOMAIN
value: <YOUR_DOMAIN>
- name: GITEA__server__ROOT_URL
value: https://<YOUR_DOMAIN>/
volumeMounts:
- name: data
mountPath: /data
resources:
requests:
memory: 256Mi
cpu: 100m
limits:
memory: 1Gi
cpu: 1000m
volumes:
- name: data
persistentVolumeClaim:
claimName: gitea-data

View File

@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: gitea
resources:
- secrets.yaml
- postgresql.yaml
- gitea.yaml

View File

@@ -0,0 +1,56 @@
apiVersion: v1
kind: Service
metadata:
name: postgresql
namespace: gitea
spec:
type: ClusterIP
ports:
- port: 5432
targetPort: 5432
selector:
app: postgresql
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgresql
namespace: gitea
spec:
serviceName: postgresql
replicas: 1
selector:
matchLabels:
app: postgresql
template:
metadata:
labels:
app: postgresql
spec:
containers:
- name: postgresql
image: postgres:17-alpine
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: postgresql-credentials
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
resources:
requests:
memory: 256Mi
cpu: 100m
limits:
memory: 512Mi
cpu: 500m
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: local-path
resources:
requests:
storage: 5Gi

View File

@@ -0,0 +1,14 @@
# PostgreSQL credentials.
# Replace <YOUR_DB_PASSWORD> with a strong password.
#
# Encrypt this file with: sops --encrypt --in-place secrets.yaml
apiVersion: v1
kind: Secret
metadata:
name: postgresql-credentials
namespace: gitea
type: Opaque
stringData:
POSTGRES_USER: gitea
POSTGRES_PASSWORD: <YOUR_DB_PASSWORD>
POSTGRES_DB: gitea