mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Allow unsafe upgrades (#565)
This commit is contained in:
parent
c936ec168d
commit
d2aa4f0d62
3 changed files with 22 additions and 2 deletions
|
@ -67,6 +67,9 @@ type DeploymentSpec struct {
|
|||
|
||||
RestoreFrom *string `json:"restoreFrom,omitempty"`
|
||||
|
||||
// AllowUnsafeUpgrade determines if upgrade on missing member or with not in sync shards is allowed
|
||||
AllowUnsafeUpgrade *bool `json:"allowUnsafeUpgrade,omitempty"`
|
||||
|
||||
ExternalAccess ExternalAccessSpec `json:"externalAccess"`
|
||||
RocksDB RocksDBSpec `json:"rocksdb"`
|
||||
Authentication AuthenticationSpec `json:"auth"`
|
||||
|
@ -270,6 +273,11 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
|
|||
if s.DisableIPv6 == nil {
|
||||
s.DisableIPv6 = util.NewBoolOrNil(source.DisableIPv6)
|
||||
}
|
||||
|
||||
if s.AllowUnsafeUpgrade == nil {
|
||||
s.AllowUnsafeUpgrade = util.NewBoolOrNil(source.AllowUnsafeUpgrade)
|
||||
}
|
||||
|
||||
s.License.SetDefaultsFrom(source.License)
|
||||
s.ExternalAccess.SetDefaultsFrom(source.ExternalAccess)
|
||||
s.RocksDB.SetDefaultsFrom(source.RocksDB)
|
||||
|
|
5
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
5
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
|
@ -317,6 +317,11 @@ func (in *DeploymentSpec) DeepCopyInto(out *DeploymentSpec) {
|
|||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.AllowUnsafeUpgrade != nil {
|
||||
in, out := &in.AllowUnsafeUpgrade, &out.AllowUnsafeUpgrade
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
in.ExternalAccess.DeepCopyInto(&out.ExternalAccess)
|
||||
in.RocksDB.DeepCopyInto(&out.RocksDB)
|
||||
in.Authentication.DeepCopyInto(&out.Authentication)
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
upgraderules "github.com/arangodb/go-upgrade-rules"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
|
||||
"github.com/rs/zerolog"
|
||||
core "k8s.io/api/core/v1"
|
||||
|
@ -105,8 +106,14 @@ func createRotateOrUpgradePlan(log zerolog.Logger, apiObject k8sutil.APIObject,
|
|||
// Use the new plan
|
||||
return newPlan, false
|
||||
} else {
|
||||
log.Info().Msg("Pod needs upgrade but cluster is not ready. Either some shards are not in sync or some member is not ready.")
|
||||
return nil, true
|
||||
if util.BoolOrDefault(spec.AllowUnsafeUpgrade, false) {
|
||||
log.Info().Msg("Pod needs upgrade but cluster is not ready. Either some shards are not in sync or some member is not ready, but unsafe upgrade is allowed")
|
||||
// Use the new plan
|
||||
return newPlan, false
|
||||
} else {
|
||||
log.Info().Msg("Pod needs upgrade but cluster is not ready. Either some shards are not in sync or some member is not ready.")
|
||||
return nil, true
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, false
|
||||
|
|
Loading…
Reference in a new issue