Skip to content

Commit

Permalink
Add kubernetes manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-eves committed Jan 9, 2024
1 parent e4bc4b6 commit 6453fa7
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kubernetes/local/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resources:
- ../prod
patches:
- target:
version: v1
kind: Service
name: typetunerweb
path: nodeport_service.yaml
6 changes: 6 additions & 0 deletions kubernetes/local/nodeport_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- op: add
path: /spec/type
value: NodePort
- op: add
path: /spec/ports/0/nodePort
value: 30080
91 changes: 91 additions & 0 deletions kubernetes/prod/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: typetunerweb
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
name: typetunerweb
spec:
restartPolicy: Always
containers:
- name: sync-tunable-fonts-repo
image: registry.k8s.io/git-sync/git-sync:v4.1.0
imagePullPolicy: IfNotPresent
args:
- '--repo=https://github.com/silnrsi/typetunerweb'
- '--depth=1'
- '--root=/mnt'
- '--period=10m'
volumeMounts:
- mountPath: /mnt
name: typetuner-repo
resources: &git-sync-resources
requests:
memory: "128Mi"
limits:
memory: "128Mi"

- name: app
image: ghcr.io/silnrsi/typetunerweb:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9000
name: fastcgi
protocol: TCP
volumeMounts:
- mountPath: /tunable-fonts
name: typetuner-repo
subPath: typetunerweb/web/server/TypeTuner/tunable-fonts
readOnly: true
resources:
requests:
memory: "64Mi"
limits:
memory: "64Mi"

- name: proxy
image: nginx:mainline-alpine-slim
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
name: http
protocol: TCP
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d
readOnly: true
resources:
requests:
memory: "24Mi"
limits:
memory: "24Mi"
initContainers:
- name: sync-init-tunable-fonts-repo
image: registry.k8s.io/git-sync/git-sync:v4.1.0
imagePullPolicy: IfNotPresent
args:
- '--repo=https://github.com/silnrsi/typetunerweb'
- '--one-time'
- '--depth=1'
- '--root=/mnt'
- '--period=10m'
volumeMounts:
- mountPath: /mnt
name: typetuner-repo
resources: *git-sync-resources

volumes:
- name: typetuner-repo
emptyDir:
sizeLimit: 500Mi
- name: nginx-config
configMap:
name: typetunerweb
items:
- key: nginx.default.conf
path: default.conf
mode: 420
Empty file added kubernetes/prod/fleet.yaml
Empty file.
13 changes: 13 additions & 0 deletions kubernetes/prod/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace: wstech
commonLabels:
app: typetunerweb
resources:
- deployment.yaml
- service.yaml
configMapGenerator:
- name: typetunerweb
namespace: wstech
files:
- nginx.default.conf
generatorOptions:
disableNameSuffixHash: true
28 changes: 28 additions & 0 deletions kubernetes/prod/nginx.default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
server {
listen 80;
server_name localhost;
index index.html;
root /var/www;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ /ttw/fonts[23]go\.cgi$ {
include /etc/nginx/fastcgi_params;
fastcgi_param SERVER_NAME $http_host;
fastcgi_pass localhost:9000;
}
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
}
13 changes: 13 additions & 0 deletions kubernetes/prod/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
labels:
run: typetunerweb
name: typetunerweb
spec:
ports:
- name: http
port: 80
protocol: TCP
selector:
app: typetunerweb

0 comments on commit 6453fa7

Please sign in to comment.