Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
refactor: Adds Postgres Manifests and removes Postgres Helm Chart dep…
Browse files Browse the repository at this point in the history
…endency (#151)
  • Loading branch information
Abhi94N authored Aug 4, 2021
1 parent 76a85f6 commit 281c80b
Show file tree
Hide file tree
Showing 11 changed files with 314 additions and 215 deletions.
158 changes: 81 additions & 77 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion charts/illumidesk/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ dependencies:
repository: https://helm.datadoghq.com
version: 2.4.29
digest: sha256:8ff385253e4da471c090ed77f7febc47988d0dabe39cb23ce2c2d2ccc481de85
generated: "2021-07-23T16:16:57.7629705-04:00"
generated: "2021-08-03T19:41:28.0238575-04:00"
2 changes: 1 addition & 1 deletion charts/illumidesk/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: illumidesk
version: 5.4.2
version: 5.5.0
appVersion: 1.2.0
description: An extention of the JupyterHub chart with additional IllumiDesk resources
icon: https://configs.illumidesk.com/images/illumidesk-80.png
Expand Down
58 changes: 0 additions & 58 deletions charts/illumidesk/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,61 +29,3 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- end }}

{{/*
Return the Database hostname
*/}}
{{- define "database.host" -}}
{{- if .Values.postgresql.enabled }}
{{- printf "%s-%s.%s.%s" .Release.Namespace "postgresql" .Release.Namespace "svc.cluster.local" -}}
{{- else if .Values.externaldb.enabled }}
{{- printf "%s" .Values.externaldb.host -}}
{{- end -}}
{{- end -}}


{{/*
Return the Database port
*/}}
{{- define "database.port" -}}
{{- if .Values.postgresql.enabled }}
{{- printf "5432" | quote -}}
{{- else -}}
{{- .Values.externalDatabase.port | quote -}}
{{- end -}}
{{- end -}}

{{/*
Return the Database database name
*/}}
{{- define "database.name" -}}
{{- if .Values.postgresql.enabled }}
{{- printf "%s" .Values.postgresql.postgresqlDatabase -}}
{{- else -}}
{{- printf "%s" .Values.externalDatabase.database -}}
{{- end -}}
{{- end -}}

{{/*
Return the Database user
*/}}
{{- define "database.databaseUser" -}}
{{- if .Values.postgresql.enabled }}
{{- printf "%s" .Values.postgresql.postgresqlUsername -}}
{{- else -}}
{{- printf "%s" .Values.externalDatabase.username -}}
{{- end -}}
{{- end -}}

{{/*
Return the Database encrypted password
*/}}
{{- define "database.databaseEncryptedPassword" -}}
{{- if .Values.postgresql.enabled }}
{{- .Values.postgresql.postgresqlPassword | b64enc | quote -}}
{{- else -}}
{{- .Values.externalDatabase.password | b64enc | quote -}}
{{- end -}}
{{- end -}}



