mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Bugfix] Fix Single server PVC Removal (#714)
This commit is contained in:
parent
1657121eb5
commit
6884f3164c
6 changed files with 24 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
)
|
||||
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
},
|
||||
|
@ -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",
|
||||
},
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue