diff --git a/src/frontend/apps/impress/.env.production b/src/frontend/apps/impress/.env.production index 744e8928..5e9c0b70 100644 --- a/src/frontend/apps/impress/.env.production +++ b/src/frontend/apps/impress/.env.production @@ -1,2 +1,2 @@ NEXT_PUBLIC_API_URL=https://impress-staging.beta.numerique.gouv.fr/api/v1.0/ -NEXT_PUBLIC_SIGNALING_URL=ws://localhost:4444 \ No newline at end of file +NEXT_PUBLIC_SIGNALING_URL=wss://impress-staging.beta.numerique.gouv.fr/ws diff --git a/src/helm/env.d/dev/values.impress.yaml.gotmpl b/src/helm/env.d/dev/values.impress.yaml.gotmpl index 7a7fe32f..d399d95e 100644 --- a/src/helm/env.d/dev/values.impress.yaml.gotmpl +++ b/src/helm/env.d/dev/values.impress.yaml.gotmpl @@ -51,6 +51,7 @@ frontend: envVars: PORT: 8080 NEXT_PUBLIC_API_URL: https://impress.127.0.0.1.nip.io/api/v1.0/ + NEXT_PUBLIC_SIGNALING_URL: wss://impress.127.0.0.1.nip.io/ws replicas: 1 command: @@ -62,6 +63,14 @@ frontend: pullPolicy: Always tag: "latest" +webrtc: + replicas: 1 + + image: + repository: localhost:5001/impress-y-webrtc-signaling + pullPolicy: Always + tag: "latest" + ingress: enabled: true host: impress.127.0.0.1.nip.io diff --git a/src/helm/env.d/staging/values.impress.yaml.gotmpl b/src/helm/env.d/staging/values.impress.yaml.gotmpl index 28805836..8f568127 100644 --- a/src/helm/env.d/staging/values.impress.yaml.gotmpl +++ b/src/helm/env.d/staging/values.impress.yaml.gotmpl @@ -68,21 +68,18 @@ backend: name: redis.redis.libre.sh key: url - migrate: - command: - - "/bin/sh" - - "-c" - - | - python manage.py migrate --no-input && - python manage.py create_demo --force - restartPolicy: Never - frontend: image: repository: lasuite/impress-frontend pullPolicy: Always tag: "main" +webrtc: + image: + repository: lasuite/impress-y-webrtc-signaling + pullPolicy: Always + tag: "main" + ingress: enabled: true host: impress-staging.beta.numerique.gouv.fr diff --git a/src/helm/impress/templates/_helpers.tpl b/src/helm/impress/templates/_helpers.tpl index b09d8c37..7295dd2f 100644 --- a/src/helm/impress/templates/_helpers.tpl +++ b/src/helm/impress/templates/_helpers.tpl @@ -148,6 +148,15 @@ Requires top level scope {{ include "impress.fullname" . }}-frontend {{- end }} +{{/* +Full name for the webrtc + +Requires top level scope +*/}} +{{- define "impress.webrtc.fullname" -}} +{{ include "impress.fullname" . }}-webrtc +{{- end }} + {{/* Usage : {{ include "impress.secret.dockerconfigjson.name" (dict "fullname" (include "impress.fullname" .) "imageCredentials" .Values.path.to.the.image1) }} */}} diff --git a/src/helm/impress/templates/ingress.yaml b/src/helm/impress/templates/ingress.yaml index aecc5977..2385e772 100644 --- a/src/helm/impress/templates/ingress.yaml +++ b/src/helm/impress/templates/ingress.yaml @@ -46,6 +46,24 @@ spec: - host: {{ .Values.ingress.host | quote }} http: paths: + - path: /ws + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: ImplementationSpecific + {{- end }} + backend: + service: + name: {{ include "impress.webrtc.fullname" . }} + port: + number: {{ .Values.webrtc.service.port }} + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ include "impress.webrtc.fullname" . }} + port: + number: {{ .Values.webrtc.service.port }} + {{- else }} + serviceName: {{ include "impress.webrtc.fullname" . }} + servicePort: {{ .Values.webrtc.service.port }} + {{- end }} - path: {{ .Values.ingress.path | quote }} {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} pathType: Prefix diff --git a/src/helm/impress/templates/webrtc_deployment.yaml b/src/helm/impress/templates/webrtc_deployment.yaml new file mode 100644 index 00000000..2a34fc7b --- /dev/null +++ b/src/helm/impress/templates/webrtc_deployment.yaml @@ -0,0 +1,136 @@ +{{- $envVars := include "impress.common.env" (list . .Values.webrtc) -}} +{{- $fullName := include "impress.webrtc.fullname" . -}} +{{- $component := "webrtc" -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "impress.common.labels" (list . $component) | nindent 4 }} +spec: + replicas: {{ .Values.webrtc.replicas }} + selector: + matchLabels: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 6 }} + template: + metadata: + annotations: + {{- with .Values.webrtc.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 8 }} + spec: + {{- if $.Values.image.credentials }} + imagePullSecrets: + - name: {{ include "impress.secret.dockerconfigjson.name" (dict "fullname" (include "impress.fullname" .) "imageCredentials" $.Values.image.credentials) }} + {{- end}} + shareProcessNamespace: {{ .Values.webrtc.shareProcessNamespace }} + containers: + {{- with .Values.webrtc.sidecars }} + {{- toYaml . | nindent 8 }} + {{- end }} + - name: {{ .Chart.Name }} + image: "{{ (.Values.webrtc.image | default dict).repository | default .Values.image.repository }}:{{ (.Values.webrtc.image | default dict).tag | default .Values.image.tag }}" + imagePullPolicy: {{ (.Values.webrtc.image | default dict).pullPolicy | default .Values.image.pullPolicy }} + {{- with .Values.webrtc.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.webrtc.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + env: + {{- if $envVars}} + {{- $envVars | indent 12 }} + {{- end }} + {{- with .Values.webrtc.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.webrtc.service.targetPort }} + protocol: TCP + {{- if .Values.webrtc.probes.liveness }} + livenessProbe: + {{- include "impress.probes.abstract" (merge .Values.webrtc.probes.liveness (dict "targetPort" .Values.webrtc.service.targetPort )) | nindent 12 }} + {{- end }} + {{- if .Values.webrtc.probes.readiness }} + readinessProbe: + {{- include "impress.probes.abstract" (merge .Values.webrtc.probes.readiness (dict "targetPort" .Values.webrtc.service.targetPort )) | nindent 12 }} + {{- end }} + {{- if .Values.webrtc.probes.startup }} + startupProbe: + {{- include "impress.probes.abstract" (merge .Values.webrtc.probes.startup (dict "targetPort" .Values.webrtc.service.targetPort )) | nindent 12 }} + {{- end }} + {{- with .Values.webrtc.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- range $index, $value := .Values.mountFiles }} + - name: "files-{{ $index }}" + mountPath: {{ $value.path }} + subPath: content + {{- end }} + {{- range $name, $volume := .Values.webrtc.persistence }} + - name: "{{ $name }}" + mountPath: "{{ $volume.mountPath }}" + {{- end }} + {{- range .Values.webrtc.extraVolumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} + {{- end }} + {{- with .Values.webrtc.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.webrtc.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.webrtc.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- range $index, $value := .Values.mountFiles }} + - name: "files-{{ $index }}" + configMap: + name: "{{ include "impress.fullname" $ }}-files-{{ $index }}" + {{- end }} + {{- range $name, $volume := .Values.webrtc.persistence }} + - name: "{{ $name }}" + {{- if eq $volume.type "emptyDir" }} + emptyDir: {} + {{- else }} + persistentVolumeClaim: + claimName: "{{ $fullName }}-{{ $name }}" + {{- end }} + {{- end }} + {{- range .Values.webrtc.extraVolumes }} + - name: {{ .name }} + {{- if .existingClaim }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- else if .hostPath }} + hostPath: + {{ toYaml .hostPath | nindent 12 }} + {{- else if .csi }} + csi: + {{- toYaml .csi | nindent 12 }} + {{- else if .configMap }} + configMap: + {{- toYaml .configMap | nindent 12 }} + {{- else if .emptyDir }} + emptyDir: + {{- toYaml .emptyDir | nindent 12 }} + {{- else }} + emptyDir: {} + {{- end }} + {{- end }} diff --git a/src/helm/impress/templates/webrtc_svc.yaml b/src/helm/impress/templates/webrtc_svc.yaml new file mode 100644 index 00000000..c1322141 --- /dev/null +++ b/src/helm/impress/templates/webrtc_svc.yaml @@ -0,0 +1,21 @@ +{{- $envVars := include "impress.common.env" (list . .Values.webrtc) -}} +{{- $fullName := include "impress.webrtc.fullname" . -}} +{{- $component := "webrtc" -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "impress.common.labels" (list . $component) | nindent 4 }} + annotations: + {{- toYaml $.Values.webrtc.service.annotations | nindent 4 }} +spec: + type: {{ .Values.webrtc.service.type }} + ports: + - port: {{ .Values.webrtc.service.port }} + targetPort: {{ .Values.webrtc.service.targetPort }} + protocol: TCP + name: http + selector: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 4 }} diff --git a/src/helm/impress/values.yaml b/src/helm/impress/values.yaml index 451e01da..e39945f7 100644 --- a/src/helm/impress/values.yaml +++ b/src/helm/impress/values.yaml @@ -48,6 +48,9 @@ ingress: ## @param ingress.customBackends Add custom backends to ingress customBackends: [] + annotations: + nginx.ingress.kubernetes.io/enable-websocket: "true" + ## @param ingressAdmin.enabled whether to enable the Ingress or not ## @param ingressAdmin.className IngressClass to use for the Ingress ## @param ingressAdmin.host Host for the Ingress @@ -262,3 +265,97 @@ frontend: ## @param frontend.extraVolumes Additional volumes to mount on the frontend. extraVolumes: [] + +## @section webrtc + +webrtc: + ## @param webrtc.image.repository Repository to use to pull impress's webrtc container image + ## @param webrtc.image.tag impress's webrtc container tag + ## @param webrtc.image.pullPolicy webrtc container image pull policy + image: + repository: lasuite/impress-y-webrtc-signaling + pullPolicy: IfNotPresent + tag: "latest" + + ## @param webrtc.command Override the webrtc container command + command: [] + + ## @param webrtc.args Override the webrtc container args + args: [] + + ## @param webrtc.replicas Amount of webrtc replicas + replicas: 3 + + ## @param webrtc.shareProcessNamespace Enable share process namewebrtc between containers + shareProcessNamespace: false + + ## @param webrtc.sidecars Add sidecars containers to webrtc deployment + sidecars: [] + + ## @param webrtc.securityContext Configure webrtc Pod security context + securityContext: null + + ## @param webrtc.envVars Configure webrtc container environment variables + ## @extra webrtc.envVars.BY_VALUE Example environment variable by setting value directly + ## @extra webrtc.envVars.FROM_CONFIGMAP.configMapKeyRef.name Name of a ConfigMap when configuring env vars from a ConfigMap + ## @extra webrtc.envVars.FROM_CONFIGMAP.configMapKeyRef.key Key within a ConfigMap when configuring env vars from a ConfigMap + ## @extra webrtc.envVars.FROM_SECRET.secretKeyRef.name Name of a Secret when configuring env vars from a Secret + ## @extra webrtc.envVars.FROM_SECRET.secretKeyRef.key Key within a Secret when configuring env vars from a Secret + ## @skip webrtc.envVars + envVars: + <<: *commonEnvVars + + ## @param webrtc.podAnnotations Annotations to add to the webrtc Pod + podAnnotations: {} + + ## @param webrtc.service.type webrtc Service type + ## @param webrtc.service.port webrtc Service listening port + ## @param webrtc.service.targetPort webrtc container listening port + ## @param webrtc.service.annotations Annotations to add to the webrtc Service + service: + type: ClusterIP + port: 443 + targetPort: 4444 + annotations: {} + + ## @param webrtc.probes Configure probe for webrtc + ## @extra webrtc.probes.liveness.path Configure path for webrtc HTTP liveness probe + ## @extra webrtc.probes.liveness.targetPort Configure port for webrtc HTTP liveness probe + ## @extra webrtc.probes.liveness.initialDelaySeconds Configure initial delay for webrtc liveness probe + ## @extra webrtc.probes.liveness.initialDelaySeconds Configure timeout for webrtc liveness probe + ## @extra webrtc.probes.startup.path Configure path for webrtc HTTP startup probe + ## @extra webrtc.probes.startup.targetPort Configure port for webrtc HTTP startup probe + ## @extra webrtc.probes.startup.initialDelaySeconds Configure initial delay for webrtc startup probe + ## @extra webrtc.probes.startup.initialDelaySeconds Configure timeout for webrtc startup probe + ## @extra webrtc.probes.readiness.path Configure path for webrtc HTTP readiness probe + ## @extra webrtc.probes.readiness.targetPort Configure port for webrtc HTTP readiness probe + ## @extra webrtc.probes.readiness.initialDelaySeconds Configure initial delay for webrtc readiness probe + ## @extra webrtc.probes.readiness.initialDelaySeconds Configure timeout for webrtc readiness probe + probes: + liveness: + path: /ping + initialDelaySeconds: 10 + + ## @param webrtc.resources Resource requirements for the webrtc container + resources: {} + + ## @param webrtc.nodeSelector Node selector for the webrtc Pod + nodeSelector: {} + + ## @param webrtc.tolerations Tolerations for the webrtc Pod + tolerations: [] + + ## @param webrtc.affinity Affinity for the webrtc Pod + affinity: {} + + ## @param webrtc.persistence Additional volumes to create and mount on the webrtc. Used for debugging purposes + ## @extra webrtc.persistence.volume-name.size Size of the additional volume + ## @extra webrtc.persistence.volume-name.type Type of the additional volume, persistentVolumeClaim or emptyDir + ## @extra webrtc.persistence.volume-name.mountPath Path where the volume should be mounted to + persistence: {} + + ## @param webrtc.extraVolumeMounts Additional volumes to mount on the webrtc. + extraVolumeMounts: [] + + ## @param webrtc.extraVolumes Additional volumes to mount on the webrtc. + extraVolumes: [] \ No newline at end of file