Skip to content

Commit

Permalink
Merge pull request #195 from ropable/master
Browse files Browse the repository at this point in the history
Refactor tracking views, add unit tests, refactor harvest functions & Kustomize overlays
  • Loading branch information
ropable authored Oct 31, 2023
2 parents 023641e + 9020254 commit d8913a3
Show file tree
Hide file tree
Showing 32 changed files with 802 additions and 449 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
- ../../../../template
nameSuffix: -harvest-dfes
patches:
- target:
group: batch
version: v1
kind: CronJob
name: resourcetracking-cronjob
path: patch.yaml
- path: patch.yaml
41 changes: 35 additions & 6 deletions kustomize/overlays/prod/cronjobs/harvest-dfes/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
- op: replace
path: /spec/schedule
value: "* * * * *"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "harvest_dfes_feed"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: Always
args: ["manage.py", "harvest_dfes_feed"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DATABASE_URL
- name: DFES_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DFES_URL
- name: DFES_USER
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DFES_USER
- name: DFES_PASS
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DFES_PASS

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
- ../../../../template
nameSuffix: -harvest-iriditrak
patches:
- target:
group: batch
version: v1
kind: CronJob
name: resourcetracking-cronjob
path: patch.yaml
- path: patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
- op: replace
path: /spec/schedule
value: "* * * * *"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "harvest_tracking_email", "--device-type", "iriditrak"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: Always
args: ["manage.py", "harvest_tracking_email", "--device-type", "iriditrak", "--purge-email"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DATABASE_URL
- name: EMAIL_HOST
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_HOST
- name: EMAIL_USER
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_USER
- name: EMAIL_PASSWORD
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_PASSWORD
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
- ../../../../template
nameSuffix: -harvest-mp70
patches:
- target:
group: batch
version: v1
kind: CronJob
name: resourcetracking-cronjob
path: patch.yaml
- path: patch.yaml
41 changes: 35 additions & 6 deletions kustomize/overlays/prod/cronjobs/harvest-email-mp70/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
- op: replace
path: /spec/schedule
value: "* * * * *"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "harvest_tracking_email", "--device-type", "mp70"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: Always
args: ["manage.py", "harvest_tracking_email", "--device-type", "mp70", "--purge-email"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DATABASE_URL
- name: EMAIL_HOST
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_HOST
- name: EMAIL_USER
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_USER
- name: EMAIL_PASSWORD
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_PASSWORD
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
- ../../../../template
nameSuffix: -harvest-spot
patches:
- target:
group: batch
version: v1
kind: CronJob
name: resourcetracking-cronjob
path: patch.yaml
- path: patch.yaml
41 changes: 35 additions & 6 deletions kustomize/overlays/prod/cronjobs/harvest-email-spot/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
- op: replace
path: /spec/schedule
value: "* * * * *"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "harvest_tracking_email", "--device-type", "spot"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: Always
args: ["manage.py", "harvest_tracking_email", "--device-type", "spot", "--purge-email"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DATABASE_URL
- name: EMAIL_HOST
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_HOST
- name: EMAIL_USER
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_USER
- name: EMAIL_PASSWORD
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: EMAIL_PASSWORD
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
- ../../../../template
nameSuffix: -harvest-tracplus
patches:
- target:
group: batch
version: v1
kind: CronJob
name: resourcetracking-cronjob
path: patch.yaml
- path: patch.yaml
31 changes: 25 additions & 6 deletions kustomize/overlays/prod/cronjobs/harvest-tracplus/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
- op: replace
path: /spec/schedule
value: "* * * * *"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "harvest_tracplus"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: Always
args: ["manage.py", "harvest_tracplus"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DATABASE_URL
- name: TRACPLUS_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: TRACPLUS_URL
2 changes: 1 addition & 1 deletion kustomize/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ labels:
variant: prod
images:
- name: ghcr.io/dbca-wa/resource_tracking
newTag: 1.4.0
newTag: 1.4.1
patches:
- path: deployment_patch.yaml
- path: service_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
nameSuffix: -harvest-dfes
patches:
- path: patch.yaml
35 changes: 35 additions & 0 deletions kustomize/overlays/uat/cronjobs/harvest-dfes/patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: Always
args: ["manage.py", "harvest_dfes_feed"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: DATABASE_URL
- name: DFES_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: DFES_URL
- name: DFES_USER
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: DFES_USER
- name: DFES_PASS
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: DFES_PASS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
nameSuffix: -harvest-email-iriditrak
patches:
- path: patch.yaml
35 changes: 35 additions & 0 deletions kustomize/overlays/uat/cronjobs/harvest-email-iriditrak/patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: Always
args: ["manage.py", "harvest_tracking_email", "--device-type", "iriditrak"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: DATABASE_URL
- name: EMAIL_HOST
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: EMAIL_HOST
- name: EMAIL_USER
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: EMAIL_USER
- name: EMAIL_PASSWORD
valueFrom:
secretKeyRef:
name: resourcetracking-env-uat
key: EMAIL_PASSWORD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
nameSuffix: -harvest-email-mp70
patches:
- path: patch.yaml
Loading

0 comments on commit d8913a3

Please sign in to comment.