Skip to content

Commit

Permalink
feat: Add consumer driven contract testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneLimburg committed Nov 7, 2024
1 parent 0cf39ca commit f12d80f
Show file tree
Hide file tree
Showing 24 changed files with 397 additions and 0 deletions.
22 changes: 22 additions & 0 deletions address-validation-service/deployment/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: address-validation-deployment
labels:
app: address-validation-service
spec:
replicas: 1
selector:
matchLabels:
app: address-validation-service
template:
metadata:
labels:
app: address-validation-service
spec:
containers:
- name: address-validation
image: address-validation:latest
ports:
- containerPort: 4003
name: http
6 changes: 6 additions & 0 deletions address-validation-service/deployment/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml
14 changes: 14 additions & 0 deletions address-validation-service/deployment/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: address-validation-service
spec:
selector:
app: address-validation-service
type: NodePort
ports:
- protocol: TCP
port: 4003
targetPort: 4003
nodePort: 30090
name: service
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: prod

resources:
- ../../base

patches:
- target:
version: v1
kind: Service
name: address-validation-service
path: ./patches/port-patch.yaml

images:
- name: address-validation
newName: localhost:30010/address-validation
newTag: 1.1.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: address-validation-service
spec:
selector:
app: address-validation-service
type: NodePort
ports:
- protocol: TCP
port: 4003
targetPort: 4003
nodePort: 31090
name: service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: test

resources:
- ../../base

images:
- name: address-validation
newName: localhost:30010/address-validation
newTag: 1.1.0-SNAPSHOT
22 changes: 22 additions & 0 deletions billing-service/deployment/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: billing-deployment
labels:
app: billing-service
spec:
replicas: 1
selector:
matchLabels:
app: billing-service
template:
metadata:
labels:
app: billing-service
spec:
containers:
- name: billing
image: billing:latest
ports:
- containerPort: 4001
name: http
6 changes: 6 additions & 0 deletions billing-service/deployment/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml
14 changes: 14 additions & 0 deletions billing-service/deployment/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: billing-service
spec:
selector:
app: billing-service
type: NodePort
ports:
- protocol: TCP
port: 4001
targetPort: 4001
nodePort: 30070
name: service
19 changes: 19 additions & 0 deletions billing-service/deployment/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: prod

resources:
- ../../base

patches:
- target:
version: v1
kind: Service
name: billing-service
path: ./patches/port-patch.yaml

images:
- name: billing
newName: localhost:30010/billing
newTag: 1.1.0-SNAPSHOT
14 changes: 14 additions & 0 deletions billing-service/deployment/overlays/prod/patches/port-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: billing-service
spec:
selector:
app: billing-service
type: NodePort
ports:
- protocol: TCP
port: 4001
targetPort: 4001
nodePort: 31070
name: service
12 changes: 12 additions & 0 deletions billing-service/deployment/overlays/test/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: test

resources:
- ../../base

images:
- name: billing
newName: localhost:30010/billing
newTag: 1.1.0-SNAPSHOT
27 changes: 27 additions & 0 deletions customer-service/deployment/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: customer-deployment
labels:
app: customer-service
spec:
replicas: 1
selector:
matchLabels:
app: customer-service
template:
metadata:
labels:
app: customer-service
spec:
containers:
- name: customer
image: customer:latest
ports:
- containerPort: 4000
name: http
env:
- name: BILLING_SERVICE_URL
value: http://billing-service:4001
- name: DELIVERY_SERVICE_URL
value: http://delivery-service:4002
6 changes: 6 additions & 0 deletions customer-service/deployment/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml
14 changes: 14 additions & 0 deletions customer-service/deployment/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: customer-service
spec:
selector:
app: customer-service
type: NodePort
ports:
- protocol: TCP
port: 4000
targetPort: 4000
nodePort: 30060
name: service
19 changes: 19 additions & 0 deletions customer-service/deployment/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: prod

resources:
- ../../base

patches:
- target:
version: v1
kind: Service
name: customer-service
path: ./patches/port-patch.yaml

images:
- name: customer
newName: localhost:30010/customer
newTag: 1.1.0-SNAPSHOT
14 changes: 14 additions & 0 deletions customer-service/deployment/overlays/prod/patches/port-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: customer-service
spec:
selector:
app: customer-service
type: NodePort
ports:
- protocol: TCP
port: 4000
targetPort: 4000
nodePort: 31060
name: service
12 changes: 12 additions & 0 deletions customer-service/deployment/overlays/test/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: test

resources:
- ../../base

images:
- name: customer
newName: localhost:30010/customer
newTag: 1.1.0-SNAPSHOT
52 changes: 52 additions & 0 deletions delivery-service/deployment/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: delivery-deployment
labels:
app: delivery-service
spec:
replicas: 1
selector:
matchLabels:
app: delivery-service
template:
metadata:
labels:
app: delivery-service
spec:
containers:
- name: delivery
image: delivery:latest
ports:
- containerPort: 4002
name: http
env:
- name: ADDRESS_VALIDATION_SERVICE_URL
value: http://address-validation-service:4003
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: delivery-db-deployment
labels:
app: delivery-db
spec:
replicas: 1
selector:
matchLabels:
app: delivery-db
template:
metadata:
labels:
app: delivery-db
spec:
containers:
- name: delivery-postgres
image: host.docker.internal:5000/delivery-db:local
ports:
- containerPort: 5432
env:
- name: POSTGRES_USER
value: delivery-service
- name: POSTGRES_PASSWORD
value: delivery-password
6 changes: 6 additions & 0 deletions delivery-service/deployment/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- deployment.yaml
- service.yaml
28 changes: 28 additions & 0 deletions delivery-service/deployment/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v1
kind: Service
metadata:
name: delivery-service
spec:
selector:
app: delivery-service
type: NodePort
ports:
- protocol: TCP
port: 4002
targetPort: 4002
nodePort: 30080
name: service
---
apiVersion: v1
kind: Service
metadata:
name: delivery-db
spec:
selector:
app: delivery-db
type: NodePort
ports:
- protocol: TCP
port: 5432
targetPort: 5432
name: service
19 changes: 19 additions & 0 deletions delivery-service/deployment/overlays/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: prod

resources:
- ../../base

patches:
- target:
version: v1
kind: Service
name: delivery-service
path: ./patches/port-patch.yaml

images:
- name: delivery
newName: localhost:30010/delivery
newTag: 1.1.0-SNAPSHOT
Loading

0 comments on commit f12d80f

Please sign in to comment.