Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay committed Sep 21, 2023
1 parent 077fe99 commit e007726
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/storage/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (ed *ElasticsearchDeployment) injectArguments(container *corev1.Container)
calculateReplicaShards(ed.Jaeger.Spec.Storage.Elasticsearch.RedundancyPolicy, int(ed.Jaeger.Spec.Storage.Elasticsearch.NodeCount))))
}
if strings.EqualFold(util.FindItem("--es-archive.enabled", container.Args), "--es-archive.enabled=true") {
container.Args = append(container.Args, fmt.Sprintf("--es-archive.server-urls=https://%s:9200", ed.Jaeger.Spec.Storage.Elasticsearch.Name))
container.Args = append(container.Args, fmt.Sprintf("--es-archive.server-urls=https://%s.%s.svc.cluster.local:9200", ed.Jaeger.Spec.Storage.Elasticsearch.Name, ed.Jaeger.Namespace))
if util.FindItem("--es-archive.tls=", container.Args) == "" && util.FindItem("--es-archive.tls.enabled=", container.Args) == "" {
container.Args = append(container.Args, "--es-archive.tls.enabled=true")
}
Expand Down
20 changes: 10 additions & 10 deletions pkg/storage/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func TestInject(t *testing.T) {
Containers: []corev1.Container{{
Args: []string{
"foo",
"--es.server-urls=https://elasticsearch:9200",
"--es.server-urls=https://elasticsearch.project.svc.cluster.local:9200",
"--es.tls.enabled=true",
"--es.tls.ca=" + caPath,
"--es.tls.cert=" + certPath,
Expand Down Expand Up @@ -333,7 +333,7 @@ func TestInject(t *testing.T) {
Containers: []corev1.Container{{
Args: []string{
"foo",
"--es.server-urls=https://elasticsearch:9200",
"--es.server-urls=https://elasticsearch.project.svc.cluster.local:9200",
"--es.tls.enabled=true",
"--es.tls.ca=" + caPathESCerManagement,
"--es.tls.cert=" + certPathESCertManagement,
Expand Down Expand Up @@ -369,7 +369,7 @@ func TestInject(t *testing.T) {
"--es.num-shards=15",
"--es.num-replicas=55",
"--es.timeout=99s",
"--es.server-urls=https://elasticsearch:9200",
"--es.server-urls=https://elasticsearch.project.svc.cluster.local:9200",
"--es.tls.enabled=true",
"--es.tls.ca=" + caPath,
"--es.tls.cert=" + certPath,
Expand Down Expand Up @@ -398,7 +398,7 @@ func TestInject(t *testing.T) {
expected: &corev1.PodSpec{
Containers: []corev1.Container{{
Args: []string{
"--es.server-urls=https://my-es:9200",
"--es.server-urls=https://my-es.project.svc.cluster.local:9200",
"--es.tls.enabled=true",
"--es.tls.ca=" + caPath,
"--es.tls.cert=" + certPath,
Expand Down Expand Up @@ -437,15 +437,15 @@ func TestInject(t *testing.T) {
Containers: []corev1.Container{{
Args: []string{
"--es-archive.enabled=true",
"--es.server-urls=https://es-tenant2:9200",
"--es.server-urls=https://es-tenant2.project.svc.cluster.local:9200",
"--es.tls.enabled=true",
"--es.tls.ca=" + caPath,
"--es.tls.cert=" + certPath,
"--es.tls.key=" + keyPath,
"--es.timeout=15s",
"--es.num-shards=15",
"--es.num-replicas=14",
"--es-archive.server-urls=https://es-tenant2:9200",
"--es-archive.server-urls=https://es-tenant2.project.svc.cluster.local:9200",
"--es-archive.tls.enabled=true",
"--es-archive.tls.ca=" + caPath,
"--es-archive.tls.cert=" + certPath,
Expand All @@ -471,7 +471,7 @@ func TestInject(t *testing.T) {

for i, test := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
es := &ElasticsearchDeployment{Jaeger: v1.NewJaeger(types.NamespacedName{Name: "jtest"})}
es := &ElasticsearchDeployment{Jaeger: v1.NewJaeger(types.NamespacedName{Name: "jtest", Namespace: "project"})}
es.Jaeger.Spec.Storage.Elasticsearch = test.es
es.InjectStorageConfiguration(test.pod)
assert.Equal(t, test.expected, test.pod)
Expand Down Expand Up @@ -501,7 +501,7 @@ func TestInjectJobs(t *testing.T) {
},
expected: &corev1.PodSpec{
Containers: []corev1.Container{{
Args: []string{"init", "https://elasticsearch:9200"},
Args: []string{"init", "https://elasticsearch.project.svc.cluster.local:9200"},
Env: []corev1.EnvVar{
{
Name: "ES_TLS_ENABLED",
Expand Down Expand Up @@ -557,7 +557,7 @@ func TestInjectJobs(t *testing.T) {
},
expected: &corev1.PodSpec{
Containers: []corev1.Container{{
Args: []string{"init", "https://elasticsearch:9200"},
Args: []string{"init", "https://elasticsearch.project.svc.cluster.local:9200"},
Env: []corev1.EnvVar{
{
Name: "ES_TLS_ENABLED",
Expand Down Expand Up @@ -602,7 +602,7 @@ func TestInjectJobs(t *testing.T) {

for i, test := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
es := &ElasticsearchDeployment{Jaeger: v1.NewJaeger(types.NamespacedName{Name: "jtest"})}
es := &ElasticsearchDeployment{Jaeger: v1.NewJaeger(types.NamespacedName{Name: "jtest", Namespace: "project"})}
es.Jaeger.Spec.Storage.Elasticsearch = test.es
es.InjectSecretsConfiguration(test.pod)
assert.Equal(t, test.expected, test.pod)
Expand Down

0 comments on commit e007726

Please sign in to comment.