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

[loki-distributed] manage compactor as statefulset #2747

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

rasta-rocket
Copy link
Contributor

Hey there !

Small contribution here to allow users of the chart to manage the compactor as a statefulset

⚠️ Also I draw you attention on the fact that in the values.yaml I set the compactor field Kind as Statefulset starting now : this might break existing setup. I did that since Statefulset is kind of the default way to manage stateful software in k8s IMHO, but let me know what you think about it 😉

If you have any question, do not hesitate to reach me 😉

Cheers ☀️

@rasta-rocket rasta-rocket force-pushed the loki_compactor_sts branch 4 times, most recently from 8f094b9 to 5c210b9 Compare October 28, 2023 22:56
@zanhsieh
Copy link
Collaborator

zanhsieh commented Nov 9, 2023

@zalegrala
Can you review this please?

Copy link
Contributor

@verejoel verejoel left a comment

Choose a reason for hiding this comment

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

This will introduce bugs if the compactor PVC is disabled which needs to be addressed, also please fix the copy-paste error.

- name: runtime-config
configMap:
name: {{ template "loki.fullname" . }}-runtime
{{- if not .Values.ingester.persistence.enabled }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy paste error

Suggested change
{{- if not .Values.ingester.persistence.enabled }}
{{- if not .Values.compactor.persistence.enabled }}

{{- with .Values.compactor.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs a guard here in case persistence is not enabled or the list of volume claims is empty.

@rasta-rocket
Copy link
Contributor Author

@verejoel I have updated the code according to your review

@zalegrala
Copy link
Contributor

Thanks for the PR. What's the motivation to manage the compactor as a statefulset? Is this the recommendation from Loki?

@rasta-rocket
Copy link
Contributor Author

Hello @zalegrala 👋

I did that for two reasons:

  • Statefulset is kind of the default way to manage stateful software in k8s
  • When doing rolling update on deployment + pvc, the rolling is not well managed most of the time, because you need to detach the PV from the deployment N manually before deployment N+1 arrives (because you have concurrent access on the volume) : which result in a helm deployment that fails. That issue never occurs with an STS.

The recommendation from loki is to have that component to be stateful (they do not mention statefulset or deployment + pvc)

Cheers ☀️

@zalegrala
Copy link
Contributor

Ah okay, I didn't realize the compactor was stateful but I suppose this makes sense since if the client doesn't stream.

@zanhsieh zanhsieh merged commit adac294 into grafana:main Dec 20, 2023
6 checks passed
jfcoz added a commit to jfcoz/grafana-helm-charts that referenced this pull request Dec 23, 2023
boltdb.shipper.compactor.working-directory was missing in grafana#2747

Signed-off-by: Julien Francoz <[email protected]>
jfcoz added a commit to jfcoz/grafana-helm-charts that referenced this pull request Dec 31, 2023
boltdb.shipper.compactor.working-directory was missing in grafana#2747

Signed-off-by: Julien Francoz <[email protected]>
jfcoz added a commit to jfcoz/grafana-helm-charts that referenced this pull request Jan 13, 2024
boltdb.shipper.compactor.working-directory was missing in grafana#2747

Signed-off-by: Julien Francoz <[email protected]>
jfcoz added a commit to jfcoz/grafana-helm-charts that referenced this pull request Jan 16, 2024
boltdb.shipper.compactor.working-directory was missing in grafana#2747

Signed-off-by: Julien Francoz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants