Skip to content

Commit

Permalink
Create k8s base dir with cronjob
Browse files Browse the repository at this point in the history
Creates a cronjob that runs on the 1, 15th and 28th (mostly every
other week.)

The 1st is the most important one as that is what we'll be giving
out. This will generate the final invoice for the previous month.

15th will generate a mid-month usage invoice. Potentially useful
for notifying users about they currently have running.

28th will make sure that things still work a few days before
we need to bill on the 1st.
  • Loading branch information
knikolla committed Feb 6, 2024
1 parent 86bf5da commit 7bf8b80
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
18 changes: 18 additions & 0 deletions k8s/base/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: invoicing-openstack-biweekly
spec:
schedule: "0 7 1,15,28 * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: invoicing-openstack-biweekly
image: ghcr.io/cci-moc/openshift-billing-from-db:latest
envFrom:
- secretRef:
name: invoicing-openstack-credentials
imagePullPolicy: Always
restartPolicy: OnFailure
6 changes: 6 additions & 0 deletions k8s/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
commonLabels:
app: invoicing-openstack
resources:
- cronjob.yaml
- namespace.yaml
namespace: invoicing-openstack
5 changes: 5 additions & 0 deletions k8s/base/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: invoicing-openstack
spec: {}
10 changes: 10 additions & 0 deletions k8s/overlays/dev/credentials.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
S3_INPUT_ENDPOINT_URL="http://localhost:9090"
S3_INPUT_ACCESS_KEY_ID="123"
S3_INPUT_SECRET_ACCESS_KEY="123"

S3_OUTPUT_ENDPOINT_URL="http://localhost:9090"
S3_OUTPUT_ACCESS_KEY_ID="123"
S3_OUTPUT_SECRET_ACCESS_KEY="123"

KEYCLOAK_CLIENT_ID="test"
KEYCLOAK_CLIENT_SECRET="123"
10 changes: 10 additions & 0 deletions k8s/overlays/dev/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../base

secretGenerator:
- name: invoicing-openstack-credentials
envs:
- credentials.env

0 comments on commit 7bf8b80

Please sign in to comment.