-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: loki schema config management #1224
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validated all scenarios locally, lgtm! nice work
Are there any upgrade scenarios we need to run for this? Also should we do a docs update on the what/why for doing this and how to override? |
In some cases, you may want to **disable a specific storage type** or manually override the schema configuration. To do so, remove the automated upgrade portion of the values.yaml: | ||
|
||
```yaml | ||
- from: "{{- $secret := lookup \"v1\" \"Secret\" \"loki\" \"loki\" -}} | ||
{{- $pastDate := now | dateModify \"-48h\" | date \"2006-01-02\" -}} | ||
{{- $futureDate := now | dateModify \"+48h\" | date \"2006-01-02\" -}} | ||
{{- $result := $pastDate -}} | ||
{{- if $secret -}} | ||
{{- $result = $futureDate -}} | ||
{{- if (index $secret.data \"config.yaml\") -}} | ||
{{- $configYAML := (index $secret.data \"config.yaml\" | b64dec | fromYaml) -}} | ||
{{- range $configYAML.schema_config.configs -}} | ||
{{- if and (eq .store \"tsdb\") (eq .schema \"v13\") -}} | ||
{{- $result = .from -}} | ||
{{- break -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- $result -}}" | ||
store: tsdb | ||
object_store: "{{ .Values.loki.storage.type }}" | ||
schema: v13 | ||
index: | ||
prefix: loki_index_ | ||
period: 24h | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be documented as an override
for a bundle since that is the main way an end user would be interacting with this. I think this is the right syntax but probably good to validate:
- name: core
repository: ghcr.io/defenseunicorns/packages/uds/core
ref: x.x.x
overrides:
loki:
loki:
values:
# Setting this value will override the default auto-lookup behavior
- path: loki.schemaConfig.configs
value:
# Self-manage configs here, making sure to include any previous dates you used
- from: 2022-01-11
store: boltdb-shipper
object_store: "{{ .Values.loki.storage.type }}"
schema: v12
index:
prefix: loki_index_
period: 24h
# Example: Explicitly set a date for TSDB and the v13 schema, making sure this is in the future
- from: 2025-03-25
store: tsdb
object_store: "{{ .Values.loki.storage.type }}"
schema: v13
index:
prefix: loki_index_
period: 24h
### Forcing an Upgrade with Immediate Schema Change | ||
If you want to transition immediately to a new storage type without waiting for the automatic 48-hour logic, modify the Helm chart values by explicitly setting the schema configuration in `values.yaml`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might also be helpful to have an example override for. Would also maybe link to the upstream docs on changing the schema and specifically call out the nuances around making sure the date is in the future (and specifically future with timezones): https://grafana.com/docs/loki/latest/operations/storage/schema/#changing-the-schema
Description
Feature to manage the loki schemaConfig date and version transitions with helm only changes.
Walk through of what the helm is doing:
Related Issue
Fixes #782
Type of change
Steps to Validate
uds run dev-setup
npx pepr deploy
uds run dev-deploy --set LAYER=logging
uds run dev-deploy --set LAYER=logging
uds run dev-deploy --set LAYER=logging
uds run dev-deploy --set LAYER=logging
uds run dev-deploy --set LAYER=logging
Checklist before merging