diff --git a/charts/eurofurence-registration-system/Chart.yaml b/charts/eurofurence-registration-system/Chart.yaml index 88ff2f8..5c6a221 100644 --- a/charts/eurofurence-registration-system/Chart.yaml +++ b/charts/eurofurence-registration-system/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: eurofurence-registration-system -version: 0.0.28 +version: 0.0.29 description: A helm chart that can deploy the Eurofurence Registration System. type: application home: https://github.com/eurofurence/reg-helm-chart diff --git a/charts/eurofurence-registration-system/templates/configmap.yaml b/charts/eurofurence-registration-system/templates/configmap.yaml index 84fd9e6..9871267 100644 --- a/charts/eurofurence-registration-system/templates/configmap.yaml +++ b/charts/eurofurence-registration-system/templates/configmap.yaml @@ -421,6 +421,75 @@ data: severity: {{ .Values.system.logging.severity }} style: {{ .Values.system.logging.style }} + room-service-config: | + # configuration file for room-service + service: + {{- if .Values.system.components.attendee_service.enable }} + attendee_service_url: '{{ .Values.system.components.attendee_service.local_base_url }}' + {{- end }} + {{- if .Values.system.components.auth_service.enable }} + auth_service_url: '{{ .Values.system.components.auth_service.local_base_url }}' + {{- end }} + {{- if .Values.system.components.mail_service.enable }} + mail_service_url: '{{ .Values.system.components.mail_service.local_base_url }}' + {{- end }} + join_link_base_url: '{{ .Values.system.components.room_service.join_link_base_url }}' + max_group_size: {{ .Values.system.components.room_service.max_group_size }} + {{- with .Values.system.components.room_service.group_flags }} + group_flags: {{- . | toYaml | nindent 8 }} + {{- end }} + {{- with .Values.system.components.room_service.room_flags }} + room_flags: {{- . | toYaml | nindent 8 }} + {{- end }} + server: + port: 8080 + read_timeout_seconds: 30 + write_timeout_seconds: 30 + idle_timeout_seconds: 120 + database: + use: '{{ .Values.system.database.use }}' + {{- if eq .Values.system.database.use "mysql" }} + username: '{{ .Values.system.database.username }}' + # password: '$REG_SECRET_DB_PASSWORD' + database: '{{ .Values.system.database.database }}' + {{- with .Values.system.database.parameters }} + parameters: + {{- range . }} + - '{{ . }}' + {{- end }} + {{- end }} + {{- end }} + security: + fixed_token: {} + # api: '$REG_SECRET_API_TOKEN' + oidc: + id_token_cookie_name: '{{ .Values.system.components.auth_service.id_token_cookie_name }}' + access_token_cookie_name: '{{ .Values.system.components.auth_service.access_token_cookie_name }}' + {{- with .Values.system.components.auth_service.token_public_keys_PEM }} + token_public_keys_PEM: {{- . | toYaml | nindent 8 }} + {{- end }} + admin_group: '{{ .Values.system.components.auth_service.admin_group_id }}' + {{- if .Values.system.components.auth_service.enable }} + auth_service: '{{ .Values.system.components.auth_service.local_base_url }}' + {{- end }} + {{- with .Values.system.components.auth_service.allowed_audience_in_tokens }} + audience: '{{ . }}' + {{- end }} + {{- with .Values.system.components.auth_service.allowed_issuer_in_tokens }} + issuer: '{{ . }}' + {{- end }} + cors: + disable: {{ .Values.development.cors.disable }} + {{- with .Values.development.cors.allow_origin }} + allow_origin: '{{ . }}' + {{- end }} + logging: + severity: {{ .Values.system.logging.severity }} + style: {{ .Values.system.logging.style }} + {{- with .Values.system.components.room_service.go_live }} + go_live: {{- . | toYaml | nindent 6 }} + {{- end }} + HTTPD_CONF_PATH_PREFIX_NO_SLASHES: '{{ .Values.system.public_base_context }}' HTTPD_CONF_SERVER_NAME: '{{ .Values.ingress.host }}' {{- if .Values.system.components.frontend.enable }} diff --git a/charts/eurofurence-registration-system/templates/deployments.yaml b/charts/eurofurence-registration-system/templates/deployments.yaml index 92b25ee..bd424a3 100644 --- a/charts/eurofurence-registration-system/templates/deployments.yaml +++ b/charts/eurofurence-registration-system/templates/deployments.yaml @@ -48,6 +48,16 @@ {{- template "helpers.deployment" $paySrvInput }} --- {{- end }} +{{- if .Values.system.components.room_service.enable }} +{{ $roomSrvInput := dict "name" "room-service" + "all" .Values + "component" .Values.system.components.room_service + "secrets" (list "REG_SECRET_DB_PASSWORD" "REG_SECRET_API_TOKEN") + "command" "/main" + "args" (list "--config=/config/config.yaml" "--migrate-database") -}} +{{- template "helpers.deployment" $roomSrvInput }} +--- +{{- end }} {{- if .Values.system.components.regsys_classic.enable }} {{ $classicInput := dict "name" "regsys-classic" "all" .Values diff --git a/charts/eurofurence-registration-system/templates/services.yaml b/charts/eurofurence-registration-system/templates/services.yaml index a44e0dc..2fb6e97 100644 --- a/charts/eurofurence-registration-system/templates/services.yaml +++ b/charts/eurofurence-registration-system/templates/services.yaml @@ -40,6 +40,13 @@ {{- template "helpers.service" $classicInput }} --- {{- end }} +{{- if .Values.system.components.room_service.enable }} +{{ $roomSrvInput := dict "name" "room-service" + "all" .Values + "component" .Values.system.components.room_service -}} +{{- template "helpers.service" $roomSrvInput }} +--- +{{- end }} {{- if .Values.system.components.onsite.enable }} {{ $onsiteInput := dict "name" "onsite" "all" .Values diff --git a/charts/eurofurence-registration-system/tests/configmap_test.yaml b/charts/eurofurence-registration-system/tests/configmap_test.yaml index 708804f..fa5e6ac 100644 --- a/charts/eurofurence-registration-system/tests/configmap_test.yaml +++ b/charts/eurofurence-registration-system/tests/configmap_test.yaml @@ -83,6 +83,16 @@ tests: iban: 'UK00100020003000400050' bic: 'AABBCCDDUK' subject_prefix: 'AWECON' + room_service: + enable: true + join_link_base_url: 'http://localhost:10000' + go_live: + public: + start_iso_datetime: 1995-06-30T11:11:11+02:00 + booking_code: Kaiser-Wilhelm-Koog + staff: + start_iso_datetime: 1995-06-29T11:11:11+02:00 + booking_code: Dithmarschen database: use: mysql choices: @@ -517,6 +527,64 @@ tests: logging: severity: INFO style: ecs + + - equal: + path: data.room-service-config + value: | + # configuration file for room-service + service: + attendee_service_url: 'http://attendee-service:8080' + auth_service_url: 'http://auth-service:8080' + mail_service_url: 'http://mail-service:8080' + join_link_base_url: 'http://localhost:10000' + max_group_size: 6 + group_flags: + - public + room_flags: + - handicapped + - final + server: + port: 8080 + read_timeout_seconds: 30 + write_timeout_seconds: 30 + idle_timeout_seconds: 120 + database: + use: 'mysql' + username: 'demouser' + # password: '$REG_SECRET_DB_PASSWORD' + database: 'tcp(localhost:3306)/dbname' + parameters: + - 'charset=utf8mb4' + - 'collation=utf8mb4_general_ci' + - 'parseTime=True' + - 'timeout=30s' + security: + fixed_token: {} + # api: '$REG_SECRET_API_TOKEN' + oidc: + id_token_cookie_name: 'JWT' + access_token_cookie_name: 'AUTH' + token_public_keys_PEM: + - | + -----BEGIN PUBLIC KEY----- + ABC + -----END PUBLIC KEY----- + admin_group: 'D1DQADM' + auth_service: 'http://auth-service:8080' + audience: 'aud-1234' + issuer: 'https://identity.example.com' + cors: + disable: false + logging: + severity: INFO + style: ecs + go_live: + public: + booking_code: Kaiser-Wilhelm-Koog + start_iso_datetime: "1995-06-30T11:11:11+02:00" + staff: + booking_code: Dithmarschen + start_iso_datetime: "1995-06-29T11:11:11+02:00" - equal: path: data.HTTPD_CONF_PATH_PREFIX_NO_SLASHES value: 'hello/you' diff --git a/charts/eurofurence-registration-system/tests/deployments_test.yaml b/charts/eurofurence-registration-system/tests/deployments_test.yaml index 2193af9..7a6748f 100644 --- a/charts/eurofurence-registration-system/tests/deployments_test.yaml +++ b/charts/eurofurence-registration-system/tests/deployments_test.yaml @@ -118,6 +118,8 @@ tests: memory: 4444Mi requests: memory: 1111Mi + room_service: + enable: true frontend: enable: true onsite: @@ -126,7 +128,7 @@ tests: - isKind: of: Deployment - hasDocuments: - count: 8 + count: 9 - equal: path: metadata value: @@ -521,6 +523,81 @@ tests: path: config.yaml mode: 0444 documentIndex: 4 + - equal: + path: metadata + value: + name: room-service + labels: + app: regsys + service: room-service + documentIndex: 5 + - equal: + path: spec + value: + replicas: 1 + revisionHistoryLimit: 3 + selector: + matchLabels: + app: regsys + service: room-service + template: + metadata: + labels: + app: regsys + service: room-service + spec: + containers: + - name: application + image: 'ghcr.io/eurofurence/reg-room-service:latest' + ports: + - containerPort: 8080 + name: primary + readinessProbe: + httpGet: + port: primary + path: / + initialDelaySeconds: 2 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + resources: + limits: + memory: 512Mi + requests: + memory: 64Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + command: [/main] + args: + - --config=/config/config.yaml + - --migrate-database + env: + - name: REG_SECRET_DB_PASSWORD + valueFrom: + secretKeyRef: + name: regsys-secret + key: REG_SECRET_DB_PASSWORD + - name: REG_SECRET_API_TOKEN + valueFrom: + secretKeyRef: + name: regsys-secret + key: REG_SECRET_API_TOKEN + volumeMounts: + - name: config-file + mountPath: /config + readOnly: true + volumes: + - name: config-file + configMap: + name: regsys-cm + items: + - key: room-service-config + path: config.yaml + mode: 0444 + documentIndex: 5 - equal: path: metadata value: @@ -528,7 +605,7 @@ tests: labels: app: regsys service: regsys-classic - documentIndex: 5 + documentIndex: 6 - equal: path: spec value: @@ -621,7 +698,7 @@ tests: - key: regsys-classic-config path: config.yaml mode: 0444 - documentIndex: 5 + documentIndex: 6 - equal: path: metadata value: @@ -629,7 +706,7 @@ tests: labels: app: regsys service: onsite - documentIndex: 6 + documentIndex: 7 - equal: path: spec value: @@ -679,7 +756,7 @@ tests: secretKeyRef: name: regsys-secret key: REG_SECRET_NOSECOUNTER_TOKEN - documentIndex: 6 + documentIndex: 7 - equal: path: metadata value: @@ -687,7 +764,7 @@ tests: labels: app: regsys service: frontend - documentIndex: 7 + documentIndex: 8 - equal: path: spec value: @@ -749,7 +826,7 @@ tests: configMapKeyRef: name: regsys-cm key: HTTPD_CONF_STATIC_DIR - documentIndex: 7 + documentIndex: 8 - it: should not set namespace if unset asserts: diff --git a/charts/eurofurence-registration-system/tests/services_test.yaml b/charts/eurofurence-registration-system/tests/services_test.yaml index e1f43a0..e039556 100644 --- a/charts/eurofurence-registration-system/tests/services_test.yaml +++ b/charts/eurofurence-registration-system/tests/services_test.yaml @@ -60,6 +60,8 @@ tests: enable: true regsys_classic: enable: true + room_service: + enable: true frontend: enable: true onsite: @@ -68,7 +70,7 @@ tests: - isKind: of: Service - hasDocuments: - count: 8 + count: 9 - equal: path: metadata value: @@ -195,6 +197,27 @@ tests: service: regsys-classic type: ClusterIP documentIndex: 5 + - equal: + path: metadata + value: + name: room-service + labels: + app: regsys + service: room-service + documentIndex: 6 + - equal: + path: spec + value: + ports: + - port: 8080 + appProtocol: http + name: application + targetPort: primary + selector: + app: regsys + service: room-service + type: ClusterIP + documentIndex: 6 - equal: path: metadata value: @@ -202,7 +225,7 @@ tests: labels: app: regsys service: onsite - documentIndex: 6 + documentIndex: 7 - equal: path: spec value: @@ -215,7 +238,7 @@ tests: app: regsys service: onsite type: ClusterIP - documentIndex: 6 + documentIndex: 7 - equal: path: metadata value: @@ -223,7 +246,7 @@ tests: labels: app: regsys service: frontend - documentIndex: 7 + documentIndex: 8 - equal: path: spec value: @@ -236,7 +259,7 @@ tests: app: regsys service: frontend type: ClusterIP - documentIndex: 7 + documentIndex: 8 - it: should not set namespace if unset asserts: - notExists: diff --git a/charts/eurofurence-registration-system/values-example.yaml b/charts/eurofurence-registration-system/values-example.yaml index 2ce491e..28e319c 100644 --- a/charts/eurofurence-registration-system/values-example.yaml +++ b/charts/eurofurence-registration-system/values-example.yaml @@ -150,6 +150,17 @@ system: bic: 'AABBCCDDUK' subject_prefix: 'AWECON' + room_service: + enable: true + join_link_base_url: 'http://localhost:10000' + go_live: + public: + booking_code: Kaiser-Wilhelm-Koog + start_iso_datetime: 1995-06-30T11:11:11+02:00 + staff: + booking_code: Dithmarschen + start_iso_datetime: 1995-06-29T11:11:11+02:00 + database: use: 'mysql' username: 'demouser' diff --git a/charts/eurofurence-registration-system/values.schema.json b/charts/eurofurence-registration-system/values.schema.json index 3c2680f..3b2f54b 100644 --- a/charts/eurofurence-registration-system/values.schema.json +++ b/charts/eurofurence-registration-system/values.schema.json @@ -884,6 +884,139 @@ } } }, + "room_service": { + "type": "object", + "additionalProperties": false, + "description": "system configuration for the room service", + "properties": { + "enable": { + "type": "boolean", + "description": "deploy the room service", + "default": "false" + }, + "join_link_base_url": { + "type": "string", + "description": "the base url to construct group join links from, with no trailing slash" + }, + "max_group_size": { + "type": "number", + "description": "the maximum size for roomshare groups", + "default": 6 + }, + "group_flags": { + "type": "array", + "description": "the list of available group flags", + "default": ["public"], + "items": { + "type": "string" + } + }, + "room_flags": { + "type": "array", + "description": "the list of available room flags", + "default": ["public"], + "items": { + "type": "string" + } + }, + "go_live": { + "type": "object", + "additionalProperties": false, + "description": "configuration for the mail lottery", + "properties": { + "public": { + "type": "object", + "additionalProperties": false, + "properties": { + "start_iso_datetime": { + "type": "string", + "description": "the time at which the booking code is revealed to the public", + "example": "1995-06-30T11:11:11+02:00" + }, + "booking_code": { + "type": "string", + "description": "the booking code for the public", + "example": "Kaiser-Wilhelm-Koog" + } + } + }, + "staff": { + "type": "object", + "additionalProperties": false, + "properties": { + "start_iso_datetime": { + "type": "string", + "description": "the time at which the booking code is revealed to members of the staff group", + "example": "1995-06-30T11:11:11+02:00" + }, + "booking_code": { + "type": "string", + "description": "the booking code for staff", + "example": "Kaiser-Wilhelm-Koog" + } + } + } + } + }, + "docker": { + "type": "object", + "additionalProperties": false, + "description": "container source configuration", + "properties": { + "registry": { + "type": "string", + "description": "the container registry to pull from", + "default": "ghcr.io" + }, + "repository": { + "type": "string", + "description": "the path within the registry", + "default": "eurofurence/reg-payment-service" + }, + "tag": { + "type": "string", + "description": "the version tag, unless overridden in the individual component.", + "default": "latest" + } + } + }, + "labels": { + "type": "object", + "additionalProperties": true + }, + "replicas": { + "type": "integer", + "minValue": 1, + "maxValue": 1, + "description": "number of replicas to start - currently the auth service uses an in-memory flow cache, so only 1 replica is supported at the moment", + "default": 1 + }, + "limits": { + "type": "object", + "additionalProperties": false, + "properties": { + "memory": { + "type": "string", + "description": "amount of maximum memory before getting OOM-killed", + "example": "512Mi", + "default": "512Mi" + } + } + }, + "requests": { + "type": "object", + "additionalProperties": false, + "properties": { + "memory": { + "type": "string", + "description": "amount of memory reserved for the container", + "example": "64Mi", + "default": "64Mi" + } + } + } + } + }, "frontend": { "type": "object", "additionalProperties": false, diff --git a/charts/eurofurence-registration-system/values.yaml b/charts/eurofurence-registration-system/values.yaml index ed84a67..34dc090 100644 --- a/charts/eurofurence-registration-system/values.yaml +++ b/charts/eurofurence-registration-system/values.yaml @@ -129,6 +129,26 @@ system: requests: memory: 256Mi + room_service: + enable: false + max_group_size: 6 + group_flags: + - public + room_flags: + - handicapped + - final + docker: + registry: ghcr.io + repository: eurofurence/reg-room-service + tag: latest + labels: + service: room-service + replicas: 1 + limits: + memory: 512Mi + requests: + memory: 64Mi + frontend: enable: true docker: