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

Adds Postgres Manifests and removes Postgres Helm Chart dependency #151

Merged
merged 20 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 68 additions & 76 deletions README.md

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions charts/illumidesk/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@ dependencies:
- name: jupyterhub
repository: https://jupyterhub.github.io/helm-chart/
version: 1.1.1
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 10.1.3
- name: datadog
repository: https://helm.datadoghq.com
version: 2.4.29
digest: sha256:8ff385253e4da471c090ed77f7febc47988d0dabe39cb23ce2c2d2ccc481de85
generated: "2021-07-23T16:16:57.7629705-04:00"
digest: sha256:3f778029736d1524b19e111361cbdcb1a8f424567a702ed3dee6bdf26559e26e
generated: "2021-07-30T17:47:50.7961998-04:00"
10 changes: 1 addition & 9 deletions 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 All @@ -11,14 +11,6 @@ dependencies:
import-values:
- child: rbac
parent: rbac
- name: postgresql
version: "10.1.3"
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: datadog
version: "2.4.29"
repository: https://helm.datadoghq.com
condition: datadog.enabled
maintainers:
- name: IllumiDesk Team
email: [email protected]
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 -}}



7 changes: 5 additions & 2 deletions charts/illumidesk/templates/grader_setup_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ spec:
configMapKeyRef:
name: hub-illumidesk-cm
key: POSTGRES_NBGRADER_USER
- name: POSTGRES_NBGRADER_PASSWORD
value: {{ .Values.graderSetupService.postgresNBGraderPassword | default "illumidesk" }}
- name: NBGRADER_PASSWORD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our graderservice source code only understands POSTGRES_NBGRADER_PASSWORD.

valueFrom:
secretKeyRef:
name: hub-illumidesk-secret # The ConfigMap this value comes from.
key: NBGRADER_PASSWORD
- name: ILLUMIDESK_MNT_ROOT
value: '/illumidesk-courses'
- name: PORT
Expand Down
16 changes: 8 additions & 8 deletions charts/illumidesk/templates/hub-config-map.yaml
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,14 +19,14 @@ 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 }}
POSTGRES_NBGRADER_USER: {{ .Values.illumideskSettings.postgresGraderUser | default "postgres" | quote }}
POSTGRES_JUPYTERHUB_USER: {{ .Values.illumideskSettings.postgresHubUser | default "postgres" | quote }}
{{ if hasKey .Values.illumideskSettings "externalHost" }}
POSTGRES_NBGRADER_HOST: {{ .Values.illumideskSettings.externalHost | quote }}
POSTGRES_JUPYTERHUB_HOST: {{ .Values.illumideskSettings.externalHost | quote }}
{{ else }}
POSTGRES_NBGRADER_HOST: "{{.Release.Namespace }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local"
POSTGRES_JUPYTERHUB_HOST: "{{ .Release.Namespace }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local"
POSTGRES_NBGRADER_HOST: "postgres-{{.Release.Namespace }}.{{ .Release.Namespace }}.svc.cluster.local"
POSTGRES_JUPYTERHUB_HOST: "postgres-{{ .Release.Namespace }}.{{ .Release.Namespace }}.svc.cluster.local"
{{ end }}
POSTGRES_JUPYTERHUB_DB: {{ .Values.illumideskSettings.postgresDB | default "illumidesk" | quote }}
POSTGRES_JUPYTERHUB_PORT: {{ .Values.illumideskSettings.postgresPort | default "5432" | quote }}
Expand Down
15 changes: 15 additions & 0 deletions charts/illumidesk/templates/hub-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: hub-illumidesk-secret
namespace: {{ .Release.Namespace }}
type: Opaque
stringData:
JUPYTERHUB_API_TOKEN: {{ .Values.illumideskSettings.jupyterhubAPIToken | default "" | b64enc | quote }}
JUPYTERHUB_CRYPT_KEY: {{ .Values.illumideskSettings.jupyterhubCryptKey | default "" | b64enc | quote }}
POSTGRES_JUPYTERHUB_PASSWORD: {{ .Values.illumideskSettings.postgresHubPassword | default "postgres" | quote}}
NBGRADER_PASSWORD: {{ .Values.illumideskSettings.postgresGraderPassword | default "postgres" | quote}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, we should change this value to POSTGRES_NBGRADER_PASSWORD in all locations (secrets and cm's).

LTI_SHARED_SECRET: {{ .Values.illumideskSettings.ltiSharedSecret | default "" | b64enc | quote }}
OIDC_CLIENT_SECRET: {{ .Values.illumideskSettings.oidcClientSecret | default "" | b64enc | quote }}
{{ end }}
74 changes: 74 additions & 0 deletions charts/illumidesk/templates/postgres_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{ if not (hasKey .Values.illumideskSettings "externalHost") }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres-{{ .Release.Namespace }}
namespace: {{ .Release.Namespace }}
labels:
app: postgres-{{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: postgres-{{ .Release.Namespace }}
replicas: 1
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: postgres-{{ .Release.Namespace }}
spec:
containers:
- name: postgres
image: postgres:10.4
resources:
requests:
cpu: 100m
memory: 100Mi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove requests values and set limits to have an upper bound limit. We should also surface these settings in our values.yaml and update the README.md with these options.

limits:
cpu: 100m
memory: 100Mi
env:
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: hub-illumidesk-cm
key: POSTGRES_JUPYTERHUB_DB
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
name: hub-illumidesk-cm
key: POSTGRES_NBGRADER_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: hub-illumidesk-secret
key: NBGRADER_PASSWORD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to POSTGRES_NBGRADER_PASSWORD.

ports:
- containerPort: 5432
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: postgredb
volumes:
- name: postgredb
persistentVolumeClaim:
claimName: postgres-pv-claim-{{ .Release.Namespace }}
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: postgres-{{ .Release.Namespace }}
labels:
app: postgres-{{ .Release.Namespace }}
spec:
type: ClusterIP
ports:
- port: 5432
selector:
app: postgres-{{ .Release.Namespace }}

{{ end }}
32 changes: 32 additions & 0 deletions charts/illumidesk/templates/postgres_pv_and_pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{ if not (hasKey .Values.illumideskSettings "externalHost") }}
kind: PersistentVolume
apiVersion: v1
metadata:
name: postgres-pv-volume-{{.Release.Namespace }}
labels:
type: local
app: postgres
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/mnt/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: postgres-pv-claim-{{.Release.Namespace }}
labels:
app: postgres
spec:
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi

{{ end }}
Loading