Skip to content

Commit

Permalink
Set default redundancy policy to zero (#501)
Browse files Browse the repository at this point in the history
* Set default redundancy policy to zero when node count is 1

Signed-off-by: Gary Brown <gary@brownuk.com>

* Updated to make the general default rather than just based on 1 node count

Signed-off-by: Gary Brown <gary@brownuk.com>
  • Loading branch information
objectiser authored Jul 4, 2019
1 parent 01bb012 commit a688e34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pkg/strategy/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/jaegertracing/jaeger-operator/pkg/apis/jaegertracing/v1"
"github.com/jaegertracing/jaeger-operator/pkg/cronjob"
"github.com/jaegertracing/jaeger-operator/pkg/storage"
esv1 "github.com/jaegertracing/jaeger-operator/pkg/storage/elasticsearch/v1"
)

const (
Expand Down Expand Up @@ -143,6 +144,9 @@ func normalizeElasticsearch(spec *v1.ElasticsearchSpec) {
if spec.NodeCount == 0 {
spec.NodeCount = 1
}
if spec.RedundancyPolicy == "" {
spec.RedundancyPolicy = esv1.ZeroRedundancy
}
}

func normalizeRollover(spec *v1.JaegerEsRolloverSpec) {
Expand Down
8 changes: 5 additions & 3 deletions pkg/strategy/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ func TestNormalizeElasticsearch(t *testing.T) {
expected v1.ElasticsearchSpec
}{
{underTest: v1.ElasticsearchSpec{},
expected: v1.ElasticsearchSpec{NodeCount: 1}},
{underTest: v1.ElasticsearchSpec{Image: "bla", NodeCount: 150},
expected: v1.ElasticsearchSpec{Image: "bla", NodeCount: 150}},
expected: v1.ElasticsearchSpec{NodeCount: 1, RedundancyPolicy: "ZeroRedundancy"}},
{underTest: v1.ElasticsearchSpec{NodeCount: 3, RedundancyPolicy: "FullRedundancy"},
expected: v1.ElasticsearchSpec{NodeCount: 3, RedundancyPolicy: "FullRedundancy"}},
{underTest: v1.ElasticsearchSpec{Image: "bla", NodeCount: 150, RedundancyPolicy: "ZeroRedundancy"},
expected: v1.ElasticsearchSpec{Image: "bla", NodeCount: 150, RedundancyPolicy: "ZeroRedundancy"}},
}
for _, test := range tests {
normalizeElasticsearch(&test.underTest)
Expand Down

0 comments on commit a688e34

Please sign in to comment.