1
0
Fork 0
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:
Adam Janikowski 2020-05-18 15:27:53 +02:00 committed by GitHub
parent c936ec168d
commit d2aa4f0d62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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