Skip to content

Commit 4099085

Browse files
committed
[Feature] Rotation Order
1 parent e4be824 commit 4099085

33 files changed

+615
-87
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- (Feature) (Platform) Add Sharding to the Inventory Endpoint
1313
- (Feature) Emit Default values in Inventory
1414
- (Maintenance) Bump github.com/containerd/containerd to v1.7.27
15+
- (Feature) Rotation Order
1516

1617
## [1.2.46](https://github.com/arangodb/kube-arangodb/tree/1.2.46) (2025-02-24)
1718
- (Bugfix) Clean Phase change properly during upgrade

docs/api/ArangoDeployment.V1.md

+41-17
Original file line numberDiff line numberDiff line change
@@ -952,31 +952,31 @@ Links:
952952

953953
### .spec.allowUnsafeUpgrade
954954

955-
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L152)</sup>
955+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L155)</sup>
956956

957957
AllowUnsafeUpgrade determines if upgrade on missing member or with not in sync shards is allowed
958958

959959
***
960960

961961
### .spec.annotations
962962

963-
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L115)</sup>
963+
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L118)</sup>
964964

965965
Annotations specifies the annotations added to all ArangoDeployment owned resources (pods, services, PVC’s, PDB’s).
966966

967967
***
968968

969969
### .spec.annotationsIgnoreList
970970

971-
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L118)</sup>
971+
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L121)</sup>
972972

973973
AnnotationsIgnoreList list regexp or plain definitions which annotations should be ignored
974974

975975
***
976976

977977
### .spec.annotationsMode
978978

979-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L124)</sup>
979+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L127)</sup>
980980

981981
AnnotationsMode defines annotations mode which should be use while overriding annotations.
982982

@@ -989,7 +989,7 @@ Possible Values:
989989

990990
### .spec.architecture
991991

992-
Type: `[]string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L257)</sup>
992+
Type: `[]string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L260)</sup>
993993

994994
Architecture defines the list of supported architectures.
995995
First element on the list is marked as default architecture.
@@ -1066,7 +1066,7 @@ KillPodProbability is the chance of a pod being killed during an event
10661066

10671067
### .spec.ClusterDomain
10681068

1069-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L229)</sup>
1069+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L232)</sup>
10701070

10711071
ClusterDomain define domain used in the kubernetes cluster.
10721072
Required only of domain is not set to default (cluster.local)
@@ -1077,7 +1077,7 @@ Default Value: `cluster.local`
10771077

10781078
### .spec.communicationMethod
10791079

1080-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L237)</sup>
1080+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L240)</sup>
10811081

10821082
CommunicationMethod define communication method used in deployment
10831083

@@ -4565,23 +4565,23 @@ might be configured in the container image.
45654565

45664566
### .spec.labels
45674567

4568-
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L127)</sup>
4568+
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L130)</sup>
45694569

45704570
Labels specifies the labels added to Pods in this group.
45714571

45724572
***
45734573

45744574
### .spec.labelsIgnoreList
45754575

4576-
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L130)</sup>
4576+
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L133)</sup>
45774577

45784578
LabelsIgnoreList list regexp or plain definitions which labels should be ignored
45794579

45804580
***
45814581

45824582
### .spec.labelsMode
45834583

4584-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L136)</sup>
4584+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L139)</sup>
45854585

45864586
LabelsMode Define labels mode which should be use while overriding labels
45874587

@@ -4615,7 +4615,7 @@ Links:
46154615

46164616
### .spec.memberPropagationMode
46174617

4618-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L212)</sup>
4618+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L215)</sup>
46194619

46204620
MemberPropagationMode defines how changes to pod spec should be propogated.
46214621
Changes to a pod’s configuration require a restart of that pod in almost all cases.
@@ -4751,7 +4751,7 @@ This field is **immutable**: Change of the ArangoDeployment Mode is not possible
47514751

47524752
### .spec.networkAttachedVolumes
47534753

4754-
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L112)</sup>
4754+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L115)</sup>
47554755

47564756
NetworkAttachedVolumes
47574757
If set to `true`, a ResignLeadership operation will be triggered when a DB-Server pod is evicted (rather than a CleanOutServer operation).
@@ -4802,15 +4802,15 @@ Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.
48024802

48034803
### .spec.restoreEncryptionSecret
48044804

4805-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L149)</sup>
4805+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L152)</sup>
48064806

48074807
RestoreEncryptionSecret specifies optional name of secret which contains encryption key used for restore
48084808

48094809
***
48104810

48114811
### .spec.restoreFrom
48124812

4813-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L146)</sup>
4813+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L149)</sup>
48144814

48154815
RestoreFrom setting specifies a `ArangoBackup` resource name the cluster should be restored from.
48164816
After a restore or failure to do so, the status of the deployment contains information about the restore operation in the restore key.
@@ -4836,6 +4836,18 @@ The secret specified by this setting, must have a data field named 'key' contain
48364836

48374837
***
48384838

4839+
### .spec.rotate.order
4840+
4841+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_rotate_spec.go#L29)</sup>
4842+
4843+
Order defines the Rotation order
4844+
4845+
Possible Values:
4846+
* `"coordinatorFirst"` (default) - Runs restart of coordinators before DBServers.
4847+
* `"standard"` - Default restart order.
4848+
4849+
***
4850+
48394851
### .spec.single.affinity
48404852

