Removed root-volume
/var/lib/gitea is used in gitea-rootless image. We effectively only use the /data volumen mount and PVC. Removed the logic creating a root-volume, the yamls and the tests.
This commit is contained in:
parent
5e46d1f0a7
commit
cf70e2f07b
5 changed files with 8 additions and 51 deletions
|
@ -22,7 +22,6 @@
|
|||
(gitea/generate-deployment)
|
||||
(gitea/generate-service)
|
||||
(gitea/generate-service-ssh)
|
||||
(gitea/generate-root-volume config)
|
||||
(gitea/generate-data-volume config)
|
||||
(gitea/generate-appini-env config)
|
||||
(gitea/generate-secrets config)
|
||||
|
|
|
@ -44,16 +44,9 @@
|
|||
|
||||
(def vol? (s/keys :req-un [::volume-total-storage-size]))
|
||||
|
||||
(defn-spec root-storage-by-volume-size int?
|
||||
[volume-total-storage-size ::volume-total-storage-size]
|
||||
(cond
|
||||
(and (> volume-total-storage-size 5) (<= volume-total-storage-size 20)) 5
|
||||
(and (> volume-total-storage-size 20) (<= volume-total-storage-size 100)) 10
|
||||
(> volume-total-storage-size 100) 20))
|
||||
|
||||
(defn data-storage-by-volume-size
|
||||
[total root]
|
||||
(- total root))
|
||||
[total]
|
||||
total)
|
||||
|
||||
|
||||
#?(:cljs
|
||||
|
@ -66,7 +59,6 @@
|
|||
"gitea/secrets.yaml" (rc/inline "gitea/secrets.yaml")
|
||||
"gitea/service.yaml" (rc/inline "gitea/service.yaml")
|
||||
"gitea/service-ssh.yaml" (rc/inline "gitea/service-ssh.yaml")
|
||||
"gitea/rootvolume.yaml" (rc/inline "gitea/rootvolume.yaml")
|
||||
"gitea/datavolume.yaml" (rc/inline "gitea/datavolume.yaml")
|
||||
(throw (js/Error. "Undefined Resource!")))))
|
||||
|
||||
|
@ -125,19 +117,10 @@
|
|||
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer)
|
||||
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))
|
||||
|
||||
(defn-spec generate-root-volume pred/map-or-seq?
|
||||
[config vol?]
|
||||
(let [{:keys [volume-total-storage-size]} config
|
||||
root-storage-size (root-storage-by-volume-size volume-total-storage-size)]
|
||||
(->
|
||||
(yaml/load-as-edn "gitea/rootvolume.yaml")
|
||||
(cm/replace-all-matching-values-by-new-value "ROOTSTORAGESIZE" (str (str root-storage-size) "Gi")))))
|
||||
|
||||
(defn-spec generate-data-volume pred/map-or-seq?
|
||||
[config vol?]
|
||||
(let [{:keys [volume-total-storage-size]} config
|
||||
root-storage-size (root-storage-by-volume-size volume-total-storage-size)
|
||||
data-storage-size (data-storage-by-volume-size volume-total-storage-size root-storage-size)]
|
||||
data-storage-size (data-storage-by-volume-size volume-total-storage-size)]
|
||||
(->
|
||||
(yaml/load-as-edn "gitea/datavolume.yaml")
|
||||
(cm/replace-all-matching-values-by-new-value "DATASTORAGESIZE" (str (str data-storage-size) "Gi")))))
|
||||
|
|
|
@ -27,8 +27,6 @@ spec:
|
|||
- secretRef:
|
||||
name: gitea-secrets
|
||||
volumeMounts:
|
||||
- name: gitea-root-volume
|
||||
mountPath: "/var/lib/gitea"
|
||||
- name: gitea-data-volume
|
||||
mountPath: "/data"
|
||||
ports:
|
||||
|
@ -37,9 +35,6 @@ spec:
|
|||
- containerPort: 3000
|
||||
name: gitea
|
||||
volumes:
|
||||
- name: gitea-root-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: gitea-root-pvc
|
||||
- name: gitea-data-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: gitea-data-pvc
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: gitea-root-pvc
|
||||
namespace: default
|
||||
labels:
|
||||
app: gitea
|
||||
spec:
|
||||
storageClassName: local-path
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: ROOTSTORAGESIZE
|
|
@ -66,14 +66,8 @@
|
|||
:mailer-user "maileruser"
|
||||
:mailer-pw "mailerpw"})))))
|
||||
|
||||
(deftest should-generate-root-volume
|
||||
(is (= {:storage-c1 "5Gi",
|
||||
:storage-c2 "20Gi"}
|
||||
(th/map-diff (cut/generate-root-volume {:volume-total-storage-size 6})
|
||||
(cut/generate-root-volume {:volume-total-storage-size 101})))))
|
||||
|
||||
(deftest should-generate-data-volume
|
||||
(is (= {:storage-c1 "1Gi",
|
||||
:storage-c2 "15Gi"}
|
||||
(th/map-diff (cut/generate-data-volume {:volume-total-storage-size 6})
|
||||
(cut/generate-data-volume {:volume-total-storage-size 20})))))
|
||||
(th/map-diff (cut/generate-data-volume {:volume-total-storage-size 1})
|
||||
(cut/generate-data-volume {:volume-total-storage-size 15})))))
|
Loading…
Reference in a new issue