9 changes: 8 additions & 1 deletion charts/illumidesk/templates/grader_setup_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ spec:
name: hub-illumidesk-cm
key: POSTGRES_NBGRADER_USER
- name: POSTGRES_NBGRADER_PASSWORD
value: {{ .Values.graderSetupService.postgresNBGraderPassword | default "illumidesk" }}
valueFrom:
secretKeyRef:
{{ if .Values.externalDatabase.enabled }}
name: {{ .Values.externalDatabase.existingSecret }}
{{ else if .Values.postgresql.enabled }}
name: {{ .Values.postgresql.existingSecret }}
{{ end }}
key: postgresql-password
- name: ILLUMIDESK_MNT_ROOT
value: '/illumidesk-courses'
- name: PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
ORGANIZATION_NAME: {{ .Release.Namespace }}
OIDC_AUTHORIZE_URL: {{ .Values.illumideskSettings.oidcAuthorizeUrl | default "https://auth.illumidesk.com/authorize" | quote }}
OIDC_TOKEN_URL: {{ .Values.illumideskSettings.oidcTokenUrl | default "https://auth.illumidesk.com/authorize" | quote }}
OIDC_USERDATA_URL: {{ .Values.illumideskSettings.oidcUserData | default "https://auth.illumidesk.com/userinfo" | quote }}
OIDC_USERDATA_URL: {{ .Values.illumideskSettings.oidcUserDataUrl | default "https://auth.illumidesk.com/userinfo" | quote }}
OIDC_CLIENT_ID: {{ .Values.illumideskSettings.oidcClientId | default "127000000008" | quote }}
OIDC_CLIENT_SECRET: {{ .Values.illumideskSettings.oidcClientSecret | default "127000008" | quote }}
OIDC_CALLBACK_URL: {{ .Values.illumideskSettings.oidcCallbackUrl | default "http://localhost:8000/hub/oauth_callback" | quote }}
Expand All @@ -19,16 +19,21 @@ data:
LTI13_ENDPOINT: {{ .Values.illumideskSettings.lti13Endpoint | default "https://illumidesk.instructure.com/api/lti/security/jwks" | quote }}
LTI13_AUTHORIZE_URL: {{ .Values.illumideskSettings.lti13AuthorizeUrl | default "https://illumidesk.instructure.com/api/lti/authorize_redirect" | quote }}
LTI13_TOKEN_URL: {{ .Values.illumideskSettings.lti13TokenUrl | default "https://illumidesk.instructure.com/login/oauth2/token" | quote }}
POSTGRES_NBGRADER_USER: {{ .Values.illumideskSettings.postgresUser | default "postgres" | quote }}
POSTGRES_JUPYTERHUB_USER: {{ .Values.illumideskSettings.postgresUser | default "postgres" | quote }}
{{ if hasKey .Values.illumideskSettings "postgresHost" }}
POSTGRES_NBGRADER_HOST: {{ .Values.illumideskSettings.postgresHost | quote }}
POSTGRES_JUPYTERHUB_HOST: {{ .Values.illumideskSettings.postgresHost | quote }}
{{ else }}
{{ if .Values.externalDatabase.enabled }}
POSTGRES_NBGRADER_HOST: {{ .Values.externalDatabase.host | quote }}
POSTGRES_JUPYTERHUB_HOST: {{ .Values.externalDatabase.host | quote }}
POSTGRES_JUPYTERHUB_DB: {{ .Values.externalDatabase.database | quote }}
POSTGRES_JUPYTERHUB_PORT: {{ .Values.externalDatabase.port | quote }}
POSTGRES_NBGRADER_USER: {{ .Values.externalDatabase.databaseUser | quote }}
POSTGRES_JUPYTERHUB_USER: {{ .Values.externalDatabase.databaseUser | quote }}
{{ else if .Values.postgresql.enabled }}
POSTGRES_NBGRADER_HOST: "{{.Release.Namespace }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local"
POSTGRES_JUPYTERHUB_HOST: "{{ .Release.Namespace }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local"
POSTGRES_JUPYTERHUB_DB: {{ .Values.postgresql.postgresqlDatabase | quote }}
POSTGRES_JUPYTERHUB_PORT: {{ .Values.postgresql.service.port | quote }}
POSTGRES_NBGRADER_USER: {{ .Values.postgresql.postgresqlUsername | quote }}
POSTGRES_JUPYTERHUB_USER: {{ .Values.postgresql.postgresqlUsername | quote }}
{{ end }}
POSTGRES_JUPYTERHUB_DB: {{ .Values.illumideskSettings.postgresDB | default "illumidesk" | quote }}
POSTGRES_JUPYTERHUB_PORT: {{ .Values.illumideskSettings.postgresPort | default "5432" | quote }}


