-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
galaxy_info: | ||
role_name: tldraw-server | ||
author: Schul-Cloud Verbund | ||
description: tldraw-server | ||
company: Schul-Cloud Verbund | ||
license: license (AGPLv3) | ||
min_ansible_version: 2.8 | ||
galaxy_tags: [] | ||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
- name: TlDraw server Secret (from 1Password) | ||
kubernetes.core.k8s: | ||
kubeconfig: ~/.kube/config | ||
namespace: "{{ NAMESPACE }}" | ||
template: tldraw-server-onepassword.yml.j2 | ||
when: | ||
- ONEPASSWORD_OPERATOR is defined and ONEPASSWORD_OPERATOR|bool | ||
- WITH_TLDRAW is defined and WITH_TLDRAW|bool | ||
|
||
- name: TlDraw server deployment | ||
kubernetes.core.k8s: | ||
kubeconfig: ~/.kube/config | ||
namespace: "{{ NAMESPACE }}" | ||
template: tldraw-deployment.yml.j2 | ||
when: WITH_TLDRAW is defined and WITH_TLDRAW|bool | ||
|
||
- name: TlDraw server service | ||
kubernetes.core.k8s: | ||
kubeconfig: ~/.kube/config | ||
namespace: "{{ NAMESPACE }}" | ||
template: tldraw-server-svc.yml.j2 | ||
when: WITH_TLDRAW is defined and WITH_TLDRAW|bool | ||
|
||
- name: Tldraw ingress | ||
kubernetes.core.k8s: | ||
kubeconfig: ~/.kube/config | ||
namespace: "{{ NAMESPACE }}" | ||
template: tldraw-ingress.yml.j2 | ||
apply: yes | ||
when: WITH_TLDRAW is defined and WITH_TLDRAW|bool |
111 changes: 111 additions & 0 deletions
111
ansible/roles/tldraw-server/templates/tldraw-deployment.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: tldraw-deployment | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: tldraw-server | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ TLDRAW_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: tldraw-server | ||
app.kubernetes.io/component: tldraw | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ TLDRAW_SERVER_BRANCH_NAME }} | ||
git.repo: {{ TLDRAW_SERVER_REPO_NAME }} | ||
spec: | ||
replicas: {{ TLDRAW_SERVER_REPLICAS|default("1", true) }} | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxSurge: 1 | ||
#maxUnavailable: 1 | ||
revisionHistoryLimit: 4 | ||
paused: false | ||
selector: | ||
matchLabels: | ||
app: tldraw-server | ||
template: | ||
metadata: | ||
labels: | ||
app: tldraw-server | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ TLDRAW_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: tldraw-server | ||
app.kubernetes.io/component: tldraw | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ TLDRAW_SERVER_BRANCH_NAME }} | ||
git.repo: {{ TLDRAW_SERVER_REPO_NAME }} | ||
spec: | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
runAsNonRoot: true | ||
containers: | ||
- name: tldraw | ||
image: {{ TLDRAW_SERVER_IMAGE }}:{{ TLDRAW_SERVER_IMAGE_TAG }} | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- containerPort: 3345 | ||
name: tldraw-ws | ||
protocol: TCP | ||
- containerPort: 3349 | ||
name: tldraw-http | ||
protocol: TCP | ||
- containerPort: 9090 | ||
name: api-metrics | ||
protocol: TCP | ||
envFrom: | ||
- configMapRef: | ||
name: api-configmap | ||
- secretRef: | ||
name: api-secret | ||
- secretRef: | ||
name: tldraw-server-secret | ||
- secretRef: | ||
name: api-files-secret | ||
command: ['npm', 'run', 'nest:start:tldraw:prod'] | ||
resources: | ||
limits: | ||
cpu: {{ TLDRAW_EDITOR_CPU_LIMITS|default("2000m", true) }} | ||
memory: {{ TLDRAW_EDITOR_MEMORY_LIMITS|default("4Gi", true) }} | ||
requests: | ||
cpu: {{ TLDRAW_EDITOR_CPU_REQUESTS|default("100m", true) }} | ||
memory: {{ TLDRAW_EDITOR_MEMORY_REQUESTS|default("150Mi", true) }} | ||
{% if AFFINITY_ENABLE is defined and AFFINITY_ENABLE|bool %} | ||
affinity: | ||
podAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- weight: 9 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: app.kubernetes.io/part-of | ||
operator: In | ||
values: | ||
- schulcloud-verbund | ||
topologyKey: "kubernetes.io/hostname" | ||
namespaceSelector: {} | ||
podAntiAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
{% if ANIT_AFFINITY_NODEPOOL_ENABLE is defined and ANIT_AFFINITY_NODEPOOL_ENABLE|bool %} | ||
- weight: 10 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: app.kubernetes.io/name | ||
operator: In | ||
values: | ||
- tldraw-server | ||
topologyKey: {{ ANIT_AFFINITY_NODEPOOL_TOPOLOGY_KEY }} | ||
{% endif %} | ||
- weight: 20 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: app.kubernetes.io/name | ||
operator: In | ||
values: | ||
- tldraw-server | ||
topologyKey: "topology.kubernetes.io/zone" | ||
{% endif %} |
43 changes: 43 additions & 0 deletions
43
ansible/roles/tldraw-server/templates/tldraw-ingress.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ NAMESPACE }}-tldraw-ingress | ||
namespace: {{ NAMESPACE }} | ||
annotations: | ||
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" | ||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" | ||
nginx.ingress.kubernetes.io/proxy-body-size: "{{ INGRESS_MAX_BODY_SIZE|default("2560") }}m" | ||
nginx.org/client-max-body-size: "{{ INGRESS_MAX_BODY_SIZE|default("2560") }}m" | ||
# The following properties added with BC-3606. | ||
# The header size of the request is too big. For e.g. state and the permanent growing jwt. | ||
# Nginx throws away the Location header, resulting in the 502 Bad Gateway. | ||
nginx.ingress.kubernetes.io/client-header-buffer-size: 100k | ||
nginx.ingress.kubernetes.io/http2-max-header-size: 96k | ||
nginx.ingress.kubernetes.io/large-client-header-buffers: 4 100k | ||
nginx.ingress.kubernetes.io/proxy-buffer-size: 96k | ||
nginx.org/websocket-services: "tldraw-server-svc" | ||
{% if CLUSTER_ISSUER is defined %} | ||
cert-manager.io/cluster-issuer: {{ CLUSTER_ISSUER }} | ||
{% endif %} | ||
|
||
spec: | ||
ingressClassName: {{ INGRESS_CLASS }} | ||
{% if CLUSTER_ISSUER is defined or (TLS_ENABLED is defined and TLS_ENABLED|bool) %} | ||
tls: | ||
- hosts: | ||
- {{ DOMAIN }} | ||
{% if CLUSTER_ISSUER is defined %} | ||
secretName: {{ DOMAIN }}-tls | ||
{% endif %} | ||
{% endif %} | ||
rules: | ||
- host: {{ DOMAIN }} | ||
http: | ||
paths: | ||
- path: /tldraw-server | ||
backend: | ||
service: | ||
name: tldraw-server-svc | ||
port: | ||
number: 3345 | ||
pathType: Prefix |
9 changes: 9 additions & 0 deletions
9
ansible/roles/tldraw-server/templates/tldraw-server-onepassword.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: onepassword.com/v1 | ||
kind: OnePasswordItem | ||
metadata: | ||
name: tldraw-server-secret | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: tldraw-server | ||
spec: | ||
itemPath: "vaults/{{ ONEPASSWORD_OPERATOR_VAULT }}/items/tldraw-server" |
26 changes: 26 additions & 0 deletions
26
ansible/roles/tldraw-server/templates/tldraw-server-svc.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: tldraw-server-svc | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: tldraw-server | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
# port for WebSocket connection | ||
- port: 3345 | ||
targetPort: 3345 | ||
protocol: TCP | ||
name: tldraw-ws | ||
# port for http managing drawing data | ||
- port: 3349 | ||
targetPort: 3349 | ||
protocol: TCP | ||
name: tldraw-http | ||
- port: {{ PORT_METRICS_SERVER }} | ||
targetPort: 9090 | ||
protocol: TCP | ||
name: api-metrics | ||
selector: | ||
app: tldraw-server |