Skip to content

Commit 3334fcb

Browse files
authored
Add kubernetes config (#239)
1 parent 02d8a9c commit 3334fcb

12 files changed

+823
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: family-mediators-api-configmap-production
5+
namespace: family-mediators-api-production
6+
data:
7+
LOG_LEVEL: info
8+
RACK_ENV: production
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: family-mediators-api-deployment-production
5+
namespace: family-mediators-api-production
6+
spec:
7+
replicas: 2
8+
revisionHistoryLimit: 5
9+
strategy:
10+
type: RollingUpdate
11+
rollingUpdate:
12+
maxUnavailable: 0
13+
maxSurge: 100%
14+
selector:
15+
matchLabels:
16+
app: family-mediators-api-web-production
17+
template:
18+
metadata:
19+
labels:
20+
app: family-mediators-api-web-production
21+
tier: frontend
22+
spec:
23+
containers:
24+
- name: webapp
25+
image: 754256621582.dkr.ecr.eu-west-2.amazonaws.com/family-justice/family-mediators-api:production.latest
26+
imagePullPolicy: Always
27+
ports:
28+
- containerPort: 9292
29+
resources:
30+
requests:
31+
cpu: 125m
32+
memory: 1Gi
33+
limits:
34+
cpu: 250m
35+
memory: 2Gi
36+
readinessProbe:
37+
httpGet:
38+
path: /ping
39+
port: 9292
40+
initialDelaySeconds: 5
41+
periodSeconds: 10
42+
livenessProbe:
43+
httpGet:
44+
path: /ping
45+
port: 9292
46+
initialDelaySeconds: 15
47+
periodSeconds: 10
48+
# non-secret env vars defined in `config_map.yaml`
49+
envFrom:
50+
- configMapRef:
51+
name: family-mediators-api-configmap-production
52+
env:
53+
# external secrets defined in kubernetes
54+
- name: USERNAME
55+
valueFrom:
56+
secretKeyRef:
57+
name: family-mediators-api-secrets-production
58+
key: username
59+
- name: PASSWORD_HASH
60+
valueFrom:
61+
secretKeyRef:
62+
name: family-mediators-api-secrets-production
63+
key: password_hash
64+
- name: SESSION_SECRET
65+
valueFrom:
66+
secretKeyRef:
67+
name: family-mediators-api-secrets-production
68+
key: session_secret
69+
- name: SENTRY_DSN
70+
valueFrom:
71+
secretKeyRef:
72+
name: family-mediators-api-secrets-production
73+
key: sentry_dsn
74+
#
75+
# secrets created by `terraform`
76+
#
77+
- name: DATABASE_URL
78+
valueFrom:
79+
secretKeyRef:
80+
name: rds-instance-family-mediators-api-production
81+
key: url
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: policy/v1beta1
2+
kind: PodDisruptionBudget
3+
metadata:
4+
name: family-mediators-api-pdb-production
5+
namespace: family-mediators-api-production
6+
spec:
7+
maxUnavailable: 50%
8+
selector:
9+
matchLabels:
10+
app: family-mediators-api-web-production
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
name: family-mediators-api-ingress-production
5+
namespace: family-mediators-api-production
6+
annotations:
7+
external-dns.alpha.kubernetes.io/set-identifier: family-mediators-api-ingress-production-family-mediators-api-production-green
8+
external-dns.alpha.kubernetes.io/aws-weight: "100"
9+
nginx.ingress.kubernetes.io/server-snippet: |
10+
location = /.well-known/security.txt {
11+
return 301 https://raw.githubusercontent.com/ministryofjustice/security-guidance/main/contact/vulnerability-disclosure-security.txt;
12+
}
13+
location ~* \.(php|cgi|xml)$ { deny all; access_log off; }
14+
spec:
15+
ingressClassName: default
16+
tls:
17+
- hosts:
18+
- family-mediators-api-production.apps.live.cloud-platform.service.justice.gov.uk
19+
- hosts:
20+
- familymediators.service.justice.gov.uk
21+
secretName: family-mediators-api-tls-certificate
22+
rules:
23+
- host: family-mediators-api-production.apps.live.cloud-platform.service.justice.gov.uk
24+
http:
25+
paths:
26+
- path: /
27+
pathType: Prefix
28+
backend:
29+
service:
30+
name: family-mediators-api-service-production
31+
port:
32+
number: 80
33+
- host: familymediators.service.justice.gov.uk
34+
http:
35+
paths:
36+
- path: /
37+
pathType: Prefix
38+
backend:
39+
service:
40+
name: family-mediators-api-service-production
41+
port:
42+
number: 80
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: family-mediators-api-service-production
5+
namespace: family-mediators-api-production
6+
labels:
7+
app: family-mediators-api-web-production
8+
spec:
9+
ports:
10+
- port: 80
11+
name: http
12+
targetPort: 9292
13+
selector:
14+
app: family-mediators-api-web-production
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: family-mediators-api-configmap-staging
5+
namespace: family-mediators-api-staging
6+
data:
7+
LOG_LEVEL: debug
8+
RACK_ENV: production

0 commit comments

Comments
 (0)