Skip to content

Commit

Permalink
Refactor Kustomize cronjob template and overlays.
Browse files Browse the repository at this point in the history
  • Loading branch information
ropable committed Oct 31, 2023
1 parent dbc2717 commit 996b50d
Show file tree
Hide file tree
Showing 27 changed files with 542 additions and 276 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: -ascender-csv-upload
patches:
- target:
group: batch
version: v1
kind: CronJob
name: itassets-cronjob
path: patch.yaml
- path: patch.yaml
50 changes: 44 additions & 6 deletions kustomize/overlays/prod/cronjobs/ascender-csv-upload/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
- op: replace
path: /spec/schedule
value: "22 18 * * 1-5"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "department_users_upload_ascender_sftp", "--help"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: itassets-cronjob
spec:
schedule: "22 18 * * 1-5"
jobTemplate:
spec:
template:
spec:
containers:
- name: itassets-cronjob
args: ["manage.py", "department_users_upload_ascender_sftp"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: DATABASE_URL
- name: ASCENDER_SFTP_HOSTNAME
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ASCENDER_SFTP_HOSTNAME
- name: ASCENDER_SFTP_PORT
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ASCENDER_SFTP_PORT
- name: ASCENDER_SFTP_USERNAME
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ASCENDER_SFTP_USERNAME
- name: ASCENDER_SFTP_PASSWORD
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ASCENDER_SFTP_PASSWORD
- name: ASCENDER_SFTP_DIRECTORY
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ASCENDER_SFTP_DIRECTORY
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: -deptusers-audit-email
patches:
- target:
group: batch
version: v1
kind: CronJob
name: itassets-cronjob
path: patch.yaml
- path: patch.yaml
45 changes: 39 additions & 6 deletions kustomize/overlays/prod/cronjobs/deptusers-audit-email/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
- op: replace
path: /spec/schedule
value: "7 19 * * 1-5"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "department_users_audit_emails", "--help"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: itassets-cronjob
spec:
schedule: "7 19 * * 1-5"
jobTemplate:
spec:
template:
spec:
containers:
- name: itassets-cronjob
args: ["manage.py", "department_users_audit_emails"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: DATABASE_URL
- name: AZURE_TENANT_ID
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: AZURE_TENANT_ID
- name: MS_GRAPH_API_CLIENT_ID
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: MS_GRAPH_API_CLIENT_ID
- name: MS_GRAPH_API_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: MS_GRAPH_API_CLIENT_SECRET
- name: AZURE_CONNECTION_STRING
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: AZURE_CONNECTION_STRING
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: -deptusers-audit-employeeid
patches:
- path: patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: itassets-cronjob
spec:
schedule: "33 18 * * 1-5"
jobTemplate:
spec:
template:
spec:
containers:
- name: itassets-cronjob
args: ["manage.py", "department_users_audit_employee_ids"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: DATABASE_URL
- name: FOREIGN_DB_HOST
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_HOST
- name: FOREIGN_DB_PORT
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_PORT
- name: FOREIGN_DB_NAME
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_NAME
- name: FOREIGN_DB_USERNAME
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_USERNAME
- name: FOREIGN_DB_PASSWORD
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_PASSWORD
- name: FOREIGN_SCHEMA
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_SCHEMA
- name: FOREIGN_SERVER
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_SERVER
- name: FOREIGN_TABLE
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_TABLE
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: -deptusers-check-ascender
patches:
- target:
group: batch
version: v1
kind: CronJob
name: itassets-cronjob
path: patch.yaml
- path: patch.yaml
100 changes: 94 additions & 6 deletions kustomize/overlays/prod/cronjobs/deptusers-check-ascender/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,94 @@
- op: replace
path: /spec/schedule
value: "10,40 8-18 * * 1-5"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "check_ascender_accounts", "--help"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: itassets-cronjob
spec:
schedule: "10,40 8-18 * * 1-5"
jobTemplate:
spec:
template:
spec:
containers:
- name: itassets-cronjob
args: ["manage.py", "check_ascender_accounts"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: DATABASE_URL
- name: EMAIL_HOST
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: EMAIL_HOST
- name: ADMIN_EMAILS
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ADMIN_EMAILS
- name: ASCENDER_CREATE_AZURE_AD
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ASCENDER_CREATE_AZURE_AD
- name: ASCENDER_CREATE_AZURE_AD_LIMIT_DAYS
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: ASCENDER_CREATE_AZURE_AD_LIMIT_DAYS
- name: FOREIGN_DB_HOST
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_HOST
- name: FOREIGN_DB_PORT
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_PORT
- name: FOREIGN_DB_NAME
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_NAME
- name: FOREIGN_DB_USERNAME
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_USERNAME
- name: FOREIGN_DB_PASSWORD
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_DB_PASSWORD
- name: FOREIGN_SCHEMA
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_SCHEMA
- name: FOREIGN_SERVER
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_SERVER
- name: FOREIGN_TABLE
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: FOREIGN_TABLE
- name: AZURE_TENANT_ID
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: AZURE_TENANT_ID
- name: MS_GRAPH_API_CLIENT_ID
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: MS_GRAPH_API_CLIENT_ID
- name: MS_GRAPH_API_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: MS_GRAPH_API_CLIENT_SECRET
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: -deptusers-check-azure
patches:
- target:
group: batch
version: v1
kind: CronJob
name: itassets-cronjob
path: patch.yaml
- path: patch.yaml
45 changes: 39 additions & 6 deletions kustomize/overlays/prod/cronjobs/deptusers-check-azure/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
- op: replace
path: /spec/schedule
value: "15,45 8-18 * * 1-5"
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/args
value: ["manage.py", "check_azure_accounts", "--help"]
apiVersion: batch/v1
kind: CronJob
metadata:
name: itassets-cronjob
spec:
schedule: "15,45 8-18 * * 1-5"
jobTemplate:
spec:
template:
spec:
containers:
- name: itassets-cronjob
args: ["manage.py", "check_azure_accounts"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: DATABASE_URL
- name: AZURE_TENANT_ID
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: AZURE_TENANT_ID
- name: MS_GRAPH_API_CLIENT_ID
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: MS_GRAPH_API_CLIENT_ID
- name: MS_GRAPH_API_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: MS_GRAPH_API_CLIENT_SECRET
- name: AZURE_CONNECTION_STRING
valueFrom:
secretKeyRef:
name: itassets-env-prod
key: AZURE_CONNECTION_STRING
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: -deptusers-check-onprem
patches:
- target:
group: batch
version: v1
kind: CronJob
name: itassets-cronjob
path: patch.yaml
- path: patch.yaml
Loading

0 comments on commit 996b50d

Please sign in to comment.