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

Add elasticsearch storage date format config. #1325

Merged
merged 3 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/cronjob/es_index_cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func TestEsIndexCleanerEnvVars(t *testing.T) {
opts: map[string]interface{}{"es.index-prefix": "foo", "es.username": "joe", "es.password": "pass", "es.use-aliases": "true"},
envs: []corev1.EnvVar{{Name: "INDEX_PREFIX", Value: "foo"}, {Name: "ES_USERNAME", Value: "joe"}, {Name: "ES_PASSWORD", Value: "pass"}, {Name: "ROLLOVER", Value: "true"}},
},
{
opts: map[string]interface{}{"es.index-prefix": "foo", "es.index-date-separator": ".", "es.username": "joe", "es.password": "pass"},
envs: []corev1.EnvVar{{Name: "INDEX_PREFIX", Value: "foo"}, {Name: "INDEX_DATE_SEPARATOR", Value: "."}, {Name: "ES_USERNAME", Value: "joe"}, {Name: "ES_PASSWORD", Value: "pass"}},
},
}

for _, test := range tests {
Expand Down
1 change: 1 addition & 0 deletions pkg/cronjob/es_rollover.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func EsScriptEnvVars(opts v1.Options) []corev1.EnvVar {
envVar string
}{
{flag: "es.index-prefix", envVar: "INDEX_PREFIX"},
{flag: "es.index-date-separator", envVar: "INDEX_DATE_SEPARATOR"},
{flag: "es.username", envVar: "ES_USERNAME"},
{flag: "es.password", envVar: "ES_PASSWORD"},
{flag: "es.tls.enabled", envVar: "ES_TLS_ENABLED"},
Expand Down
1 change: 1 addition & 0 deletions pkg/cronjob/spark_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func getStorageEnvs(s v1.JaegerStorageSpec) []corev1.EnvVar {
vars := []corev1.EnvVar{
{Name: "ES_NODES", Value: sFlagsMap["es.server-urls"]},
{Name: "ES_INDEX_PREFIX", Value: sFlagsMap["es.index-prefix"]},
{Name: "ES_INDEX_DATE_SEPARATOR", Value: sFlagsMap["es.index-date-separator"]},
{Name: "ES_USERNAME", Value: sFlagsMap["es.username"]},
{Name: "ES_PASSWORD", Value: sFlagsMap["es.password"]},
{Name: "ES_TIME_RANGE", Value: s.Dependencies.ElasticsearchTimeRange},
Expand Down
7 changes: 5 additions & 2 deletions pkg/cronjob/spark_dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@ func TestStorageEnvs(t *testing.T) {
}},
{storage: v1.JaegerStorageSpec{Type: v1.JaegerESStorage,
Options: v1.NewOptions(map[string]interface{}{"es.server-urls": "lol:hol", "es.index-prefix": "haha",
"es.username": "jdoe", "es.password": "none"})},
"es.index-date-separator": ".", "es.username": "jdoe", "es.password": "none"})},
expected: []corev1.EnvVar{
{Name: "ES_NODES", Value: "lol:hol"},
{Name: "ES_INDEX_PREFIX", Value: "haha"},
{Name: "ES_INDEX_DATE_SEPARATOR", Value: "."},
{Name: "ES_USERNAME", Value: "jdoe"},
{Name: "ES_PASSWORD", Value: "none"},
{Name: "ES_TIME_RANGE", Value: ""},
}},
{storage: v1.JaegerStorageSpec{Type: v1.JaegerESStorage,
Options: v1.NewOptions(map[string]interface{}{"es.server-urls": "lol:hol", "es.index-prefix": "haha",
"es.username": "jdoe", "es.password": "none"}),
"es.index-date-separator": ".", "es.username": "jdoe", "es.password": "none"}),
Dependencies: v1.JaegerDependenciesSpec{ElasticsearchClientNodeOnly: &trueVar, ElasticsearchNodesWanOnly: &falseVar}},
expected: []corev1.EnvVar{
{Name: "ES_NODES", Value: "lol:hol"},
{Name: "ES_INDEX_PREFIX", Value: "haha"},
{Name: "ES_INDEX_DATE_SEPARATOR", Value: "."},
{Name: "ES_USERNAME", Value: "jdoe"},
{Name: "ES_PASSWORD", Value: "none"},
{Name: "ES_TIME_RANGE", Value: ""},
Expand All @@ -81,6 +83,7 @@ func TestStorageEnvs(t *testing.T) {
expected: []corev1.EnvVar{
{Name: "ES_NODES", Value: "lol:hol"},
{Name: "ES_INDEX_PREFIX", Value: "haha"},
{Name: "ES_INDEX_DATE_SEPARATOR", Value: ""},
{Name: "ES_USERNAME", Value: "jdoe"},
{Name: "ES_PASSWORD", Value: "none"},
{Name: "ES_TIME_RANGE", Value: "30m"},
Expand Down
12 changes: 7 additions & 5 deletions pkg/storage/elasticsearch_dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ func TestEnvVars(t *testing.T) {
},
{
opts: v1.NewOptions(map[string]interface{}{
"es.index-prefix": "foo",
"es.num-shards": "5",
"es.num-replicas": "3",
"es.password": "nopass",
"es.username": "fredy"}),
"es.index-prefix": "foo",
"es.index-date-separator": ".",
"es.num-shards": "5",
"es.num-replicas": "3",
"es.password": "nopass",
"es.username": "fredy"}),
expected: []corev1.EnvVar{
{Name: "INDEX_PREFIX", Value: "foo"},
{Name: "INDEX_DATE_SEPARATOR", Value: "."},
{Name: "ES_USERNAME", Value: "fredy"},
{Name: "ES_PASSWORD", Value: "nopass"},
{Name: "SHARDS", Value: "5"},
Expand Down