48414853
Type: `core.PodAffinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/server_group_spec.go#L156)</sup>
@@ -7912,7 +7924,7 @@ MaintenanceGracePeriod action timeout
79127924

79137925
### .spec.timezone
79147926

7915-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L261)</sup>
7927+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_spec.go#L264)</sup>
79167928

79177929
Timezone if specified, will set a timezone for deployment.
79187930
Must be in format accepted by "tzdata", e.g. `America/New_York` or `Europe/London`
@@ -8004,7 +8016,7 @@ Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.
80048016

80058017
### .spec.upgrade.autoUpgrade
80068018

8007-
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_upgrade_spec.go#L26)</sup>
8019+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_upgrade_spec.go#L28)</sup>
80088020

80098021
AutoUpgrade flag specifies if upgrade should be auto-injected, even if is not required (in case of stuck)
80108022

@@ -8014,10 +8026,22 @@ Default Value: `false`
80148026

80158027
### .spec.upgrade.debugLog
80168028

8017-
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_upgrade_spec.go#L30)</sup>
8029+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_upgrade_spec.go#L32)</sup>
80188030

80198031
DebugLog flag specifies if containers running upgrade process should print more debugging information.
80208032
This applies only to init containers.
80218033

80228034
Default Value: `false`
80238035

8036+
***
8037+
8038+
### .spec.upgrade.order
8039+
8040+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_upgrade_spec.go#L36)</sup>
8041+
8042+
Order defines the Rotation order
8043+
8044+
Possible Values:
8045+
* `"coordinatorFirst"` (default) - Runs restart of coordinators before DBServers.
8046+
* `"standard"` - Default restart order.
8047+

pkg/apis/deployment/v1/deployment_member_status_element.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 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.
@@ -83,7 +83,7 @@ type DeploymentStatusMemberElement struct {
8383
}
8484

8585
func (ds DeploymentStatusMembers) AsList() DeploymentStatusMemberElements {
86-
return ds.AsListInGroups(AllServerGroups...)
86+
return ds.AsListInGroups(NAllServerGroups...)
8787
}
8888

8989
func (ds DeploymentStatusMembers) AsListInGroups(groups ...ServerGroup) DeploymentStatusMemberElements {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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/apis/shared"
24+
25+
type DeploymentRotateSpec struct {
26+
// Order defines the Rotation order
27+
// +doc/enum: coordinatorFirst|Runs restart of coordinators before DBServers.
28+
// +doc/enum: standard|Default restart order.
29+
Order *DeploymentSpecOrder `json:"order,omitempty"`
30+
}
31+
32+
func (d *DeploymentRotateSpec) Get() DeploymentRotateSpec {
33+
if d == nil {
34+
return DeploymentRotateSpec{}
35+
}
36+
37+
return *d
38+
}
39+
40+
func (d *DeploymentRotateSpec) GetOrder(def *DeploymentSpecOrder) DeploymentSpecOrder {
41+
if d == nil || d.Order == nil {
42+
if def == nil {
43+
return DeploymentSpecOrderCoordinatorFirst
44+
}
45+
46+
return *def
47+
}
48+
49+
return *d.Order
50+
}
51+
52+
func (d *DeploymentRotateSpec) Validate() error {
53+
if d == nil {
54+
return nil
55+
}
56+
57+
return shared.WithErrors(
58+
shared.PrefixResourceError("order", shared.ValidateOptionalInterface(d.Order)),
59+
)
60+
}

pkg/apis/deployment/v1/deployment_spec.go

+4-1
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.
@@ -100,6 +100,9 @@ type DeploymentSpec struct {
100100
// Upgrade allows to configure upgrade-related options
101101
Upgrade *DeploymentUpgradeSpec `json:"upgrade,omitempty"`
102102

103+
// Rotate allows to configure rotate-related options
104+
Rotate *DeploymentRotateSpec `json:"rotate,omitempty"`
105+
103106
// Features allows to configure feature flags
104107
Features *DeploymentFeatures `json:"features,omitempty"`
105108

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
type DeploymentSpecOrder string
26+
27+
func (d DeploymentSpecOrder) String() string {
28+
return string(d)
29+
}
30+
31+
func (d *DeploymentSpecOrder) Equal(b *DeploymentSpecOrder) bool {
32+
if d == nil && b == nil {
33+
return true
34+
}
35+
36+
if d == nil || b == nil {
37+
return false
38+
}
39+
40+
return *d == *b
41+
}
42+
43+
func (d *DeploymentSpecOrder) Validate() error {
44+
if d == nil {
45+
return nil
46+
}
47+
48+
switch v := *d; v {
49+
case DeploymentSpecOrderStandard, DeploymentSpecOrderCoordinatorFirst:
50+
return nil
51+
default:
52+
return errors.Errorf("Invalid Order `%s`", v)
53+
}
54+
}
55+
56+
func (d DeploymentSpecOrder) Groups() ServerGroups {
57+
switch d {
58+
case DeploymentSpecOrderCoordinatorFirst:
59+
return []ServerGroup{
60+
ServerGroupAgents,
61+
ServerGroupSingle,
62+
ServerGroupCoordinators,
63+
ServerGroupDBServers,
64+
ServerGroupSyncMasters,
65+
ServerGroupSyncWorkers,
66+
ServerGroupGateways,
67+
}
68+
default:
69+
return NAllServerGroups
70+
}
71+
}
72+
73+
const (
74+
DeploymentSpecOrderStandard DeploymentSpecOrder = "standard"
75+
DeploymentSpecOrderCoordinatorFirst DeploymentSpecOrder = "coordinatorFirst"
76+
)

0 commit comments

Comments
 (0)