8000 [Feature] Rotation Order by ajanikow · Pull Request #1852 · arangodb/kube-arangodb · GitHub
[go: up one dir, main page]

Skip to content

[Feature] Rotation Order #1852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- (Feature) (Platform) Add Sharding to the Inventory Endpoint
- (Feature) Emit Default values in Inventory
- (Maintenance) Bump github.com/containerd/containerd to v1.7.27
- (Feature) Rotation Order

## [1.2.46](https://github.com/arangodb/kube-arangodb/tree/1.2.46) (2025-02-24)
- (Bugfix) Clean Phase change properly during upgrade
Expand Down
58 changes: 41 additions & 17 deletions docs/api/ArangoDeployment.V1.md
F438
Original file line number Diff line number Diff line change
Expand Up @@ -952,31 +952,31 @@ Links:

### .spec.allowUnsafeUpgrade

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

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

***

### .spec.annotations

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

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

***

### .spec.annotationsIgnoreList

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

AnnotationsIgnoreList list regexp or plain definitions which annotations should be ignored

***

### .spec.annotationsMode

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

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

Expand All @@ -989,7 +989,7 @@ Possible Values:

### .spec.architecture

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

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

### .spec.ClusterDomain

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

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

### .spec.communicationMethod

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

CommunicationMethod define communication method used in deployment

Expand Down Expand Up @@ -4565,23 +4565,23 @@ might be configured in the container image.

### .spec.labels

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

Labels specifies the labels added to Pods in this group.

***

### .spec.labelsIgnoreList

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

LabelsIgnoreList list regexp or plain definitions which labels should be ignored

***

### .spec.labelsMode

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

LabelsMode Define labels mode which should be use while overriding labels

Expand Down Expand Up @@ -4615,7 +4615,7 @@ Links:

### .spec.memberPropagationMode

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

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

### .spec.networkAttachedVolumes

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

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

### .spec.restoreEncryptionSecret

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

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

***

### .spec.restoreFrom

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

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

***

### .spec.rotate.order

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_rotate_spec.go#L29)</sup>

Order defines the Rotation order

Possible Values:
* `"coordinatorFirst"` (default) - Runs restart of coordinators before DBServers.
* `"standard"` - Default restart order.

***

### .spec.single.affinity

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>
Expand Down Expand Up @@ -7912,7 +7924,7 @@ MaintenanceGracePeriod action timeout

### .spec.timezone

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

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

### .spec.upgrade.autoUpgrade

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

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

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

### .spec.upgrade.debugLog

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

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

Default Value: `false`

***

### .spec.upgrade.order

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.46/pkg/apis/deployment/v1/deployment_upgrade_spec.go#L36)</sup>

Order defines the Upgrade order

Possible Values:
* `"standard"` (default) - Default restart order.
* `"coordinatorFirst"` - Runs restart of coordinators before DBServers.

2 changes: 1 addition & 1 deletion pkg/apis/deployment/v1/deployment_member_status_element.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
60 changes: 60 additions & 0 deletions pkg/apis/deployment/v1/deployment_rotate_spec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// DISCLAIMER
//
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//

package v1

import shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"

type DeploymentRotateSpec struct {
// Order defines the Rotation order
// +doc/enum: coordinatorFirst|Runs restart of coordinators before DBServers.
// +doc/enum: standard|Default restart order.
Order *DeploymentSpecOrder `json:"order,omitempty"`
}

func (d *DeploymentRotateSpec) Get() DeploymentRotateSpec {
if d == nil {
return DeploymentRotateSpec{}
}

return *d
}

func (d *DeploymentRotateSpec) GetOrder(def *DeploymentSpecOrder) DeploymentSpecOrder {
if d == nil || d.Order == nil {
if def == nil {
return DeploymentSpecOrderCoordinatorFirst
}

return *def
}

return *d.Order
}

func (d *DeploymentRotateSpec) Validate() error {
if d == nil {
return nil
}

return shared.WithErrors(
shared.PrefixResourceError("order", shared.ValidateOptionalInterface(d.Order)),
)
}
5 changes: 4 additions & 1 deletion pkg/apis/deployment/v1/deployment_spec.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -100,6 +100,9 @@ type DeploymentSpec struct {
// Upgrade allows to configure upgrade-related options
Upgrade *DeploymentUpgradeSpec `json:"upgrade,omitempty"`

// Rotate allows to configure rotate-related options
Rotate *DeploymentRotateSpec `json:"rotate,omitempty"`

// Features allows to configure feature flags
Features *DeploymentFeatures `json:"features,omitempty"`

Expand Down
76 changes: 76 additions & 0 deletions pkg/apis/deployment/v1/deployment_spec_order.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//
// DISCLAIMER
//
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//

package v1

import "github.com/arangodb/kube-arangodb/pkg/util/errors"

type DeploymentSpecOrder string

func (d DeploymentSpecOrder) String() string {
return string(d)
}

func (d *DeploymentSpecOrder) Equal(b *DeploymentSpecOrder) bool {
if d == nil && b == nil {
return true
}

if d == nil || b == nil {
return false
}

return *d == *b
}

func (d *DeploymentSpecOrder) Validate() error {
if d == nil {
return nil
}

switch v := *d; v {
case DeploymentSpecOrderStandard, DeploymentSpecOrderCoordinatorFirst:
return nil
default:
return errors.Errorf("Invalid Order `%s`", v)
}
}

func (d DeploymentSpecOrder) Groups() ServerGroups {
switch d {
case DeploymentSpecOrderCoordinatorFirst:
return []ServerGroup{
ServerGroupAgents,
ServerGroupSingle,
ServerGroupCoordinators,
ServerGroupDBServers,
ServerGroupSyncMasters,
ServerGroupSyncWorkers,
ServerGroupGateways,
}
default:
return AllServerGroups
}
}

const (
DeploymentSpecOrderStandard DeploymentSpecOrder = "standard"
DeploymentSpecOrderCoordinatorFirst DeploymentSpecOrder = "coordinatorFirst"
)
Loading
0