Skip to content

Commit 6d2d0e6

Browse files
rbizosalbertteoh
authored andcommitted
Ilm disable template (jaegertracing#3610)
* useILM will prevent index template creation The index template should be created by es-rollover. Without this, it was mandatory to use --es.create-index-templates=false with --es.use-ilm, otherwise it would override the index template with an empty lifecycle.name thus preventing the rollover to work Signed-off-by: Raphael Bizos <r.bizos@criteo.com> * fixing ILM test Signed-off-by: Raphael Bizos <r.bizos@criteo.com> * Adding a comment for ILM and index creation Signed-off-by: Raphael Bizos <r.bizos@criteo.com> Signed-off-by: Albert Teoh <see.kwang.teoh@gmail.com>
1 parent 5bcc537 commit 6d2d0e6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

plugin/storage/es/factory.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ func createSpanWriter(
199199
Archive: archive,
200200
UseReadWriteAliases: cfg.GetUseReadWriteAliases(),
201201
})
202-
if cfg.IsCreateIndexTemplates() {
202+
203+
// Creating a template here would conflict with the one created for ILM resulting to no index rollover
204+
if cfg.IsCreateIndexTemplates() && !cfg.GetUseILM() {
203205
err := writer.CreateTemplates(spanMapping, serviceMapping, cfg.GetIndexPrefix())
204206
if err != nil {
205207
return nil, err

plugin/storage/es/factory_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ func TestCreateTemplateError(t *testing.T) {
185185
assert.Error(t, err, "template-error")
186186
}
187187

188+
func TestILMDisableTemplateCreation(t *testing.T) {
189+
f := NewFactory()
190+
f.primaryConfig = &mockClientBuilder{createTemplateError: errors.New("template-error"), Configuration: escfg.Configuration{Enabled: true, UseILM: true, UseReadWriteAliases: true, CreateIndexTemplates: true}}
191+
f.archiveConfig = &mockClientBuilder{}
192+
err := f.Initialize(metrics.NullFactory, zap.NewNop())
193+
require.NoError(t, err)
194+
_, err = f.CreateSpanWriter()
195+
assert.Nil(t, err) // as the createTemplate is not called, CreateSpanWriter should not return an error
196+
}
197+
188198
func TestArchiveDisabled(t *testing.T) {
189199
f := NewFactory()
190200
f.archiveConfig = &mockClientBuilder{Configuration: escfg.Configuration{Enabled: false}}

0 commit comments

Comments
 (0)