Skip to content

Commit

Permalink
PI-1969 Deploy dummy service for testing ingress issues (#3347)
Browse files Browse the repository at this point in the history
* PI-1969 Deploy dummy service for testing ingress issues

* Pin Flask version
  • Loading branch information
marcus-bcl authored Feb 29, 2024
1 parent a051a83 commit 6f10c5d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
matrix:
project:
- feature-flags
- ingress-test
steps:
- uses: actions/checkout@v4

Expand Down
9 changes: 9 additions & 0 deletions tools/ingress-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3-slim
WORKDIR /app

RUN useradd --uid 100 --create-home --system app
USER 100

RUN pip install --no-cache-dir Flask==3.0.2
COPY server.py server.py
CMD ["python", "server.py"]
10 changes: 10 additions & 0 deletions tools/ingress-test/deploy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
appVersion: '1.0'
description: A Helm chart for Kubernetes
name: ingress-test
version: 1.0.0

dependencies:
- name: generic-service
version: "2.8"
repository: https://ministryofjustice.github.io/hmpps-helm-charts
32 changes: 32 additions & 0 deletions tools/ingress-test/deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
generic-service:
nameOverride: ingress-test

replicaCount: 2

image:
repository: ghcr.io/ministryofjustice/hmpps-probation-integration-services/ingress-test
tag: "1.0"
port: 5000

securityContext:
runAsUser: 100 # app

ingress:
enabled: true
host: ingress-test.probation-integration.service.justice.gov.uk
tlsSecretName: ingress-test-cert

allowlist:
groups:
- internal
- unilink_staff

readinessProbe:
httpGet:
path: /test/0
initialDelaySeconds: 5
livenessProbe:
httpGet:
path: /test/0
initialDelaySeconds: 5
12 changes: 12 additions & 0 deletions tools/ingress-test/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from flask import Flask, make_response
import time

app = Flask(__name__)

@app.route('/test/<int:n>', methods=['GET'])
def test(n):
time.sleep(n)
return make_response('OK', 200)

if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000, threaded=True)

0 comments on commit 6f10c5d

Please sign in to comment.