Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Coleen Iona Quadros <[email protected]>
  • Loading branch information
coleenquadros committed Dec 7, 2024
1 parent 234d373 commit bd0908f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ spec:
containers:
- args:
- --config.file=/etc/alertmanager/config/alertmanager.yaml
- --cluster.listen-address=[$(POD_IP)]:9094
- --storage.path=/alertmanager
- --data.retention=120h
- --web.listen-address=127.0.0.1:9093
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ func (r *MCORenderer) renderAlertManagerStatefulSet(res *resource.Resource,

if *dep.Spec.Replicas > 1 {
for i := int32(0); i < *dep.Spec.Replicas; i++ {
args = append(args, "--cluster.listen-address=[$(POD_IP)]:9094")
args = append(args, "--cluster.peer="+
mcoconfig.GetOperandName(mcoconfig.Alertmanager)+"-"+
strconv.Itoa(int(i))+".alertmanager-operated."+
mcoconfig.GetDefaultNamespace()+".svc:9094")
}
}
// ACM-13481 Disable HA mode for single replica
if *dep.Spec.Replicas == 1 {
args = append(args, "--cluster.listen-address=")
}

spec.Containers[0].Args = args
spec.Containers[0].Resources = mcoconfig.GetResources(mcoconfig.Alertmanager, r.cr.Spec.InstanceSize, r.cr.Spec.AdvancedConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,24 @@ func TestAlertManagerRendererMCOConfig(t *testing.T) {
assert.Equal(t, 3, count)
},
},
"one replica": {
mco: func() *mcov1beta2.MultiClusterObservability {
ret := makeBaseMco()
replicas := int32(1)
ret.Spec.AdvancedConfig = &mcov1beta2.AdvancedConfig{
Alertmanager: &mcov1beta2.CommonSpec{
Replicas: &replicas,
},
},
return ret

Check failure on line 175 in operators/multiclusterobservability/pkg/rendering/renderer_alertmanager_test.go

View workflow job for this annotation

GitHub Actions / Formatters + Linters (Static Analysis) for Go

expected operand, found 'return'
},
expect: func(t *testing.T, sts *appsv1.StatefulSet) {
assert.Equal(t, int32(1), *sts.Spec.Replicas)
args := sts.Spec.Template.Spec.Containers[0].Args
assert.NotContains(t, args, "--cluster.peer")
assert.Contains(t, args, "--cluster.listen-address=")
},
},
"resources": {
mco: func() *mcov1beta2.MultiClusterObservability {
ret := makeBaseMco()
Expand Down

0 comments on commit bd0908f

Please sign in to comment.