Browse Source

Correccioes en Gogs para hacerlo persistente

main
Celestino Rey 2 years ago
parent
commit
d6adeeba2b
8 changed files with 110 additions and 2 deletions
  1. +1
    -0
      Gogs/creaTodo.sh
  2. +1
    -0
      Gogs/entra.sh
  3. +69
    -0
      Gogs/gogs-deployment.yaml
  4. +11
    -0
      Gogs/gogs-statefulset.yaml
  5. +1
    -0
      Gogs/paraTodo.sh
  6. +11
    -0
      Gogs/pv-local-gogs.yaml
  7. +2
    -2
      Gogs/pv-local-mysql-gogs.yaml
  8. +14
    -0
      Gogs/pvc-gogs.yaml

+ 1
- 0
Gogs/creaTodo.sh View File

@ -1,4 +1,5 @@
kubectl create namespace gogs
kubectl create -f pv-local-mysql-gogs.yaml
kubectl create -f pv-local-gogs.yaml
kubectl create -k ./
watch kubectl get all -n gogs

+ 1
- 0
Gogs/entra.sh View File

@ -0,0 +1 @@
kubectl exec -ti deployment.apps/gogs -n gogs -- /bin/bash

+ 69
- 0
Gogs/gogs-deployment.yaml View File

@ -0,0 +1,69 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gogs-pv-claim
namespace: gogs
labels:
app: gogs-app
spec:
accessModes:
- ReadWriteOnce
storageClassName: ""
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gogs
namespace: gogs
labels:
app: gogs-app
spec:
selector:
matchLabels:
app: gogs-app
tier: frontend
strategy:
type: Recreate
template:
metadata:
labels:
app: gogs-app
tier: frontend
spec:
containers:
- image: gogs/gogs:latest
name: gogs
env:
- name: DB_TYPE
value: mysql
- name: DB_NAME
value: gogs
- name: DB_HOST
value: gogs-mysql
- name: DB_PASS
valueFrom:
secretKeyRef:
name: mysqlgogs-pass
key: password
- name: DB_USER
valueFrom:
secretKeyRef:
name: mysqlgogs-pass
key: db_user
ports:
- containerPort: 3000
name: http
protocol: TCP
- containerPort: 22
name: ssh
protocol: TCP
volumeMounts:
- name: gogs-persistent-storage
mountPath: /data
volumes:
- name: gogs-persistent-storage
persistentVolumeClaim:
claimName: gogs-pv-claim

+ 11
- 0
Gogs/gogs-statefulset.yaml View File

@ -28,6 +28,17 @@ spec:
- containerPort: 22
name: ssh
protocol: TCP
volumeMounts:
- name: gogs-pv
mountPath: /data
dnsPolicy: ClusterFirst
restartPolicy: Always
terminationGracePeriodSeconds: 30
volumeClaimTemplates:
- metadata:
name: gogs-pv
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi

+ 1
- 0
Gogs/paraTodo.sh View File

@ -1,3 +1,4 @@
kubectl delete -k ./
kubectl delete -f pv-local-mysql-gogs.yaml
kubectl delete -f pv-local-gogs.yaml
kubectl delete namespace gogs

+ 11
- 0
Gogs/pv-local-gogs.yaml View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: gogs-data
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/cluster/gogs/gogs_data"

+ 2
- 2
Gogs/pv-local-mysql-gogs.yaml View File

@ -1,11 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: gogs-data
name: gogs-db
spec:
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/cluster/gogs"
path: "/mnt/cluster/gogs/gogs_db"

+ 14
- 0
Gogs/pvc-gogs.yaml View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gogs-pv-claim
namespace: gogs
labels:
app: gogs-app
spec:
accessModes:
- ReadWriteOnce
storageClassName: ""
resources:
requests:
storage: 10Gi

Loading…
Cancel
Save