Skip to content

Commit 10efbda

Browse files
author
lamai93
committed
Merge remote-tracking branch 'origin/master' into bug-fix/readiness-upgrade-fix
2 parents 12a37be + 94d7ae8 commit 10efbda

File tree

7 files changed

+218
-172
lines changed

7 files changed

+218
-172
lines changed

dashboard/package-lock.json

Lines changed: 171 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dashboard/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"emotion": "^9.2.4",
7-
"react": "^16.4.1",
6+
"emotion": "^9.2.12",
7+
"react": "^16.6.0",
88
"react-copy-to-clipboard": "^5.0.1",
9-
"react-dom": "^16.4.1",
10-
"react-emotion": "^9.2.4",
9+
"react-dom": "^16.6.0",
10+
"react-emotion": "^9.2.12",
1111
"react-router-dom": "^4.3.1",
12-
"react-timeout": "^1.1.1",
13-
"semantic-ui-less": "^2.2.12",
12+
"react-timeout": "^1.1.2",
13+
"semantic-ui-less": "^2.4.1",
1414
"semantic-ui-react": "^0.81.3"
1515
},
1616
"devDependencies": {

pkg/apis/deployment/v1alpha/member_status_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (l MemberStatusList) SelectMemberToRemove() (MemberStatus, error) {
122122
if len(l) > 0 {
123123
// Try to find a not ready member
124124
for _, m := range l {
125-
if m.Phase == MemberPhaseNone {
125+
if m.Phase == MemberPhaseNone || !m.Conditions.IsTrue(ConditionTypeReady) {
126126
return m, nil
127127
}
128128
}

pkg/deployment/cluster_scaling_integration.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,19 @@ func (ci *clusterScalingIntegration) updateClusterServerCount(ctx context.Contex
192192
}
193193
coordinatorCount := spec.Coordinators.GetCount()
194194
dbserverCount := spec.DBServers.GetCount()
195-
if err := arangod.SetNumberOfServers(ctx, c.Connection(), coordinatorCount, dbserverCount); err != nil {
196-
if expectSuccess {
197-
log.Debug().Err(err).Msg("Failed to set number of servers")
195+
196+
ci.lastNumberOfServers.mutex.Lock()
197+
lastNumberOfServers := ci.lastNumberOfServers.NumberOfServers
198+
ci.lastNumberOfServers.mutex.Unlock()
199+
200+
// This is to prevent unneseccary updates that may override some values written by the WebUI (in the case of a update loop)
201+
if coordinatorCount != lastNumberOfServers.GetCoordinators() && dbserverCount != lastNumberOfServers.GetDBServers() {
202+
if err := arangod.SetNumberOfServers(ctx, c.Connection(), coordinatorCount, dbserverCount); err != nil {
203+
if expectSuccess {
204+
log.Debug().Err(err).Msg("Failed to set number of servers")
205+
}
206+
return false, maskAny(err)
198207
}
199-
return false, maskAny(err)
200208
}
201209

202210
// Success, now update internal state

pkg/deployment/reconcile/plan_builder.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,22 @@ func createScalePlan(log zerolog.Logger, members api.MemberStatusList, group api
366366
if m, err := members.SelectMemberToRemove(); err != nil {
367367
log.Warn().Err(err).Str("role", group.AsRole()).Msg("Failed to select member to remove")
368368
} else {
369-
if group == api.ServerGroupDBServers {
369+
370+
log.Debug().
371+
Str("member-id", m.ID).
372+
Str("phase", string(m.Phase)).
373+
Msg("Found member to remove")
374+
if m.Conditions.IsTrue(api.ConditionTypeReady) {
375+
if group == api.ServerGroupDBServers {
376+
plan = append(plan,
377+
api.NewAction(api.ActionTypeCleanOutMember, group, m.ID),
378+
)
379+
}
370380
plan = append(plan,
371-
api.NewAction(api.ActionTypeCleanOutMember, group, m.ID),
381+
api.NewAction(api.ActionTypeShutdownMember, group, m.ID),
372382
)
373383
}
374384
plan = append(plan,
375-
api.NewAction(api.ActionTypeShutdownMember, group, m.ID),
376385
api.NewAction(api.ActionTypeRemoveMember, group, m.ID),
377386
)
378387
log.Debug().

pkg/deployment/reconcile/plan_builder_test.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,9 @@ func TestCreatePlanActiveFailoverScale(t *testing.T) {
176176
}
177177
newPlan, changed = createPlan(log, depl, nil, spec, status, nil, c)
178178
assert.True(t, changed)
179-
require.Len(t, newPlan, 2) // Note: Downscaling is only down 1 at a time
180-
assert.Equal(t, api.ActionTypeShutdownMember, newPlan[0].Type)
181-
assert.Equal(t, api.ActionTypeRemoveMember, newPlan[1].Type)
179+
require.Len(t, newPlan, 1) // Note: Downscaling is only down 1 at a time
180+
assert.Equal(t, api.ActionTypeRemoveMember, newPlan[0].Type)
182181
assert.Equal(t, api.ServerGroupSingle, newPlan[0].Group)
183-
assert.Equal(t, api.ServerGroupSingle, newPlan[1].Group)
184182
}
185183

186184
// TestCreatePlanClusterScale creates a `cluster` deployment to test the creating of scaling plan.
@@ -263,6 +261,12 @@ func TestCreatePlanClusterScale(t *testing.T) {
263261
api.MemberStatus{
264262
ID: "cr1",
265263
PodName: "coordinator1",
264+
Conditions: api.ConditionList{
265+
api.Condition{
266+
Type: api.ConditionTypeReady,
267+
Status: v1.ConditionTrue,
268+
},
269+
},
266270
},
267271
api.MemberStatus{
268272
ID: "cr2",
@@ -273,15 +277,14 @@ func TestCreatePlanClusterScale(t *testing.T) {
273277
spec.Coordinators.Count = util.NewInt(1)
274278
newPlan, changed = createPlan(log, depl, nil, spec, status, nil, c)
275279
assert.True(t, changed)
276-
require.Len(t, newPlan, 5) // Note: Downscaling is done 1 at a time
277-
assert.Equal(t, api.ActionTypeCleanOutMember, newPlan[0].Type)
280+
281+
fmt.Printf("%v", newPlan)
282+
283+
require.Len(t, newPlan, 3) // Note: Downscaling is done 1 at a time
284+
assert.Equal(t, api.ActionTypeRemoveMember, newPlan[0].Type)
278285
assert.Equal(t, api.ActionTypeShutdownMember, newPlan[1].Type)
279286
assert.Equal(t, api.ActionTypeRemoveMember, newPlan[2].Type)
280-
assert.Equal(t, api.ActionTypeShutdownMember, newPlan[3].Type)
281-
assert.Equal(t, api.ActionTypeRemoveMember, newPlan[4].Type)
282287
assert.Equal(t, api.ServerGroupDBServers, newPlan[0].Group)
283-
assert.Equal(t, api.ServerGroupDBServers, newPlan[1].Group)
284-
assert.Equal(t, api.ServerGroupDBServers, newPlan[2].Group)
285-
assert.Equal(t, api.ServerGroupCoordinators, newPlan[3].Group)
286-
assert.Equal(t, api.ServerGroupCoordinators, newPlan[4].Group)
288+
assert.Equal(t, api.ServerGroupCoordinators, newPlan[1].Group)
289+
assert.Equal(t, api.ServerGroupCoordinators, newPlan[2].Group)
287290
}

pkg/deployment/resources/secret_hashes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
// ValidateSecretHashes checks the hash of used secrets
3939
// against the stored ones.
4040
// If a hash is different, the deployment is marked
41-
// with a SecretChangedCondition and the operator will no
41+
// with a SecretChangedCondition and the operator will not
4242
// touch it until this is resolved.
4343
func (r *Resources) ValidateSecretHashes() error {
4444
// validate performs a secret hash comparison for a single secret.

0 commit comments

Comments
 (0)