refactor to deployment
This commit is contained in:
parent
a00ea7f1a3
commit
4f8f0cd6f1
4 changed files with 47 additions and 39 deletions
|
@ -32,7 +32,7 @@
|
||||||
(when (contains? config :jira-data-volume-path)
|
(when (contains? config :jira-data-volume-path)
|
||||||
[(yaml/to-string (jira/generate-persistent-volume config))])
|
[(yaml/to-string (jira/generate-persistent-volume config))])
|
||||||
[(yaml/to-string (jira/generate-pvc))
|
[(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-service))
|
||||||
(yaml/to-string (jira/generate-certificate config))
|
(yaml/to-string (jira/generate-certificate config))
|
||||||
(yaml/to-string (jira/generate-ingress config))
|
(yaml/to-string (jira/generate-ingress config))
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
(defmethod yaml/load-resource :jira [resource-name]
|
(defmethod yaml/load-resource :jira [resource-name]
|
||||||
(case resource-name
|
(case resource-name
|
||||||
"jira/certificate.yaml" (rc/inline "jira/certificate.yaml")
|
"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/ingress.yaml" (rc/inline "jira/ingress.yaml")
|
||||||
"jira/persistent-volume.yaml" (rc/inline "jira/persistent-volume.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/pvc.yaml" (rc/inline "jira/pvc.yaml")
|
||||||
"jira/service.yaml" (rc/inline "jira/service.yaml")
|
"jira/service.yaml" (rc/inline "jira/service.yaml")
|
||||||
(throw (js/Error. "Undefined Resource!")))))
|
(throw (js/Error. "Undefined Resource!")))))
|
||||||
|
@ -29,6 +29,11 @@
|
||||||
(assoc-in [:spec :dnsNames] [fqdn])
|
(assoc-in [:spec :dnsNames] [fqdn])
|
||||||
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer))))
|
(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]
|
(defn generate-ingress [config]
|
||||||
(let [{:keys [fqdn issuer]
|
(let [{:keys [fqdn issuer]
|
||||||
:or {issuer :staging}} config
|
:or {issuer :staging}} config
|
||||||
|
@ -44,11 +49,6 @@
|
||||||
(yaml/from-string (yaml/load-resource "jira/persistent-volume.yaml"))
|
(yaml/from-string (yaml/load-resource "jira/persistent-volume.yaml"))
|
||||||
(assoc-in [:spec :hostPath :path] jira-data-volume-path))))
|
(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 []
|
(defn generate-pvc []
|
||||||
(yaml/from-string (yaml/load-resource "jira/pvc.yaml")))
|
(yaml/from-string (yaml/load-resource "jira/pvc.yaml")))
|
||||||
|
|
||||||
|
|
40
src/main/resources/jira/deployment.yaml
Normal file
40
src/main/resources/jira/deployment.yaml
Normal file
|
@ -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
|
|
@ -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
|
|
Reference in a new issue