Fix default elasticsearch-data volumeMount configuration#6725
Merged
thbkrkr merged 4 commits intoelastic:mainfrom Apr 28, 2023
Merged
Fix default elasticsearch-data volumeMount configuration#6725thbkrkr merged 4 commits intoelastic:mainfrom
elasticsearch-data volumeMount configuration#6725thbkrkr merged 4 commits intoelastic:mainfrom
Conversation
Contributor
Author
|
Another approach could be to move the call to diff --git a/pkg/controller/elasticsearch/nodespec/podspec.go b/pkg/controller/elasticsearch/nodespec/podspec.go
index 52fcda3cd..a012d3f12 100644
--- a/pkg/controller/elasticsearch/nodespec/podspec.go
+++ b/pkg/controller/elasticsearch/nodespec/podspec.go
@@ -110,7 +110,11 @@ func BuildPodTemplateSpec(
WithReadinessProbe(*NewReadinessProbe()).
WithAffinity(DefaultAffinity(es.Name)).
WithEnv(DefaultEnvVars(es.Spec.HTTP, headlessServiceName)...).
- WithVolumes(volumes...).
+ WithVolumes(volumes...)
+
+ volumeMounts = esvolume.AppendDefaultDataVolumeMount(volumeMounts, volumes)
+
+ builder = builder.
WithVolumeMounts(volumeMounts...).
WithInitContainers(initContainers...).
|
Contributor
Author
|
Since there is always an diff --git a/pkg/controller/elasticsearch/nodespec/volumes.go b/pkg/controller/elasticsearch/nodespec/volumes.go
index c5da73430..beabe273b 100644
--- a/pkg/controller/elasticsearch/nodespec/volumes.go
+++ b/pkg/controller/elasticsearch/nodespec/volumes.go
@@ -106,6 +106,7 @@ func buildVolumes(
scriptsVolume.VolumeMount(),
configVolume.VolumeMount(),
downwardAPIVolume.VolumeMount(),
+ esvolume.DefaultDataVolumeMount,
) |
pebrc
approved these changes
Apr 28, 2023
Collaborator
pebrc
left a comment
There was a problem hiding this comment.
LGTM I did a couple of tests and I think it works as expected. I also think it is safe as use provided mounts will still prevail.
| } | ||
|
|
||
| volumeMounts = esvolume.AppendDefaultDataVolumeMount(volumeMounts, volumes) | ||
| volumeMounts = esvolume.AppendDefaultDataVolumeMount(volumeMounts, append(volumes, nodeSpec.PodTemplate.Spec.Volumes...)) |
Collaborator
There was a problem hiding this comment.
Let's add a comment here to explain why we are suddenly including the user provided PodTemplate here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit ensures that we take into account the volumes provided by the user to append the default
elasticsearch-datavolumeMount.Resolves #6186.