Skip to content

Commit 6626f61

Browse files
authored
[Feature] UpgradeByReplace Flow (#1821)
1 parent 1826729 commit 6626f61

11 files changed

+374
-47
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- (Bugfix) Fix Manifests
1414
- (Bugfix) Agency Cache Reload
1515
- (Feature) Allow to continue if ResignServer job is gone
16+
- (Feature) UpgradeByReplace Flow
1617

1718
## [1.2.44](https://github.com/arangodb/kube-arangodb/tree/1.2.44) (2025-02-03)
1819
- (Maintenance) Kubernetes 1.31.1 libraries

docs/api/ArangoDeployment.V1.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,14 @@ Links:
835835

836836
***
837837

838+
### .spec.agents.upgradeMode
839+
840+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L217)</sup>
841+
842+
UpgradeMode Defines the upgrade mode for the Member
843+
844+
***
845+
838846
### .spec.agents.volumeAllowShrink
839847

840848
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>
@@ -1905,6 +1913,14 @@ Links:
19051913

19061914
***
19071915

1916+
### .spec.coordinators.upgradeMode
1917+
1918+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L217)</sup>
1919+
1920+
UpgradeMode Defines the upgrade mode for the Member
1921+
1922+
***
1923+
19081924
### .spec.coordinators.volumeAllowShrink
19091925

19101926
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>
@@ -2843,6 +2859,14 @@ Links:
28432859

28442860
***
28452861

2862+
### .spec.dbservers.upgradeMode
2863+
2864+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L217)</sup>
2865+
2866+
UpgradeMode Defines the upgrade mode for the Member
2867+
2868+
***
2869+
28462870
### .spec.dbservers.volumeAllowShrink
28472871

28482872
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>
@@ -3914,6 +3938,14 @@ Links:
39143938

39153939
***
39163940

3941+
### .spec.gateways.upgradeMode
3942+
3943+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L217)</sup>
3944+
3945+
UpgradeMode Defines the upgrade mode for the Member
3946+
3947+
***
3948+
39173949
### .spec.gateways.volumeAllowShrink
39183950

39193951
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>
@@ -5595,6 +5627,14 @@ Links:
55955627

55965628
***
55975629

5630+
### .spec.single.upgradeMode
5631+
5632+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L217)</sup>
5633+
5634+
UpgradeMode Defines the upgrade mode for the Member
5635+
5636+
***
5637+
55985638
### .spec.single.volumeAllowShrink
55995639

56005640
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>
@@ -6747,6 +6787,14 @@ Links:
67476787

67486788
***
67496789

6790+
### .spec.syncmasters.upgradeMode
6791+
6792+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L217)</sup>
6793+
6794+
UpgradeMode Defines the upgrade mode for the Member
6795+
6796+
***
6797+
67506798
### .spec.syncmasters.volumeAllowShrink
67516799

67526800
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>
@@ -7677,6 +7725,14 @@ Links:
76777725

76787726
***
76797727

7728+
### .spec.syncworkers.upgradeMode
7729+
7730+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L217)</sup>
7731+
7732+
UpgradeMode Defines the upgrade mode for the Member
7733+
7734+
***
7735+
76807736
### .spec.syncworkers.volumeAllowShrink
76817737

76827738
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>

