Add Gitea deployment, services, secrets, and persistent volume claims

This commit is contained in:
2025-10-15 14:10:50 +05:30
parent a91d4ef702
commit f943ffd9d4
5 changed files with 217 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
---
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
name: gitea-db-secret
namespace: git-ops
spec:
encryptedData:
password: AgBrtSzejvnB3nj7ltYLEslwAZ7yMzQogiNWdHkrKhu2rwOhQRZ5aMiqWUwBgZ7pVQdPRfbZCtUNn83iogqTqEy4/zavqv9TMZnr+x6tIS05P5fmqbSkfmzP8fIy6Yb3Gqewjj+NhQOrMQ542AJiDIifxrgBXic8ndxwXIFfXDU661Fjk27gOL6faHckmHlh9OZeh3IS/vyaTae0m9StBUIQx9TdkuexB4GqePIy4/p0etM+sGK668vHwSwZYPBbnJK5lB19/r7D9FrTgoHZB0HaOBI08Oo7MsMp3ZgUKn1yEK7S9Dii3a695Hc2tITHSS7qiIrRbaKIo9txXO4vSqlg9/tnZU+5MyEEqAEk3Ll6szCuTbb+n0/sm9Mo2xSU4riXsqYXn0zENUab0OAWIQ4zTPU23bbsUlqWp5LHwPY8EFbYlEzT5adPyjKlqudscqo7C5fGZquZzIBiI+QBFeyRPG0F5w8aet3kf84jIaj4afKVieylKh50n+YdGjJQ/UIG0i8J7OuKYZ2D+sMCOQGy3tymOvwf1aAKM3GYCMZoYGgSxytWQEjzLOm1GFomb+xTeqqwoeeL0atUey92BkE9E/Wb4Q3jAddiI2sHBLgeGyoiGCP4uv9NHEQq9Ianz1fchR2uHbFpiyEG5EWJycug4FddDcb3UxKbrpc37eqhXKj9YlvrE7kcwryqSpAqrYfbi6XMLCrSlAYm
template:
metadata:
name: gitea-db-secret
namespace: git-ops
type: Opaque

View File

@@ -0,0 +1,46 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea-db
namespace: git-ops
spec:
strategy:
type: Recreate
selector:
matchLabels:
app: gitea-db
template:
metadata:
labels:
app: gitea-db
spec:
initContainers:
- name: init-cleanup
image: busybox
command: ["rm", "-rf", "/var/lib/postgresql/data/lost+found"]
volumeMounts:
- name: db
mountPath: /var/lib/postgresql/data
containers:
- name: gitea-db
image: postgres:15.14
ports:
- containerPort: 5432
env:
- name: POSTGRES_USER
value: "gitea"
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: gitea-db-secret
key: password
- name: POSTGRES_DB
value: "gitea"
volumeMounts:
- name: db
mountPath: /var/lib/postgresql/data
volumes:
- name: db
persistentVolumeClaim:
claimName: gitea-db-longhorn

View File

@@ -0,0 +1,29 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-app-longhorn
namespace: git-ops
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 2Gi
storageClassName: longhorn
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitea-db-longhorn
namespace: git-ops
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 5Gi
storageClassName: longhorn

View File

@@ -0,0 +1,56 @@
---
apiVersion: v1
kind: Service
metadata:
name: gitea-service
namespace: git-ops
spec:
type: LoadBalancer
selector:
app: gitea-app
ports:
- port: 3011
targetPort: 3000
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: gitea-ssh-service
namespace: git-ops
spec:
type: LoadBalancer
selector:
app: gitea-app
ports:
- port: 222
targetPort: 22
---
apiVersion: v1
kind: Service
metadata:
name: gitea-int-service
namespace: git-ops
spec:
selector:
app: gitea-app
ports:
- protocol: TCP
port: 3000
targetPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: gitea-db-service
namespace: git-ops
spec:
selector:
app: gitea-db
ports:
- protocol: TCP
port: 5432
targetPort: 5432

View File

@@ -0,0 +1,72 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitea-app
namespace: git-ops
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: gitea-app
template:
metadata:
labels:
app: gitea-app
spec:
initContainers:
- name: wait-for-db
image: busybox
command:
- sh
- -c
- |
until nc -z -v -w30 gitea-db-service 5432; do
echo "Waiting for psql database to be ready"
sleep 2
done
containers:
- name: gitea
image: gitea/gitea:1.24.6
ports:
- containerPort: 22
- containerPort: 3000
env:
- name: USER_UID
value: "1000"
- name: USER_GID
value: "1000"
- name: GITEA__database__DB_TYPE
value: "postgres"
- name: GITEA__database__HOST
value: "gitea-db-service:5432"
- name: GITEA__database__NAME
value: "gitea"
- name: GITEA__database__USER
value: "gitea"
- name: GITEA__database__PASSWD
valueFrom:
secretKeyRef:
name: gitea-db-secret
key: password
volumeMounts:
- name: gitea-data
mountPath: /data
- name: timezone
mountPath: /etc/timezone
- name: localtime
mountPath: /etc/localtime
volumes:
- name: timezone
hostPath:
path: /etc/timezone
type: File
- name: localtime
hostPath:
path: /etc/localtime
type: File
- name: gitea-data
persistentVolumeClaim:
claimName: gitea-app-longhorn