Skip to content

Commit

Permalink
Merge pull request #141 from bcgov/cronLog
Browse files Browse the repository at this point in the history
Cron log
  • Loading branch information
thegentlemanphysicist authored Jul 15, 2022
2 parents 623eabf + 103950e commit 104061d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nodejs 14.14.0
python 3.8.6
kubectl 1.18.0
kubectl 1.24.2
oc 4.7.5
helm 3.8.2
yarn 1.22.4
Expand Down
5 changes: 5 additions & 0 deletions docker/kc-cron-job/event-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ const reduceDataFromFiles = async (dirname) => {
try {
client = getClient();
await client.connect();
if (!fs.existsSync(dirname)) {
console.info(`Directory ${dirname} does not exist.`);
return;
}

const files = await fsPromises.readdir(dirname);
for (const filename of files) {
const lineReader = readline.createInterface({
Expand Down
6 changes: 4 additions & 2 deletions helm/kc-cron-job/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SHELL := /usr/bin/env bash
NAMESPACE=""
URL=''
CLIENTSECRET=''
CLIENTNAME=''

.PHONY: install
install:
Expand All @@ -24,10 +25,11 @@ force-install: uninstall
force-install: install

# The service account secrets are located in the prod keycloak app
# the client is located in the master realm
# the client is located in the master realm CLIENTNAME=script-cli for silver and
# and gold sandbox projects, CLIENTNAME=viewer-cli in gold production.
.PHONY: service-acount-secret
service-acount-secret:
kubectl create secret generic kc-cron-service-account -n "${NAMESPACE}" \
--from-literal=keycloak-url=${URL} \
--from-literal=client-id=script-cli \
--from-literal=client-id=${CLIENTNAME} \
--from-literal=client-secret=${CLIENTSECRET}
21 changes: 21 additions & 0 deletions helm/kc-cron-job/templates/network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,24 @@ spec:
name: {{ .Chart.Name }}
policyTypes:
- Ingress
---
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: kc-cron-prod-access
namespace: {{ .Values.networkPolicy.licensePlate }}-tools
spec:
podSelector:
matchLabels:
app.kubernetes.io/instance: {{.Values.nameOverride}}
ingress:
- from:
- podSelector:
matchLabels:
app.kubernetes.io/name: {{.Values.nameOverride}}
namespaceSelector:
matchLabels:
environment: prod
name: {{ .Values.networkPolicy.licensePlate }}
policyTypes:
- Ingress

0 comments on commit 104061d

Please sign in to comment.