{{ end }}
15 changes: 15 additions & 0 deletions charts/illumidesk/templates/illumidesk-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{ if .Values.illumideskSettings.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: illumidesk-secret
namespace: {{ .Release.Namespace }}
type: Opaque
stringData:
{{ if .Values.externalDatabase.enabled }}
postgresql-password: {{ .Values.externalDatabase.databasePassword }}
{{ else if .Values.postgresql.enabled }}
postgresql-password: {{ .Values.postgresql.postgresqlPassword }}
{{ end }}

{{ end }}
84 changes: 49 additions & 35 deletions charts/illumidesk/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ jupyterhub:
configMapKeyRef:
name: hub-illumidesk-cm # The ConfigMap this value comes from.
key: JUPYTERHUB_API_URL
# Mount Root
ILLUMIDESK_MNT_ROOT: "/illumidesk-courses"
# OIDC Authorize URL
OIDC_AUTHORIZE_URL:
valueFrom:
Expand Down Expand Up @@ -109,7 +107,6 @@ jupyterhub:
configMapKeyRef:
name: hub-illumidesk-cm # The ConfigMap this value comes from.
key: LTI_CONSUMER_KEY
LTI13_PRIVATE_KEY: "/srv/jupyterhub/rsa_private.key"
LTI13_CLIENT_ID:
valueFrom:
configMapKeyRef:
Expand Down Expand Up @@ -160,6 +157,9 @@ jupyterhub:
configMapKeyRef:
name: hub-illumidesk-cm # The ConfigMap this value comes from.
key: POSTGRES_JUPYTERHUB_DB
LTI13_PRIVATE_KEY: "/srv/jupyterhub/rsa_private.key"
# Mount Root
ILLUMIDESK_MNT_ROOT: "/illumidesk-courses"
extraConfig:
# The logo that appears on the top right of the control panel and end-user notebooks with Jupyter Classic.
logoConfig: |
Expand All @@ -173,7 +173,6 @@ jupyterhub:
from oauthenticator.generic import GenericOAuthenticator
custom_auth_type = os.environ.get('CUSTOM_AUTH_TYPE')
c.JupyterHub.hub_connect_ip = 'hub'
if custom_auth_type == 'LTI13':
c.JupyterHub.authenticator_class = 'illumidesk.authenticators.authenticator.LTI13Authenticator'
Expand Down Expand Up @@ -268,18 +267,12 @@ jupyterhub:
import os
import z2jh
custom_auth_type = os.environ.get('CUSTOM_AUTH_TYPE')
if custom_auth_type != 'AUTH0':
c.JupyterHub.services.append({
'name': 'announcement',
'admin': True,
'url': 'http://0.0.0.0:8889',
'command': ["python3", "/etc/jupyterhub-services/announcement.py", "--port", "8889", "--api-prefix", "/services/announcement"],
'api_token': os.environ.get("JUPYTERHUB_API_TOKEN") })
# load extra grader services launched from grader-setup service
services_resp = requests.get('http://grader-setup-service.{}.svc.cluster.local:8000/services'.format(os.environ.get('ORGANIZATION_NAME')))
services_resp = services_resp.json()
c.JupyterHub.load_groups.update(services_resp['groups'])
c.JupyterHub.services.extend(services_resp['services'])
org_name = os.environ.get('ORGANIZATION_NAME')
# load extra grader services launched from grader-setup service
services_resp = requests.get('http://grader-setup-service.{}.svc.cluster.local:8000/services'.format(org_name))
services_resp = services_resp.json()
c.JupyterHub.load_groups.update(services_resp['groups'])
c.JupyterHub.services.extend(services_resp['services'])
# The JupyterHub docker image
Expand Down Expand Up @@ -355,11 +348,32 @@ postgresql:
# Provide Postgresql username
postgresqlUsername: postgres
# Provide Postgresql password if username is not defined, the default username will have this password
postgresqlPostgresPassword: 'postgres123'
postgresqlPostgresPassword: postgres123
# Provide Postgresql password
postgresqlPassword: 'postgres123'
postgresqlPassword: postgres123
# Provide in cluster database name
postgresqlDatabase: 'illumidesk'
postgresqlDatabase: illumidesk
# Default existing secret name for postgres passwords
existingSecret: 'illumidesk-secret'
# Database Server Port
service:
port: 5432

externalDatabase:
# Enables or disables configuration of external Database
enabled: false
# Default existing secret name for external database password passwords
existingSecret: 'illumidesk-secret'
# Host name for external database
host: ''
# Provide external database name
database: illumidesk
# Database Server Port
port: 5432
# Database user
databaseUser: postgres
# Database password
databasePassword: postgres123

## DatadogHQ Agent
## https://github.com/DataDog/helm-charts/tree/master/charts/datadog
Expand Down Expand Up @@ -467,38 +481,38 @@ illumideskSettings:
# Enables or disables the illumidesk settings options
enabled: true
# The custom authentication type. Should be one of DUMMY, LTI11, LTI13, or AUTH0.
custom_auth_type: ""
# Internal JupyterHub API URL
jupyterhub_api_url: ""
customAuthType: "DUMMY"
# OIDC authorization URL
oidc_authorize_url: ""
oidcAuthorizeUrl: ""
# OIDC token URL
oidc_token_url: ""
oidcTokenUrl: ""
# OIDC userdata URL
oidc_userdata_url: ""
oidcUserData: ""
# OIDC client id
oidc_client_id: ""
oidcClientId: ""
# OIDC client secret
oidc_client_secret: ""
oidcClientSecret: ""
# OIDC callback URL
oidc_callback_url: ""
oidcCallbackUrl: ""
# LTI v1.1 consumer key
lti_consumer_key: ""
ltiConsumerKey: ""
# LTI v1.3 client id
lti13_client_id: ""
lti13ClientId: ""
# LTI v1.3 endpoint URL
lti13_endpoint: ""
lti13Endpoint: ""
# LTI v1.3 authorization URL
lti13_authorization_url: ""
lti13AuthorizeUrl: ""
# LTI v1.3 token URL
lti13_token_url: ""
lti13TokenUrl: ""
# Postgres host endpoint. If set, both the nbgrader database and the JupyterHub database
# will use this Postgres host.
postgresHost: ""
# Postgres nbgrader username
postgres_nbgrader_user: ""
postgresGraderUser: "postgres"
# Postgres JupyterHub username
postgres_jupyterhub_user: ""
postgresHubUser: "postgres"
# external Database Server Host Name
externalHost: ""
## Grader setup service
##
graderSetupService:
Expand Down
Binary file added docs/illumidesk-5.1.0.tgz
Binary file not shown.
Binary file added docs/illumidesk-5.5.0.tgz
Binary file not shown.
Loading

0 comments on commit 281c80b

Please sign in to comment.