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-deployment)
|
||||||
(gitea/generate-service)
|
(gitea/generate-service)
|
||||||
(gitea/generate-service-ssh)
|
(gitea/generate-service-ssh)
|
||||||
(gitea/generate-root-volume config)
|
|
||||||
(gitea/generate-data-volume config)
|
(gitea/generate-data-volume config)
|
||||||
(gitea/generate-appini-env config)
|
(gitea/generate-appini-env config)
|
||||||
(gitea/generate-secrets config)
|
(gitea/generate-secrets config)
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
|
|
||||||
(def vol? (s/keys :req-un [::volume-total-storage-size]))
|
(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
|
(defn data-storage-by-volume-size
|
||||||
[total root]
|
[total]
|
||||||
(- total root))
|
total)
|
||||||
|
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
|
@ -66,7 +59,6 @@
|
||||||
"gitea/secrets.yaml" (rc/inline "gitea/secrets.yaml")
|
"gitea/secrets.yaml" (rc/inline "gitea/secrets.yaml")
|
||||||
"gitea/service.yaml" (rc/inline "gitea/service.yaml")
|
"gitea/service.yaml" (rc/inline "gitea/service.yaml")
|
||||||
"gitea/service-ssh.yaml" (rc/inline "gitea/service-ssh.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")
|
"gitea/datavolume.yaml" (rc/inline "gitea/datavolume.yaml")
|
||||||
(throw (js/Error. "Undefined Resource!")))))
|
(throw (js/Error. "Undefined Resource!")))))
|
||||||
|
|
||||||
|
@ -125,19 +117,10 @@
|
||||||
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer)
|
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer)
|
||||||
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))
|
(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?
|
(defn-spec generate-data-volume pred/map-or-seq?
|
||||||
[config vol?]
|
[config vol?]
|
||||||
(let [{:keys [volume-total-storage-size]} config
|
(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)]
|
||||||
data-storage-size (data-storage-by-volume-size volume-total-storage-size root-storage-size)]
|
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "gitea/datavolume.yaml")
|
(yaml/load-as-edn "gitea/datavolume.yaml")
|
||||||
(cm/replace-all-matching-values-by-new-value "DATASTORAGESIZE" (str (str data-storage-size) "Gi")))))
|
(cm/replace-all-matching-values-by-new-value "DATASTORAGESIZE" (str (str data-storage-size) "Gi")))))
|
||||||
|
|
|
@ -27,8 +27,6 @@ spec:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: gitea-secrets
|
name: gitea-secrets
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: gitea-root-volume
|
|
||||||
mountPath: "/var/lib/gitea"
|
|
||||||
- name: gitea-data-volume
|
- name: gitea-data-volume
|
||||||
mountPath: "/data"
|
mountPath: "/data"
|
||||||
ports:
|
ports:
|
||||||
|
@ -37,9 +35,6 @@ spec:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
name: gitea
|
name: gitea
|
||||||
volumes:
|
volumes:
|
||||||
- name: gitea-root-volume
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: gitea-root-pvc
|
|
||||||
- name: gitea-data-volume
|
- name: gitea-data-volume
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: gitea-data-pvc
|
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-user "maileruser"
|
||||||
:mailer-pw "mailerpw"})))))
|
: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
|
(deftest should-generate-data-volume
|
||||||
(is (= {:storage-c1 "1Gi",
|
(is (= {:storage-c1 "1Gi",
|
||||||
:storage-c2 "15Gi"}
|
:storage-c2 "15Gi"}
|
||||||
(th/map-diff (cut/generate-data-volume {:volume-total-storage-size 6})
|
(th/map-diff (cut/generate-data-volume {:volume-total-storage-size 1})
|
||||||
(cut/generate-data-volume {:volume-total-storage-size 20})))))
|
(cut/generate-data-volume {:volume-total-storage-size 15})))))
|
Loading…
Reference in a new issue