Skip to content

Commit

Permalink
feat(feedbacksystem): allow external digital classroom integration (#44)
Browse files Browse the repository at this point in the history
* feat(feedbacksystem): allow external digital classroom integration

* chore(feedbacksystem): bump version to 0.8.0

* style(feedbacksystem): add additional space before comment

* fix(feedbacksystem): apply mysql configuration without custom values
  • Loading branch information
Zitrone44 authored Feb 14, 2023
1 parent 4c2f9ab commit 750fdc2
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 58 deletions.
2 changes: 1 addition & 1 deletion charts/feedbacksystem/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sources:
- https://github.com/thm-mni-ii/feedbacksystem
home: https://github.com/thm-mni-ii/feedbacksystem
type: application
version: 0.7.2
version: 0.8.0
# renovate: image=thmmniii/fbs-core
appVersion: v1.5.1
dependencies:
Expand Down
22 changes: 15 additions & 7 deletions charts/feedbacksystem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ There is a [Deno](https://deno.land) script to generate the configuration file f
| core.config.ldap.attributeNames.name | The name of the ldap attribute to use as the first name | givenName |
| core.config.ldap.attributeNames.mail | The name of the ldap attribute to use as the user mail | mail |

#### (External) Digital Classroom

| Parameter | Description | Default |
| ----------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------- |
| core.config.digitalClassroom.url | The URL of the external classroom to use (Overwritten if digitalClassroom.enabled) | https://bbb.feedback.example.org |
| core.config.digitalClassroom.secret | The secret of the external digital classroom to use (Overwritten if digitalClassroom.enabled) | 1234 |

#### Runner

| Parameter | Description | Default |
Expand All @@ -73,13 +80,14 @@ There is a [Deno](https://deno.land) script to generate the configuration file f

#### Digital Classroom

| Parameter | Description | Default |
| ---------------------------------- | -------------------------------------------------- | -------------------------------- |
| digitalClassroom.enabled | Should the Container be Enabled | true |
| digitalClassroom.config.jwtSecret | The Used JWT Secret for the Digital Classroom | 2edb8793d987389e1626918e0ec1dbee |
| digitalClassroom.config.secret | Secret used to interact with the Digital Classroom | 1f2a08f5dbd81580a6fb0f645dce3737 |
| digitalClassroom.config.bbb.url | Url to the BigBlueButton Sever that should be used | https://bbb.example.org |
| digitalClassroom.config.bbb.secret | Secret for the Configured BigBlueButton Server | 1234 |
| Parameter | Description | Default |
| ---------------------------------- | ------------------------------------------------------------ | -------------------------------- |
| digitalClassroom.enabled | Should the Container be Enabled | false |
| digitalClassroom.config.jwtSecret | The Used JWT Secret for the Digital Classroom | 2edb8793d987389e1626918e0ec1dbee |
| digitalClassroom.config.secret | Secret used to interact with the Digital Classroom | 1f2a08f5dbd81580a6fb0f645dce3737 |
| digitalClassroom.config.bbb.url | URL to the BigBlueButton Sever that should be used | https://bbb.example.org |
| digitalClassroom.config.bbb.secret | Secret for the Configured BigBlueButton Server | 1234 |
| digitalClassroom.config.path | The Path under which the digital classroom will be available | /digitalclassroom |

#### Mysql

Expand Down
33 changes: 17 additions & 16 deletions charts/feedbacksystem/generate-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,12 @@ function buildValues(): any {
password: randomHex(),
rootPassword: randomHex(),
},
primary: {
existingConfigmap: `${name}-mysql-config`,
},
},
runnerMysql: {
auth: {
password: randomHex(),
rootPassword: randomHex(),
},
primary: {
existingConfigmap: `${name}-mysql-config`,
},
},
runnerPostgres: {
auth: {
Expand Down Expand Up @@ -77,16 +71,23 @@ function buildValues(): any {
},
};

if (confirm("Enable digital classroom:")) {
values.digitalClassroom.enabled = true;
values.digitalClassroom.config = {
jwtSecret: randomHex(),
secret: randomHex(),
bbb: {
url: prompt("Enter BBB Url:"),
bbb: prompt("Enter BBB secret:"),
},
};
if (confirm("Configure digital classroom:")) {
const internal = confirm("Launch internal digital classroom:");
if (internal) {
values.digitalClassroom.config = {
jwtSecret: randomHex(),
secret: randomHex(),
bbb: {
url: prompt("Enter BBB Url:"),
secret: prompt("Enter BBB Secret:"),
},
};
} else {
values.core.config.digitalClassroom = {
url: prompt("Enter Classroom Url:"),
secret: prompt("Enter Classroom Secret:"),
};
}
}

return { namespace, name, values };
Expand Down
16 changes: 16 additions & 0 deletions charts/feedbacksystem/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,19 @@
{{- define "fbs-runner-image" -}}
{{ print .Values.runner.image.registry "/" .Values.runner.image.name ":" (default .Chart.AppVersion .Values.runner.image.tag) }}
{{- end -}}

{{- define "digital-classroom-url" -}}
{{- if .Values.digitalClassroom.enabled -}}
{{ print (include "host" .) .Values.digitalClassroom.config.path }}
{{- else -}}
{{ .Values.core.config.digitalClassroom.url }}
{{- end -}}
{{- end -}}

{{- define "digital-classroom-secret" -}}
{{- if .Values.digitalClassroom.enabled -}}
{{ .Values.digitalClassroom.config.secret }}
{{- else -}}
{{ .Values.core.config.digitalClassroom.secret }}
{{- end -}}
{{- end -}}
23 changes: 13 additions & 10 deletions charts/feedbacksystem/templates/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ spec:
secretKeyRef:
name: {{ .Release.Name }}-core
key: jwtSecret
{{ if .Values.digitalClassroom.enabled }}
- name: CLASSROOM_URL
value: http://{{ .Release.Name }}-digital-classroom:8055
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-core
key: classroomUrl
- name: CLASSROOM_SECRET
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-digital-classroom
key: secret
{{ end }}
name: {{ .Release.Name }}-core
key: classroomSecret
- name: CLASSROOM_TLS_INSECURE
value: "true"
{{ if .Values.runner.enabled }}
Expand Down Expand Up @@ -192,18 +193,20 @@ kind: ConfigMap
metadata:
name: {{ .Release.Name }}-core
data:
mysqlJdbclUri: {{ print "jdbc:mysql://" .Release.Name "-mysql" ":3306" }}
mysqlUser: {{ .Values.mysql.auth.username }}
minioUrl: {{ print "http://" .Release.Name "-minio" }}
mysqlJdbclUri: {{ print "jdbc:mysql://" .Release.Name "-mysql" ":3306" | quote }}
mysqlUser: {{ .Values.mysql.auth.username | quote }}
minioUrl: {{ print "http://" .Release.Name "-minio" | quote }}
classroomUrl: {{ include "digital-classroom-url" . | quote }}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ .Release.Name }}-core
data:
jwtSecret: {{ .Values.core.config.jwtSecret | b64enc }}
mysqlPassword: {{ .Values.mysql.auth.password | b64enc }}
jwtSecret: {{ .Values.core.config.jwtSecret | b64enc | quote }}
mysqlPassword: {{ .Values.mysql.auth.password | b64enc | quote }}
classroomSecret: {{ include "digital-classroom-secret" . | b64enc | quote }}
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand Down
36 changes: 18 additions & 18 deletions charts/feedbacksystem/templates/digital-classroom.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
{{ if and .Values.digitalClassroom.enabled }}
{{ if and .Values.digitalClassroom.enabled .Values.digitalClassroom.internal }}
apiVersion: v1
kind: ConfigMap
type: Opaque
metadata:
name: {{ .Release.Name }}-digital-classroom
data:
upstreamUrl: {{ .Values.digitalClassroom.config.bbb.url | quote }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-digital-classroom
data:
jwtSecret: {{ .Values.digitalClassroom.config.jwtSecret | b64enc }}
secret: {{ .Values.digitalClassroom.config.secret | b64enc }}
upstreamSecret: {{ .Values.digitalClassroom.config.bbb.secret | b64enc }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -59,23 +76,6 @@ spec:
memory: {{ .Values.digitalClassroom.resources.memory.limit }}
---
apiVersion: v1
kind: ConfigMap
type: Opaque
metadata:
name: {{ .Release.Name }}-digital-classroom
data:
upstreamUrl: {{ .Values.digitalClassroom.config.bbb.url }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-digital-classroom
data:
jwtSecret: {{ .Values.digitalClassroom.config.jwtSecret | b64enc }}
secret: {{ .Values.digitalClassroom.config.secret | b64enc }}
upstreamSecret: {{ .Values.digitalClassroom.config.bbb.secret | b64enc }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-digital-classroom
Expand Down
2 changes: 1 addition & 1 deletion charts/feedbacksystem/templates/mysql-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ data:
slow_query_log_file=/opt/bitnami/mysql/logs/mysqld.log
long_query_time=10.0
sql-mode=""
skip-log-bin=true
skip-log-bin=true
[client]
port=3306
Expand Down
14 changes: 9 additions & 5 deletions charts/feedbacksystem/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ core:
sn: "sn"
name: "givenName"
mail: "mail"
digitalClassroom: # Overwritten if digitalClassroom.enabled
url: "https://bbb.feedback.example.org"
secret: "1234"
ingress:
enabled: true

Expand Down Expand Up @@ -89,7 +92,7 @@ runner:
limit: "4Gi"

digitalClassroom:
enabled: true
enabled: false
image:
registry: ghcr.io
name: thm-mni-ii/digital-classroom
Expand All @@ -105,6 +108,7 @@ digitalClassroom:
config:
jwtSecret: "2edb8793d987389e1626918e0ec1dbee" # CHANGE ME
secret: "1f2a08f5dbd81580a6fb0f645dce3737" # CHANGE ME
path: "/digitalclassroom"
bbb:
url: "https://bbb.example.org"
secret: "1234"
Expand All @@ -116,8 +120,8 @@ mysql:
password: fbs # CHANGE ME
rootPassword: root # CHANGE ME
createDatabase: true
primray:
existingConfigmap: 'CHANGE-ME'
primary:
existingConfigmap: '{{ .Release.Name }}-mysql-config'

runnerMysql:
nameOverride: runner-mysql
Expand All @@ -126,8 +130,8 @@ runnerMysql:
username: fbs
password: fbs # CHANGE ME
rootPassword: root # CHANGE ME
primray:
existingConfigmap: 'CHANGE-ME'
primary:
existingConfigmap: '{{ .Release.Name }}-mysql-config'

runnerPostgres:
nameOverride: runner-postgres
Expand Down

0 comments on commit 750fdc2

Please sign in to comment.