pkg/apis/deployment/v1/server_group_spec.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -212,6 +212,9 @@ type ServerGroupSpec struct {
212212

213213
// Numactl define Numactl options passed to the process
214214
Numactl *ServerGroupSpecNumactl `json:"numactl,omitempty"`
215+
216+
// UpgradeMode Defines the upgrade mode for the Member
217+
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`
215218
}
216219

217220
func (s *ServerGroupSpec) Get() ServerGroupSpec {
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package v1
22+
23+
import "github.com/arangodb/kube-arangodb/pkg/util/errors"
24+
25+
// ServerGroupUpgradeMode is used to define Upgrade mode of the Pod
26+
type ServerGroupUpgradeMode string
27+
28+
const (
29+
// ServerGroupUpgradeModeInplace define Inplace Upgrade procedure (with Upgrade initContainer).
30+
ServerGroupUpgradeModeInplace ServerGroupUpgradeMode = "inplace"
31+
32+
// ServerGroupUpgradeModeReplace Replaces server instead of upgrading. Takes an effect only on DBServer
33+
ServerGroupUpgradeModeReplace ServerGroupUpgradeMode = "replace"
34+
35+
// DefaultServerGroupUpgradeMode defaults to ServerGroupUpgradeModeInplace
36+
DefaultServerGroupUpgradeMode = ServerGroupUpgradeModeInplace
37+
)
38+
39+
func (n *ServerGroupUpgradeMode) Validate() error {
40+
switch v := n.Get(); v {
41+
case ServerGroupUpgradeModeInplace, ServerGroupUpgradeModeReplace:
42+
return nil
43+
default:
44+
return errors.WithStack(errors.Wrapf(ValidationError, "Unknown UpgradeMode %s", v.String()))
45+
}
46+
}
47+
48+
func (n *ServerGroupUpgradeMode) Get() ServerGroupUpgradeMode {
49+
if n == nil {
50+
return DefaultServerGroupUpgradeMode
51+
}
52+
53+
return *n
54+
}
55+
56+
func (n *ServerGroupUpgradeMode) String() string {
57+
return string(n.Get())
58+
}
59+
60+
func (n *ServerGroupUpgradeMode) New() *ServerGroupUpgradeMode {
61+
v := n.Get()
62+
63+
return &v
64+
}

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/apis/deployment/v2alpha1/server_group_spec.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -212,6 +212,9 @@ type ServerGroupSpec struct {
212212

213213
// Numactl define Numactl options passed to the process
214214
Numactl *ServerGroupSpecNumactl `json:"numactl,omitempty"`
215+
216+
// UpgradeMode Defines the upgrade mode for the Member
217+
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`
215218
}
216219

217220
func (s *ServerGroupSpec) Get() ServerGroupSpec {
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package v2alpha1
22+
23+
import "github.com/arangodb/kube-arangodb/pkg/util/errors"
24+
25+
// ServerGroupUpgradeMode is used to define Upgrade mode of the Pod
26+
type ServerGroupUpgradeMode string
27+
28+
const (
29+
// ServerGroupUpgradeModeInplace define Inplace Upgrade procedure (with Upgrade initContainer).
30+
ServerGroupUpgradeModeInplace ServerGroupUpgradeMode = "inplace"
31+
32+
// ServerGroupUpgradeModeReplace Replaces server instead of upgrading. Takes an effect only on DBServer
33+
ServerGroupUpgradeModeReplace ServerGroupUpgradeMode = "replace"
34+
35+
// DefaultServerGroupUpgradeMode defaults to ServerGroupUpgradeModeInplace
36+
DefaultServerGroupUpgradeMode = ServerGroupUpgradeModeInplace
37+
)
38+
39+
func (n *ServerGroupUpgradeMode) Validate() error {
40+
switch v := n.Get(); v {
41+
case ServerGroupUpgradeModeInplace, ServerGroupUpgradeModeReplace:
42+
return nil
43+
default:
44+
return errors.WithStack(errors.Wrapf(ValidationError, "Unknown UpgradeMode %s", v.String()))
45+
}
46+
}
47+
48+
func (n *ServerGroupUpgradeMode) Get() ServerGroupUpgradeMode {
49+
if n == nil {
50+
return DefaultServerGroupUpgradeMode
51+
}
52+
53+
return *n
54+
}
55+
56+
func (n *ServerGroupUpgradeMode) String() string {
57+
return string(n.Get())
58+
}
59+
60+
func (n *ServerGroupUpgradeMode) New() *ServerGroupUpgradeMode {
61+
v := n.Get()
62+
63+
return &v
64+
}

pkg/apis/deployment/v2alpha1/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.

0 commit comments

Comments
 (0)