Skip to content

Commit

Permalink
feat: tpl identitySchemas files (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
dro-sh authored Sep 8, 2022
1 parent f74f226 commit 8b73de3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
36 changes: 35 additions & 1 deletion docs/helm/kratos.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $ helm install -f ./path/to/kratos-config.yaml ory/kratos

## Helm Chart Configuration

For the full list of chart values, please refer to the [Ory Kratos Helm Chart README](https://github.com/ory/k8s/tree/master/helm/charts/kratos), or the [values.yaml](https://github.com/ory/k8s/blob/master/helm/charts/kratos/values.yaml) directly
For the full list of chart values, please refer to the [Ory Kratos Helm Chart README](https://github.com/ory/k8s/tree/master/helm/charts/kratos), or the [values.yaml](https://github.com/ory/k8s/blob/master/helm/charts/kratos/values.yaml) directly

Additionally, the following extra settings are available:

Expand Down Expand Up @@ -96,6 +96,40 @@ secret:
> details please take a look
> [here](https://github.com/ory/k8s/blob/master/helm/charts/kratos/templates/secrets.yaml#L15).
### Identity Schemas

There are two options to provide identity schemas as file (consider, Kratos expects `user.schema.json`):

1. Write json to `kratos.identitySchemas`:

```yaml
kratos:
identitySchemas:
user.schema.json: |-
{
"$id": "..."
}
```
2. Pass file using `--set-file` Helm CLI argument:

Firstly, set file to `<your-key>`:

```bash
helm install kratos ory/kratos \
--values "/your/values" \
--set-file <your-key>=/path/to/user.schema.json
```

Next use it on `kratos.identitySchemas`:

```yaml
kratos:
identitySchemas:
user.schema.json: |-
{{ .Values.<your-key> }}
```

## Upgrade

### From `0.18.0`
Expand Down
4 changes: 2 additions & 2 deletions helm/charts/kratos/templates/configmap-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ data:
"kratos.yaml": |
{{- include "kratos.configmap" . | nindent 4 }}
# Render the identity schemas to disk:
{{- with .Values.kratos.identitySchemas }}
{{- toYaml . | nindent 2 }}
{{- range $key, $value := .Values.kratos.identitySchemas }}
{{- printf "%s: %s" $key (toYaml (tpl $value $)) | nindent 2 }}
{{- end }}
6 changes: 4 additions & 2 deletions helm/charts/kratos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ kratos:
# -- Configure the way to execute database migration. Possible values: job, initContainer
# When set to job, the migration will be executed as a job on release or upgrade.
# When set to initContainer, the migration will be executed when kratos pod is created
# Defaults to job
# Defaults to job
type: job
# -- Ability to override the entrypoint of the automigration container
# (e.g. to source dynamic secrets or export environment dynamic variables)
Expand All @@ -123,7 +123,7 @@ kratos:
# - kratos
customArgs: []

# -- You can add multiple identity schemas here
# -- You can add multiple identity schemas here. You can pass JSON schema using `--set-file` Helm CLI argument.
identitySchemas: {}
# identitySchemas:
# "identity.default.schema.json": |
Expand All @@ -134,6 +134,8 @@ kratos:
# {
# // ...
# }
# "identity.phone.schema.json": |
# {{ .Values.phone_schema }}

# -- You can customize the emails kratos is sending (also uncomment config.courier.template_override_path below)
emailTemplates: {}
Expand Down

0 comments on commit 8b73de3

Please sign in to comment.