Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Change Log

## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- Prevent Single member recreation
- Add OwnerReference to ClusterIP member service
- Add InternalPort to ServerGroupSpec to allow user to expose tcp connection over localhost for sidecars

## [1.1.7](https://github.com/arangodb/kube-arangodb/tree/1.1.7) (2021-04-14)
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/deployment/v1/server_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ func (g *ServerGroup) UnmarshalJSON(bytes []byte) error {
return nil
}

{
// Try with int
var s int

if err := json.Unmarshal(bytes, &s); err == nil {
*g = ServerGroupFromRole(ServerGroup(s).AsRole())
return nil
}
}

var s string

if err := json.Unmarshal(bytes, &s); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/deployment/reconcile/action_upgrade_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (a *actionUpgradeMember) CheckProgress(ctx context.Context) (bool, bool, er
return false, abort, err
}

return false, true, nil
return false, false, nil
}

isUpgrading := m.Phase == api.MemberPhaseUpgrading
Expand Down
6 changes: 6 additions & 0 deletions pkg/deployment/reconcile/plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,17 @@ func createPlan(ctx context.Context, log zerolog.Logger, apiObject k8sutil.APIOb
memberLog.Msg("Restoring old member. For agency members recreation of PVC is not supported - to prevent DataLoss")
plan = append(plan,
api.NewAction(api.ActionTypeRecreateMember, group, m.ID))
case api.ServerGroupSingle:
// Do not remove data for singles
memberLog.Msg("Restoring old member. Rotation for single servers is not safe")
plan = append(plan,
api.NewAction(api.ActionTypeRecreateMember, group, m.ID))
default:
memberLog.Msg("Creating member replacement plan because member has failed")
plan = append(plan,
api.NewAction(api.ActionTypeRemoveMember, group, m.ID),
api.NewAction(api.ActionTypeAddMember, group, ""),
api.NewAction(api.ActionTypeWaitForMemberUp, group, api.MemberIDPreviousAction),
)

}
Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/reconcile/plan_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ func TestCreatePlan(t *testing.T) {
ExpectedPlan: []api.Action{
api.NewAction(api.ActionTypeRemoveMember, api.ServerGroupCoordinators, "id"),
api.NewAction(api.ActionTypeAddMember, api.ServerGroupCoordinators, ""),
api.NewAction(api.ActionTypeWaitForMemberUp, api.ServerGroupCoordinators, api.MemberIDPreviousAction),
},
ExpectedLog: "Creating member replacement plan because member has failed",
},
Expand All @@ -796,6 +797,7 @@ func TestCreatePlan(t *testing.T) {
ExpectedPlan: []api.Action{
api.NewAction(api.ActionTypeRemoveMember, api.ServerGroupDBServers, "id"),
api.NewAction(api.ActionTypeAddMember, api.ServerGroupDBServers, ""),
api.NewAction(api.ActionTypeWaitForMemberUp, api.ServerGroupDBServers, api.MemberIDPreviousAction),
},
ExpectedLog: "Creating member replacement plan because member has failed",
},
Expand Down
3 changes: 3 additions & 0 deletions pkg/deployment/resources/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func (r *Resources) EnsureServices(cachedStatus inspectorInterface.Inspector) er
ObjectMeta: metav1.ObjectMeta{
Name: member.GetName(),
Namespace: member.GetNamespace(),
OwnerReferences: []metav1.OwnerReference{
member.AsOwner(),
},
},
Spec: core.ServiceSpec{
Type: core.ServiceTypeClusterIP,
Expand Down