The Docker image is used in the initialization process, to copy everything in the custom folder to the Gitea data dir (mounted as a persistent volume). It is built using Packer and is based on the busybox image, so we can use its minimalist shell system to copy files and set permissions
95 lines
2.4 KiB
YAML
95 lines
2.4 KiB
YAML
apiVersion: extensions/v1beta1
|
|
kind: Deployment
|
|
metadata:
|
|
name: gitea-server
|
|
labels:
|
|
app: gitea
|
|
spec:
|
|
replicas: 1
|
|
template:
|
|
metadata:
|
|
labels:
|
|
name: gitea-server
|
|
app: gitea
|
|
spec:
|
|
initContainers:
|
|
- name: init-config
|
|
# This is a busybox image with our gitea customizations saved to
|
|
# /custom, built using ./script/build_customizations_image from the
|
|
# root of the repo
|
|
image: eu.gcr.io/fluted-magpie-218106/gitea_custom:0.1
|
|
command: [
|
|
'sh', '-c',
|
|
'mkdir -p /data/gitea/conf && mkdir -p /data/gitea/https && cp /root/conf/app.ini /data/gitea/conf/app.ini && chown 1000:1000 /data/gitea/conf/app.ini && chmod 660 /data/gitea/conf/app.ini && cp /root/conf/*.pem /data/gitea/https && chmod 600 /data/gitea/https/*.pem && cp -R /custom/* /data/gitea && chown -R 1000:1000 /data/gitea'
|
|
]
|
|
volumeMounts:
|
|
- mountPath: /data
|
|
name: gitea-server-data
|
|
- mountPath: /root/conf
|
|
name: config
|
|
containers:
|
|
- name: gitea-server
|
|
image: gitea/gitea:1.7.5
|
|
ports:
|
|
- containerPort: 3000
|
|
- containerPort: 3001
|
|
- containerPort: 22
|
|
volumeMounts:
|
|
- mountPath: /data
|
|
name: gitea-server-data
|
|
restartPolicy: Always
|
|
volumes:
|
|
- name: gitea-server-data
|
|
persistentVolumeClaim:
|
|
claimName: gitea-server-data
|
|
- name: config
|
|
secret:
|
|
secretName: gitea-config
|
|
items:
|
|
- key: app.ini
|
|
path: app.ini
|
|
mode: 256
|
|
- key: cert.pem
|
|
path: cert.pem
|
|
mode: 256
|
|
- key: key.pem
|
|
path: key.pem
|
|
mode: 256
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: gitea-server-data
|
|
labels:
|
|
app: gitea
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 20Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: gitea-server
|
|
labels:
|
|
name: gitea-server
|
|
app: gitea
|
|
spec:
|
|
type: LoadBalancer
|
|
# preserves the client source IP
|
|
externalTrafficPolicy: Local
|
|
ports:
|
|
- name: "ssh"
|
|
port: 22
|
|
targetPort: 22
|
|
- name: "http"
|
|
port: 80
|
|
targetPort: 3001
|
|
- name: "https"
|
|
port: 443
|
|
targetPort: 3000
|
|
selector:
|
|
name: gitea-server
|