Skip to content

Commit

Permalink
Merge pull request #307 from ropable/master
Browse files Browse the repository at this point in the history
Add def save_tracertrak_feed function, mgmt command, Kustomize cronjob, bump dependency minor versions
  • Loading branch information
ropable authored Dec 2, 2024
2 parents 3280dd5 + 9917a43 commit cfe752f
Show file tree
Hide file tree
Showing 20 changed files with 623 additions and 394 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/image-build-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,18 @@ jobs:
# Run vulnerability scan on built image
#----------------------------------------------
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
uses: aquasecurity/[email protected]
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
with:
scan-type: 'image'
scan-type: "image"
scanners: "vuln"
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
vuln-type: 'os,library'
severity: 'HIGH,CRITICAL'
format: 'sarif'
output: 'trivy-results.sarif'
vuln-type: "os,library"
severity: "HIGH,CRITICAL"
format: "sarif"
output: "trivy-results.sarif"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
sarif_file: "trivy-results.sarif"
126 changes: 67 additions & 59 deletions kustomize/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,79 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: resourcetracking-deployment
labels:
app: resourcetracking-deployment
spec:
selector:
matchLabels:
app: resourcetracking-deployment
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: resourcetracking-deployment
spec:
containers:
- name: resourcetracking
image: ghcr.io/dbca-wa/resource_tracking
env:
- name: ALLOWED_HOSTS
value: ".dbca.wa.gov.au"
- name: CSRF_TRUSTED_ORIGINS
value: "https://*.dbca.wa.gov.au"
- name: CSRF_COOKIE_SECURE
value: "True"
- name: SESSION_COOKIE_SECURE
value: "True"
- name: TZ
value: "Australia/Perth"
resources:
requests:
memory: "100Mi"
cpu: "5m"
limits:
memory: "2Gi"
cpu: "1000m"
startupProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 3
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 3
livenessProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /readyz
port: 8080
scheme: HTTP
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 5
securityContext:
runAsNonRoot: true
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmpfs-ram
- name: resourcetracking
image: ghcr.io/dbca-wa/resource_tracking
env:
- name: ALLOWED_HOSTS
value: ".dbca.wa.gov.au"
- name: CSRF_TRUSTED_ORIGINS
value: "https://*.dbca.wa.gov.au"
- name: CSRF_COOKIE_SECURE
value: "True"
- name: SESSION_COOKIE_SECURE
value: "True"
- name: TZ
value: "Australia/Perth"
resources:
requests:
memory: "100Mi"
cpu: "5m"
limits:
memory: "2Gi"
cpu: "1000m"
startupProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 3
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 3
livenessProbe:
httpGet:
path: /livez
port: 8080
scheme: HTTP
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /readyz
port: 8080
scheme: HTTP
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 5
securityContext:
runAsNonRoot: true
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmpfs-ram
volumes:
- name: tmpfs-ram
emptyDir:
Expand Down
8 changes: 4 additions & 4 deletions kustomize/base/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
type: ClusterIP
ports:
- name: wsgi
port: 8080
protocol: TCP
targetPort: 8080
- name: wsgi
port: 8080
protocol: TCP
targetPort: 8080
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../template
nameSuffix: -harvest-tracertrak
patches:
- target:
kind: CronJob
name: resourcetracking-cronjob
path: patch.yaml
- target:
kind: CronJob
name: resourcetracking-cronjob
options:
allowNameChange: true
patch: |-
- op: replace
path: /spec/jobTemplate/spec/template/spec/containers/0/name
value: resourcetracking-cronjob-harvest-tracertrak
37 changes: 37 additions & 0 deletions kustomize/overlays/prod/cronjobs/harvest-tracertrak/patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: resourcetracking-cronjob
spec:
schedule: "*/2 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: resourcetracking-cronjob
imagePullPolicy: IfNotPresent
args: ["manage.py", "harvest_tracertrak_feed"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: DATABASE_URL
- name: TRACERTRAK_URL
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: TRACERTRAK_URL
- name: TRACERTRAK_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: TRACERTRAK_AUTH_TOKEN
- name: SENTRY_DSN
valueFrom:
secretKeyRef:
name: resourcetracking-env-prod
key: SENTRY_DSN
- name: SENTRY_ENVIRONMENT
value: "prod"
Loading

0 comments on commit cfe752f

Please sign in to comment.