diff --git a/src/main/cljc/dda/c4k_gitea/core.cljc b/src/main/cljc/dda/c4k_gitea/core.cljc index 66d0022..b31bba8 100644 --- a/src/main/cljc/dda/c4k_gitea/core.cljc +++ b/src/main/cljc/dda/c4k_gitea/core.cljc @@ -21,8 +21,7 @@ (postgres/generate-service) (gitea/generate-deployment) (gitea/generate-service) - (gitea/generate-service-ssh) - (gitea/generate-root-volume config) + (gitea/generate-service-ssh) (gitea/generate-data-volume config) (gitea/generate-appini-env config) (gitea/generate-secrets config) diff --git a/src/main/cljc/dda/c4k_gitea/gitea.cljc b/src/main/cljc/dda/c4k_gitea/gitea.cljc index 8e55138..87fedb1 100644 --- a/src/main/cljc/dda/c4k_gitea/gitea.cljc +++ b/src/main/cljc/dda/c4k_gitea/gitea.cljc @@ -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 @@ -65,8 +58,7 @@ "gitea/ingress.yaml" (rc/inline "gitea/ingress.yaml") "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/service-ssh.yaml" (rc/inline "gitea/service-ssh.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)] + (let [{:keys [volume-total-storage-size]} config + 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"))))) diff --git a/src/main/resources/gitea/deployment.yaml b/src/main/resources/gitea/deployment.yaml index 4dedc37..f3d9e19 100644 --- a/src/main/resources/gitea/deployment.yaml +++ b/src/main/resources/gitea/deployment.yaml @@ -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 diff --git a/src/main/resources/gitea/rootvolume.yaml b/src/main/resources/gitea/rootvolume.yaml deleted file mode 100644 index 19c5fe7..0000000 --- a/src/main/resources/gitea/rootvolume.yaml +++ /dev/null @@ -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 diff --git a/src/test/cljc/dda/c4k_gitea/gitea_test.cljc b/src/test/cljc/dda/c4k_gitea/gitea_test.cljc index 556a186..1cfb295 100644 --- a/src/test/cljc/dda/c4k_gitea/gitea_test.cljc +++ b/src/test/cljc/dda/c4k_gitea/gitea_test.cljc @@ -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}))))) \ No newline at end of file + (th/map-diff (cut/generate-data-volume {:volume-total-storage-size 1}) + (cut/generate-data-volume {:volume-total-storage-size 15}))))) \ No newline at end of file