feat(gitlab): Add basic Gitlab configuration

Contains basic deployment and networking requirement, awaiting custom configuration and proper volume management.
This commit is contained in:
Tanguy Herbron 2022-10-17 00:35:03 +02:00
parent a96b9b14ab
commit 5f870e9ca0
7 changed files with 148 additions and 0 deletions

12
gitlab/backup-pvc.yaml Normal file
View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gitlab-backup-pvc
namespace: gitlab
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: flat-storage-class

38
gitlab/configmap.yaml Normal file
View File

@ -0,0 +1,38 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: gitlab-config
namespace: gitlab
data:
gitlab.rb: |
external_url 'https://git.beta.halia.dev'
gitlab_rails['gitlab_default_theme'] = 2
registry_external_url 'https://git.beta.halia.dev'
puma['worker_processes'] = 0
sidekiq['max_concurrency'] = 5
nginx['listen_port'] = 80
nginx['listen_https'] = false
gitlab_kas['enable'] = true
registry_nginx['enable'] = true
registry_nginx['proxy_set_headers'] = {
"X-Forwarded-Proto" => "https",
"X-Forwarded-Ssl" => "on"
}
registry_nginx['listen_port'] = 5050
registry_nginx['listen_https'] = false
prometheus_monitoring['enable'] = false
gitaly['env'] = {
'GITALY_COMMAND_SPAWN_MAX_PARALLEL' => '2'
}
gitaly['ruby_max_rss'] = 200_000_000
gitaly['concurrency'] = [
{
'rpc' => "/gitaly.SmartHTTPService/PostReceivePack",
'max_per_repo' => 3
}, {
'rpc' => "/gitaly.SSHService/SSHUploadPack",
'max_per_repo' => 3
}
]

25
gitlab/cronjob.yaml Normal file
View File

@ -0,0 +1,25 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: backup-job
namespace: gitlab
spec:
schedule: "0 4 * * *" # Every day at 4AM
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- name: maria-backup
image: mariadb
command: ["sh", "-c", "echo hi"]
volumeMounts:
- name: gitlab-backup
mountPath: /backup/gitlab
subPath: gitlab
volumes:
- name: gitlab-backup
persistentVolumeClaim:
claimName: gitlab-backup-pvc
restartPolicy: OnFailure

33
gitlab/deployment.yaml Normal file
View File

@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitlab
namespace: gitlab
spec:
replicas: 1
selector:
matchLabels:
app: gitlab
template:
metadata:
labels:
app: gitlab
spec:
hostname: gitlab
subdomain: gitlab
containers:
- name: gitlab
image: gitlab/gitlab-ce:15.4.2-ce.0
ports:
- containerPort: 80
volumeMounts:
- mountPath: "/etc/gitlab/gitlab.rb"
name: gitlab-config-volume
subPath: gitlab.rb
volumes:
- name: gitlab-pv
hostPath:
path: "/mnt/gitlab"
- name: gitlab-config-volume
configMap:
name: gitlab-config

23
gitlab/ingress.yaml Normal file
View File

@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: gitlab-ingress
namespace: gitlab
annotations:
kubernetes.io/ingress.class: "traefik"
spec:
tls:
- secretName: git-beta-tls
hosts:
- git.beta.halia.dev
rules:
- host: git.beta.halia.dev
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: gitlab-svc
port:
number: 80

4
gitlab/namespace.yaml Normal file
View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: gitlab

13
gitlab/service.yaml Normal file
View File

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: gitlab-svc
namespace: gitlab
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: gitlab