Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setup wizard values #6

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
17 changes: 15 additions & 2 deletions templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ kind: ConfigMap
metadata:
name: {{ include "grader-api.fullname" . }}
data:
{{- toYaml .Values.config.data | nindent 2 }}
# This Helm template iterates through the data in the `config.data` section of the values.
# It checks each key-value pair to determine if the value is a map AND has the attribute type: "secret".
# If it is not, then it will include it from the configmap here.
{{- range $key, $value := .Values.config.data }}
{{- if or (ne (kindOf $value) "map") (ne $value.type "secret") }}
{{- if eq (kindOf $value) "map" }}
{{- $key | nindent 2 }}: {{ toYaml $value.value }}
{{ else }}
{{- $key | nindent 2 }}: {{ toYaml $value }}
{{- end }}
{{- end }}
{{- end }}
POSTGRES_HOST: {{ printf "%s%s" (include "grader-api.fullname" .) "-postgresql" }}
{{- end }}
SETUP_WIZARD_DATA: |
Hoid marked this conversation as resolved.
Show resolved Hide resolved
{{ toJson .Values.config.setup_wizard | nindent 4 }}
{{- end }}
14 changes: 14 additions & 0 deletions templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "grader-api.fullname" . }}
data:
MY_SECRET: FOOBAR
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be like that? FOOBAR, and committed to the repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to be a debugging thing that I never removed. It's not actually used anywhere. Should probably delete it...

# This Helm template iterates through the data in the `config.data` section of the values.
# It checks each key-value pair to determine if the value is a map AND has the attribute type: "secret".
# If it is, then it will include it here as its base64 encoded representation.
{{- range $key, $value := .Values.config.data }}
{{- if and (eq (kindOf $value) "map") (eq $value.type "secret") }}
{{- $key | nindent 2 }}: {{ toYaml $value.value | b64enc }}
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,33 @@ config:
enabled: true
secrets:
postgresql: grader-api-postgresql
# NOTE: setup-wizard values will only be used one time.
# After these are used for the first time, changing them will not do anything.
setup_wizard:
course:
name: COMP555
instructors:
- onyen: testinstructor
first_name: test
last_name: instructor
email: [email protected]
- onyen: foobar
first_name: foo
last_name: bar
email: [email protected]
data:
DEV_PHASE: "dev"
POSTGRES_PORT: "5432"
POSTGRES_DB: "postgres"
POSTGRES_USER: "postgres"
LDAP_HOST: "ldap.unc.edu"
LDAP_PORT: 636
LDAP_SERVICE_ACCOUNT_BIND_DN: "cn=unc:app:renci:eduhelx,ou=Applications,dc=unc,dc=edu"
LDAP_SERVICE_ACCOUNT_PASSWORD:
type: secret
value: ""
LDAP_TIMEOUT_SECONDS: 5


postgresql:
auth:
Expand Down