diff --git a/src/main/cljc/dda/c4k_jira/core.cljc b/src/main/cljc/dda/c4k_jira/core.cljc index da818ed..85792ad 100644 --- a/src/main/cljc/dda/c4k_jira/core.cljc +++ b/src/main/cljc/dda/c4k_jira/core.cljc @@ -32,7 +32,7 @@ (when (contains? config :jira-data-volume-path) [(yaml/to-string (jira/generate-persistent-volume config))]) [(yaml/to-string (jira/generate-pvc)) - (yaml/to-string (jira/generate-pod config)) + (yaml/to-string (jira/generate-deployment config)) (yaml/to-string (jira/generate-service)) (yaml/to-string (jira/generate-certificate config)) (yaml/to-string (jira/generate-ingress config)) diff --git a/src/main/cljc/dda/c4k_jira/jira.cljc b/src/main/cljc/dda/c4k_jira/jira.cljc index 733321e..ec218da 100644 --- a/src/main/cljc/dda/c4k_jira/jira.cljc +++ b/src/main/cljc/dda/c4k_jira/jira.cljc @@ -13,9 +13,9 @@ (defmethod yaml/load-resource :jira [resource-name] (case resource-name "jira/certificate.yaml" (rc/inline "jira/certificate.yaml") + "jira/deployment.yaml" (rc/inline "jira/deployment.yaml") "jira/ingress.yaml" (rc/inline "jira/ingress.yaml") "jira/persistent-volume.yaml" (rc/inline "jira/persistent-volume.yaml") - "jira/pod.yaml" (rc/inline "jira/pod.yaml") "jira/pvc.yaml" (rc/inline "jira/pvc.yaml") "jira/service.yaml" (rc/inline "jira/service.yaml") (throw (js/Error. "Undefined Resource!"))))) @@ -29,6 +29,11 @@ (assoc-in [:spec :dnsNames] [fqdn]) (assoc-in [:spec :issuerRef :name] letsencrypt-issuer)))) +(defn generate-deployment [config] + (let [{:keys [fqdn]} config] + (-> (yaml/from-string (yaml/load-resource "jira/deployment.yaml")) + (cm/replace-named-value "FQDN" fqdn)))) + (defn generate-ingress [config] (let [{:keys [fqdn issuer] :or {issuer :staging}} config @@ -44,11 +49,6 @@ (yaml/from-string (yaml/load-resource "jira/persistent-volume.yaml")) (assoc-in [:spec :hostPath :path] jira-data-volume-path)))) -(defn generate-pod [config] - (let [{:keys [fqdn]} config] - (-> (yaml/from-string (yaml/load-resource "jira/pod.yaml")) - (cm/replace-named-value "FQDN" fqdn)))) - (defn generate-pvc [] (yaml/from-string (yaml/load-resource "jira/pvc.yaml"))) diff --git a/src/main/resources/jira/deployment.yaml b/src/main/resources/jira/deployment.yaml new file mode 100644 index 0000000..2e47eaf --- /dev/null +++ b/src/main/resources/jira/deployment.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jira +spec: + selector: + matchLabels: + app: jira + strategy: + type: Recreate + template: + metadata: + labels: + app: jira + spec: + containers: + - image: domaindrivenarchitecture/c4k-jira + name: jira-app + imagePullPolicy: IfNotPresent + env: + - name: DB_USERNAME_FILE + value: /var/run/secrets/postgres-secret/postgres-user + - name: DB_PASSWORD_FILE + value: /var/run/secrets/postgres-secret/postgres-password + - name: FQDN + value: fqdn + command: ["/app/entrypoint.sh"] + volumeMounts: + - mountPath: /var/jira + name: jira-data-volume + - name: postgres-secret-volume + mountPath: /var/run/secrets/postgres-secret + readOnly: true + volumes: + - name: jira-data-volume + persistentVolumeClaim: + claimName: jira-pvc + - name: postgres-secret-volume + secret: + secretName: postgres-secret diff --git a/src/main/resources/jira/pod.yaml b/src/main/resources/jira/pod.yaml deleted file mode 100644 index 625babf..0000000 --- a/src/main/resources/jira/pod.yaml +++ /dev/null @@ -1,32 +0,0 @@ -kind: Pod -apiVersion: v1 -metadata: - name: jira-app - labels: - app: jira -spec: - containers: - - image: domaindrivenarchitecture/c4k-jira - name: jira-app - imagePullPolicy: IfNotPresent - env: - - name: DB_USERNAME_FILE - value: /var/run/secrets/postgres-secret/postgres-user - - name: DB_PASSWORD_FILE - value: /var/run/secrets/postgres-secret/postgres-password - - name: FQDN - value: fqdn - command: ["/app/entrypoint.sh"] - volumeMounts: - - mountPath: /var/jira - name: jira-data-volume - - name: postgres-secret-volume - mountPath: /var/run/secrets/postgres-secret - readOnly: true - volumes: - - name: jira-data-volume - persistentVolumeClaim: - claimName: jira-pvc - - name: postgres-secret-volume - secret: - secretName: postgres-secret