-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implement a deployment for the BoardCollaboration-WebSocket-Server. * initial commit * add configuration for board collaboration websocket uri --------- Co-authored-by: Thomas Feldtkeller <[email protected]>
- Loading branch information
1 parent
ee13aaa
commit 247ab0d
Showing
17 changed files
with
266 additions
and
42 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
10 changes: 10 additions & 0 deletions
10
ansible/roles/schulcloud-server-core/templates/board-collaboration-configmap.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,10 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: board-collaboration-configmap | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: board-collaboration | ||
data: | ||
NEST_LOG_LEVEL: "{{ NEST_LOG_LEVEL }}" | ||
EXIT_ON_ERROR: "true" |
106 changes: 106 additions & 0 deletions
106
ansible/roles/schulcloud-server-core/templates/board-collaboration-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,106 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: board-collaboration-deployment | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: board-collaboration | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: board-collaboration | ||
app.kubernetes.io/component: server | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
spec: | ||
replicas: {{ BOARD_COLLABORATION_SERVER_REPLICAS|default("1", true) }} | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxSurge: 1 | ||
#maxUnavailable: 1 | ||
revisionHistoryLimit: 4 | ||
paused: false | ||
selector: | ||
matchLabels: | ||
app: board-collaboration | ||
template: | ||
metadata: | ||
labels: | ||
app: board-collaboration | ||
app.kubernetes.io/part-of: schulcloud-verbund | ||
app.kubernetes.io/version: {{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
app.kubernetes.io/name: board-collaboration | ||
app.kubernetes.io/component: board-collaboration | ||
app.kubernetes.io/managed-by: ansible | ||
git.branch: {{ SCHULCLOUD_SERVER_BRANCH_NAME }} | ||
git.repo: {{ SCHULCLOUD_SERVER_REPO_NAME }} | ||
spec: | ||
securityContext: | ||
runAsUser: 1000 | ||
runAsGroup: 1000 | ||
fsGroup: 1000 | ||
runAsNonRoot: true | ||
containers: | ||
- name: board-collaboration | ||
image: {{ SCHULCLOUD_SERVER_IMAGE }}:{{ SCHULCLOUD_SERVER_IMAGE_TAG }} | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- containerPort: 4450 | ||
name: websocket | ||
protocol: TCP | ||
# - containerPort: 9090 | ||
# name: api-metrics | ||
# protocol: TCP | ||
envFrom: | ||
- configMapRef: | ||
name: api-configmap | ||
- configMapRef: | ||
name: board-collaboration-configmap | ||
- secretRef: | ||
name: api-secret | ||
command: ['npm', 'run', 'nest:start:board-collaboration:prod'] | ||
resources: | ||
limits: | ||
cpu: {{ BOARD_COLLABORATION_CPU_LIMITS|default("2000m", true) }} | ||
memory: {{ BOARD_COLLABORATION_MEMORY_LIMITS|default("2Gi", true) }} | ||
requests: | ||
cpu: {{ BOARD_COLLABORATION_CPU_REQUESTS|default("100m", true) }} | ||
memory: {{ BOARD_COLLABORATION_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: | ||
- board-collaboration | ||
topologyKey: {{ ANIT_AFFINITY_NODEPOOL_TOPOLOGY_KEY }} | ||
{% endif %} | ||
- weight: 20 | ||
podAffinityTerm: | ||
labelSelector: | ||
matchExpressions: | ||
- key: app.kubernetes.io/name | ||
operator: In | ||
values: | ||
- board-collaboration | ||
topologyKey: "topology.kubernetes.io/zone" | ||
{% endif %} |
43 changes: 43 additions & 0 deletions
43
ansible/roles/schulcloud-server-core/templates/board-collaboration-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: board-collaboration-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: "board-collaboration-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: /board-collaboration | ||
backend: | ||
service: | ||
name: board-collaboration-svc | ||
port: | ||
number: 4450 | ||
pathType: Prefix |
21 changes: 21 additions & 0 deletions
21
ansible/roles/schulcloud-server-core/templates/board-collaboration-service.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,21 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: board-collaboration-svc | ||
namespace: {{ NAMESPACE }} | ||
labels: | ||
app: board-collaboration | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
# port for WebSocket connection | ||
- port: 4450 | ||
targetPort: 4450 | ||
protocol: TCP | ||
name: websocket | ||
#- port: {{ PORT_METRICS_SERVER }} | ||
# targetPort: 9090 # TODO | ||
# protocol: TCP | ||
# name: api-metrics | ||
selector: | ||
app: board-collaboration |
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
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
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
Oops, something went wrong.