Skip to content

Commit 281b318

Browse files
authored
Add Kubernetes manifest files (#1)
* Add k8s directory * Add k8s manifest files * Remove local cluster config directory and update README.md file * Update README.md file * Update README * Reorganize badges of README.md file
1 parent c0a308a commit 281b318

File tree

7 files changed

+119
-1
lines changed

7 files changed

+119
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# 🚀 Document Template Processing Service 🚀
22

33
[![python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)
4-
[![docker](https://img.shields.io/badge/Docker-3776AB?style=for-the-badge&logo=docker&logoColor=white)](https://hub.docker.com/r/papihack/document-template-processor)
54
![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=for-the-badge&logo=fastapi)
5+
[![docker](https://img.shields.io/badge/Docker-3776AB?style=for-the-badge&logo=docker&logoColor=white)](https://hub.docker.com/r/papihack/document-template-processor)
6+
[![kubernetes](https://img.shields.io/badge/kubernetes-3776AB?style=for-the-badge&logo=kubernetes&logoColor=white)](https://github.com/PapiHack/document-templating-service/tree/master/k8s)
67
![Issues](https://img.shields.io/github/issues/PapiHack/document-templating-service?style=for-the-badge&logo=appveyor)
78
![PR](https://img.shields.io/github/issues-pr/PapiHack/document-templating-service?style=for-the-badge&logo=appveyor)
89
[![MIT licensed](https://img.shields.io/badge/license-mit-blue?style=for-the-badge&logo=appveyor)](./LICENSE)
@@ -73,6 +74,27 @@ Or stop and remove all the service with :
7374

7475
docker-compose down
7576

77+
78+
## Up & Running with Kubernetes
79+
80+
If you want to deploy this project on your kubernetes cluster, you can inspect and/or edit the manifest files available in the
81+
`k8s` directory before apply them.
82+
83+
Start by creating the namespace named `utils` by running :
84+
85+
kubectl apply -f k8s/namespace.yaml
86+
87+
Then, you can deploy the necessary components by running :
88+
89+
kubectl apply -f k8s/gotenberg -f k8s/document-template-processing
90+
91+
After that, feel free to create an `ingress` for `svc/document-template-processing` if you are using such kind of k8s component.
92+
93+
Otherwise, you can port forward the api service by running the following command before visiting <http://localhost:8000/docs> :
94+
95+
kubectl port-forward svc/document-template-processing 8000:8000 -n utils
96+
97+
7698
## Usage
7799

78100
For now, you have an endpoint named `/api/v1/process-template-document` that will allow you to make a `POST HTTP REQUEST` by sending two (2) required parameters :
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: document-template-processing-config
5+
namespace: utils
6+
data:
7+
gotenberg-service-url: http://gotenberg.utils.svc
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: document-template-processing
5+
namespace: utils
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: document-template-processing
11+
template:
12+
metadata:
13+
labels:
14+
app: document-template-processing
15+
spec:
16+
containers:
17+
- name: document-template-processing
18+
image: papihack/document-template-processor
19+
env:
20+
- name: GOTENBERG_API_URL
21+
valueFrom:
22+
configMapKeyRef:
23+
name: document-template-processing-config
24+
key: gotenberg-service-url
25+
resources:
26+
limits:
27+
memory: "256Mi"
28+
cpu: "800m"
29+
ports:
30+
- name: web
31+
containerPort: 8000
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: document-template-processing
5+
namespace: utils
6+
spec:
7+
type: ClusterIP
8+
selector:
9+
app: document-template-processing
10+
ports:
11+
- name: http
12+
port: 8000
13+
targetPort: web

k8s/gotenberg/deployment.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: gotenberg
5+
namespace: utils
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: gotenberg
11+
template:
12+
metadata:
13+
labels:
14+
app: gotenberg
15+
spec:
16+
containers:
17+
- name: gotenberg
18+
securityContext:
19+
privileged: false
20+
runAsUser: 1001
21+
image: gotenberg/gotenberg:7-cloudrun
22+
resources:
23+
limits:
24+
memory: "512Mi"
25+
cpu: "800m"
26+
ports:
27+
- name: web
28+
containerPort: 3000

k8s/gotenberg/service.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: gotenberg
5+
namespace: utils
6+
spec:
7+
type: ClusterIP
8+
selector:
9+
app: gotenberg
10+
ports:
11+
- port: 80
12+
name: http
13+
targetPort: web

k8s/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: utils

0 commit comments

Comments
 (0)