Skip to content

Commit d2aa4f0

Browse files
authored
[Feature] Allow unsafe upgrades (#565)
1 parent c936ec1 commit d2aa4f0

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

pkg/apis/deployment/v1/deployment_spec.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ type DeploymentSpec struct {
6767

6868
RestoreFrom *string `json:"restoreFrom,omitempty"`
6969

70+
// AllowUnsafeUpgrade determines if upgrade on missing member or with not in sync shards is allowed
71+
AllowUnsafeUpgrade *bool `json:"allowUnsafeUpgrade,omitempty"`
72+
7073
ExternalAccess ExternalAccessSpec `json:"externalAccess"`
7174
RocksDB RocksDBSpec `json:"rocksdb"`
7275
Authentication AuthenticationSpec `json:"auth"`
@@ -270,6 +273,11 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
270273
if s.DisableIPv6 == nil {
271274
s.DisableIPv6 = util.NewBoolOrNil(source.DisableIPv6)
272275
}
276+
277+
if s.AllowUnsafeUpgrade == nil {
278+
s.AllowUnsafeUpgrade = util.NewBoolOrNil(source.AllowUnsafeUpgrade)
279+
}
280+
273281
s.License.SetDefaultsFrom(source.License)
274282
s.ExternalAccess.SetDefaultsFrom(source.ExternalAccess)
275283
s.RocksDB.SetDefaultsFrom(source.RocksDB)

pkg/apis/deployment/v1/zz_generated.deepcopy.go

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

pkg/deployment/reconcile/plan_builder_rotate_upgrade.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
upgraderules "github.com/arangodb/go-upgrade-rules"
2828
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
2929
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
30+
"github.com/arangodb/kube-arangodb/pkg/util"
3031
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
3132
"github.com/rs/zerolog"
3233
core "k8s.io/api/core/v1"
@@ -105,8 +106,14 @@ func createRotateOrUpgradePlan(log zerolog.Logger, apiObject k8sutil.APIObject,
105106
// Use the new plan
106107
return newPlan, false
107108
} else {
108-
log.Info().Msg("Pod needs upgrade but cluster is not ready. Either some shards are not in sync or some member is not ready.")
109-
return nil, true
109+
if util.BoolOrDefault(spec.AllowUnsafeUpgrade, false) {
110+
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")
111+
// Use the new plan
112+
return newPlan, false
113+
} else {
114+
log.Info().Msg("Pod needs upgrade but cluster is not ready. Either some shards are not in sync or some member is not ready.")
115+
return nil, true
116+
}
110117
}
111118
}
112119
return nil, false

0 commit comments

Comments
 (0)