tusd/.infra/kube/tusd-kube.yaml

148 lines
3.5 KiB
YAML
Raw Normal View History

2018-07-10 22:37:46 +00:00
apiVersion: apps/v1
kind: StatefulSet
2018-01-06 15:53:24 +00:00
metadata:
name: tusd
namespace: tus
spec:
2018-07-10 22:37:46 +00:00
replicas: 2
serviceName: "tusd"
2018-01-06 15:53:24 +00:00
template:
metadata:
labels:
app: tusd
spec:
2018-07-10 22:37:46 +00:00
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: cloud.google.com/gke-preemptible
operator: Exists
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- tusd
topologyKey: kubernetes.io/hostname
2018-01-06 15:53:24 +00:00
containers:
- image: docker.io/tusproject/tusd:latest
imagePullPolicy: Always
2018-07-10 22:21:57 +00:00
args: ["-gcs-bucket","tusd-public-demo","-port=8080","-behind-proxy","-max-size=20000000000"]
2018-01-06 15:53:24 +00:00
name: tusd
resources:
limits:
memory: "2Gi"
requests:
memory: "1Gi"
ports:
2018-02-16 13:46:20 +00:00
- name: tusd-web
containerPort: 8080
2018-07-10 22:21:57 +00:00
envFrom:
- configMapRef:
name: tusd-env
2018-01-06 15:53:24 +00:00
securityContext:
2018-01-11 23:58:59 +00:00
runAsUser: 0
fsGroup: 0
2018-01-06 15:53:24 +00:00
volumeMounts:
2018-07-10 22:21:57 +00:00
- name: tusd-account
mountPath: /gcs
2018-01-06 15:53:24 +00:00
volumes:
2018-07-10 22:21:57 +00:00
- name: tusd-account
secret:
secretName: gcs-account
2018-01-06 15:53:24 +00:00
---
apiVersion: v1
kind: Service
metadata:
name: tusd
namespace: tus
spec:
ports:
2018-02-16 13:46:20 +00:00
- name: tusd-web
port: 80
2018-01-06 15:53:24 +00:00
targetPort: 8080
protocol: TCP
selector:
app: tusd
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: tusd
namespace: tus
annotations:
2018-07-07 17:07:33 +00:00
certmanager.k8s.io/cluster-issuer: "letsencrypt-prod"
certmanager.k8s.io/acme-challenge-type: "http01"
2018-01-06 15:53:24 +00:00
kubernetes.io/tls-acme: "true"
kubernetes.io/ingress.class: "nginx"
2018-01-08 07:21:35 +00:00
nginx.ingress.kubernetes.io/proxy-body-size: 0m
2018-01-06 15:53:24 +00:00
nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
spec:
tls:
- hosts:
- tusd.tus.io
secretName: tusd-tls
- hosts:
- master.tus.io
secretName: master-tls
rules:
- host: tusd.tus.io
http:
paths:
- path: /
backend:
serviceName: tusd
servicePort: 80
- host: master.tus.io
http:
paths:
- path: /
backend:
serviceName: tusd
servicePort: 80
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: tusd
namespace: tus
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: tusd
minReplicas: 1
maxReplicas: 5
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 80
- type: Resource
resource:
name: memory
targetAverageValue: 1800Mi
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: cleaning-job
namespace: tus
spec:
schedule: "* * */1 * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: jobspod
image: gcr.io/transloadit-kubes/jobspod
command: ["/bin/bash", "-c"]
2018-06-11 20:25:10 +00:00
args: [ "kubectl exec --namespace tus $(kubectl get pods --namespace tus -l app=tusd -o go-template --template '{{range .items}}{{.metadata.name}}{{\"\\n\"}}{{end}}') -- /bin/sh -c \"find . -type f -mmin +1440 -print0 | xargs -n 200 -r -0 rm || true\""]
restartPolicy: OnFailure