-
Notifications
You must be signed in to change notification settings - Fork 707
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 Support for volumeClaimTemplates for Logstash controller #6884
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.
I am testing the PVC. When I delete Logstash kubectl delete logstash logstash-sample
, the PVCs do not get deleted, instead, show the status Bound
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
elasticsearch-data-monitoring-es-default-0 Terminating pvc-b584f2d8-f506-435e-aa9b-9382366ffadc 1Gi RWO standard 12m
logstash-data-logstash-sample-ls-0 Bound pvc-b1ee74e6-b9a8-4a13-8fb2-bce88b3b1484 1Gi RWO standard 3m7s
PVC of Elasticsearch is gone. I think Logstash needs to clean up as well.
I tried to update Edit: this is the same as the description.volumeClaimTemplates
to 2Gi
in logstash.yml
. The PVC doesn't get updated and there is no error but stays in 1Gi
. I need to delete PVC manually and re-apply logstash.yml
to have 2Gi
. Is this expected?
The rest of the suggestions are about naming.
It may likely make sense to implement the same behaviour than for ES where user can control if the volumes need to be deleted or preserved on Logstash deletion? Check elastic.co/guide/cloud-on-k8s/k8s-volume-claim-templates.html, and:
|
Our use case is slightly different from Elasticsearch, I think - deleting persistent volumes has a more profound effect if PQ/DLQ is used, as we do not replicate data, and deleting volume(s) may delete in-flight data if the queues were not drained. The use of PQ/DLQ with clusters that automatically scale down has some potentially interesting side effects, that we need to think about how we go about, and how we document their use. We need to avoid scaling down where logstash pods that are still draining data from their PQs/DLQs - and avoid deleting volumes that still have PQ (or DLQ) data. One thing we may consider is suggesting (or automatically setting) I know we'll need to create some good documentation on how to use volumes with Logstash depending on use case along the lines of the docs for storage recommendations that the Elasticsearch operator has |
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.
Code LGTM. One thing I believe we need to do here is to set a securityContext
with fsGroup: 1000
to make the data volume writeable for Logstash otherwise it won't be able to start.
Volume expansion maybe similar to what we do for Elasticsearch would indeed be a nice addition to this, especially given that there is no work around other than deleting the StatefulSet. In ES users can just create a new node set with more storage if needed or if their storage class does not support extension.
I have applied your feedbacks.
It is ready for another round of reviews. Manifests to test Testing the validation error updating a PV storage size:
A flaw of being conservative with the PVs is that if you create a Logstash, delete it and then recreate it with a PVC storage size different, the PVC/PV are not recreated. |
buildkite test this -f p=gke,E2E_TAGS=logstash -m s=8.8.0,s=8.9.0-SNAPSHOT 🟢 # 8.9.0-SHAPSHOT
TestLogstashEsOutput 3m38.98s
TestLogstashPipelineReload 1m9.71s
TestLogstashServerVersionUpgradeToLatest8x 2m54.85s
TestLogstashStackMonitoring 1m29.57s
TestLogstashWithCustomService 1m0.43s
TestLogstashWithCustomServiceAndAmendedApi 1m3.49s
TestLogstashWithReworkedApiService 1m0.39s
TestMultipleLogstashes 1m9.41s
TestPipelineConfigLogstash 54.42s
TestPipelineConfigRefLogstash 1m24.47s
TestSingleLogstash 1m3.39s |
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.
LGTM
This commit adds support for persistent volumes to the Logstash operator:
Syntax for volumeClaimTemplate
By default, a
logstash-data
persistentVolume is created, that maps to/usr/share/logstash/data
to use for logstash persistent storage, typically used for storage from plugins. Thelogstash-data
volume claim is, by default, a small (1Gi
) volume, using the standard StorageClass of the K8s provider, but can be overridden by adding aspec.volumeClaimTemplate
section with a name oflogstash-data
.Separate storage (eg for Logstash configurations using PQ's and/or DLQ's) can be added by including an additional
spec.volumeClaimTemplate
along with a correspondingspec.podTemplate.spec.containers.volumeMount
for each requested volume:Sample Logstash config with separate volume for persistent queue
This commit also performs a mild refactor, moving
volume
into thevolume
package that this commit adds.Note that as it currently stands, this PR makes a change to the
statefulSet
, which will require any existing logstash configurations created in the technical preview.This PR also does not support resizing of volumes by updating the
storage
value inspec.volumeClaimTemplates
, even with storage classes that support automatic volume expansion, and requires the user to do this manually by deleting existing statefulsets with cascading deletes turned off to avoid pod deletion.Documentation will be added as a follow-on PR, or additional commit to this PR