Skip to content

Commit

Permalink
Added Deployment file
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshmcg committed Aug 7, 2024
1 parent c9b667a commit 60088d4
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ install: HELM_OPTS=--atomic --wait-for-jobs --timeout 2400s --namespace $(NAMESP
--values $(CHART_DIR)/values-$(ENVIRONMENT).yaml
install:
@set -euo pipefail; \
dagConfig=$$(echo '{"org": "bcgov", "repo": "cas-cif", "ref": "$(GIT_SHA1)", "path": "dags/cas_cif_dags.py"}' | base64 -w0); \
dagConfig=$$(echo '{"org": "bcgov", "repo": "cas-cif", "ref": "$(GIT_SHA1)", "path": "dags/cas_cif_dags.py"}' | base64); \
helm dep up $(CHART_DIR); \
if ! helm status --namespace $(NAMESPACE) $(CHART_INSTANCE); then \
echo 'Installing the application and issuing SSL certificate'; \
Expand Down
4 changes: 2 additions & 2 deletions chart/cas-cif/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ dependencies:
- name: certbot
repository: https://bcdevops.github.io/certbot
version: 0.1.3
digest: sha256:22a3c8a861907a570a2415e8c4b5c0a5c7f6ae164207507f093b0bfaa752c8cf
generated: "2024-02-23T14:03:27.259123-08:00"
digest: sha256:d2da5fb2e1380ca061fdadb0e4cbe54137f1e3d43f90afe245339ddb320a771b
generated: "2024-07-17T18:07:23.81134-07:00"
57 changes: 57 additions & 0 deletions chart/cas-cif/templates/app-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
sleep 10;
done;
imagePullSecrets: {{ include "cas-cif.imagePullSecrets" . | nindent 8 }}
serviceAccountName: pod-logger
containers:
- name: {{ template "cas-cif.fullname" . }}
imagePullPolicy: {{ default .Values.defaultImagePullPolicy .Values.image.app.pullPolicy }}
Expand Down Expand Up @@ -139,11 +140,67 @@ spec:
- mountPath: "/attachments-credentials"
name: gcs-documents-credentials
readOnly: true
- name: oc-logs-container
image: openshift/origin-cli:latest
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
command:
- "/bin/sh"
- "-c"
- |
echo 'Starting log capture';
oc logs -f $POD_NAME -c {{ template "cas-cif.fullname" . }} --pod-running-timeout=20s >> /var/log/oc-cif-test.log;
volumeMounts:
- name: shared-logs
mountPath: /var/log
- name: logrotate-container
image: skymatic/logrotate:latest
command:
- "/bin/sh"
- "-c"
- "while true; do logrotate -s /var/log/logrotate.status -f /etc/logrotate.conf; sleep 5; done"
volumeMounts:
- name: shared-logs
mountPath: /var/log
- name: logrotate-config
mountPath: /etc/logrotate.conf
subPath: logrotate.conf
- name: fluent-bit
image: fluent/fluent-bit:latest
env:
- name: FLUENT_ELASTICSEARCH_HOST
value: elasticsearch.9212c9-tools.svc.cluster.local
- name: FLUENT_ELASTICSEARCH_PORT
value: "9200"
command: [ "/fluent-bit/bin/fluent-bit", "-c", "/var/log/fluent-bit.conf" ]
volumeMounts:
- name: shared-logs
mountPath: /var/log
- name: fluent-bit-config
mountPath: /var/log/fluent-bit.conf
subPath: fluent-bit.conf
- name: parsers-config
mountPath: /var/log/parsers.conf
subPath: parsers.conf
volumes:
- name: gcs-documents-credentials
secret:
secretName: gcp-{{ .Release.Namespace }}-cif-documents-service-account-key
items:
- key: credentials.json
path: attachments-credentials.json
- name: shared-logs
emptyDir: { }
- name: logrotate-config
configMap:
name: logrotate-configmap
- name: fluent-bit-config
configMap:
name: fluent-bit-config
- name: parsers-config
configMap:
name: fluent-bit-config
restartPolicy: Always
3 changes: 1 addition & 2 deletions chart/cas-cif/templates/fluent-bit-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ data:
[SERVICE]
Flush 5
Daemon Off
Parsers_File /var/log/parsers.conf
Parsers_File parsers.conf
Log_Level info
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
Storage_Type filesystem
[INPUT]
Name tail
Expand Down
17 changes: 17 additions & 0 deletions chart/cas-cif/templates/logrotate-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: logrotate-configmap
data:
logrotate.conf: |
/var/log/oc-cif-test.log {
size 100M
missingok
notifempty
copytruncate
rotate 5
compress
delaycompress
dateext
dateformat -%Y%m%d%H%M%S
}
4 changes: 2 additions & 2 deletions chart/cas-cif/templates/pod-logger-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ rules:
resources: ["pods"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["pods/logs"]
verbs: ["get", "list"]
resources: ["pods/log"]
verbs: ["get", "list","watch"]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"before:bump": "sqitch --chdir schema tag ${version} -m 'release v${version}'",
"before:git:beforeRelease": "./.bin/pre-commit-format.sh CHANGELOG.md"
}
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

0 comments on commit 60088d4

Please sign in to comment.