Skip to content

[Feature] UpgradeByReplace Flow #1821

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 1 commit into from
Feb 14, 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 @@ -13,6 +13,7 @@
- (Bugfix) Fix Manifests
- (Bugfix) Agency Cache Reload
- (Feature) Allow to continue if ResignServer job is gone
- (Feature) UpgradeByReplace Flow

## [1.2.44](https://github.com/arangodb/kube-arangodb/tree/1.2.44) (2025-02-03)
- (Maintenance) Kubernetes 1.31.1 libraries
Expand Down
56 changes: 56 additions & 0 deletions docs/api/ArangoDeployment.V1.md
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,14 @@ Links:

***

### .spec.agents.upgradeMode

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

UpgradeMode Defines the upgrade mode for the Member

***

### .spec.agents.volumeAllowShrink

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

***

### .spec.coordinators.upgradeMode

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

UpgradeMode Defines the upgrade mode for the Member

***

### .spec.coordinators.volumeAllowShrink

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

***

### .spec.dbservers.upgradeMode

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

UpgradeMode Defines the upgrade mode for the Member

***

### .spec.dbservers.volumeAllowShrink

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

***

### .spec.gateways.upgradeMode

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

UpgradeMode Defines the upgrade mode for the Member

***

### .spec.gateways.volumeAllowShrink

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

***

### .spec.single.upgradeMode

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

UpgradeMode Defines the upgrade mode for the Member

***

### .spec.single.volumeAllowShrink

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

***

### .spec.syncmasters.upgradeMode

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

UpgradeMode Defines the upgrade mode for the Member

***

### .spec.syncmasters.volumeAllowShrink

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

***

### .spec.syncworkers.upgradeMode

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

UpgradeMode Defines the upgrade mode for the Member

***

### .spec.syncworkers.volumeAllowShrink

Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.44/pkg/apis/deployment/v1/server_group_spec.go#L148)</sup>
Expand Down
5 changes: 4 additions & 1 deletion pkg/apis/deployment/v1/server_group_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 @@ -212,6 +212,9 @@ type ServerGroupSpec struct {

// Numactl define Numactl options passed to the process
Numactl *ServerGroupSpecNumactl `json:"numactl,omitempty"`

// UpgradeMode Defines the upgrade mode for the Member
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`
}

func (s *ServerGroupSpec) Get() ServerGroupSpec {
Expand Down
64 changes: 64 additions & 0 deletions pkg/apis/deployment/v1/server_group_spec_upgrade_mode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// 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"

// ServerGroupUpgradeMode is used to define Upgrade mode of the Pod
type ServerGroupUpgradeMode string

const (
// ServerGroupUpgradeModeInplace define Inplace Upgrade procedure (with Upgrade initContainer).
ServerGroupUpgradeModeInplace ServerGroupUpgradeMode = "inplace"

// ServerGroupUpgradeModeReplace Replaces server instead of upgrading. Takes an effect only on DBServer
ServerGroupUpgradeModeReplace ServerGroupUpgradeMode = "replace"

// DefaultServerGroupUpgradeMode defaults to ServerGroupUpgradeModeInplace
DefaultServerGroupUpgradeMode = ServerGroupUpgradeModeInplace
)

func (n *ServerGroupUpgradeMode) Validate() error {
switch v := n.Get(); v {
case ServerGroupUpgradeModeInplace, ServerGroupUpgradeModeReplace:
return nil
default:
return errors.WithStack(errors.Wrapf(ValidationError, "Unknown UpgradeMode %s", v.String()))
}
}

func (n *ServerGroupUpgradeMode) Get() ServerGroupUpgradeMode {
if n == nil {
return DefaultServerGroupUpgradeMode
}

return *n
}

func (n *ServerGroupUpgradeMode) String() string {
return string(n.Get())
}

func (n *ServerGroupUpgradeMode) New() *ServerGroupUpgradeMode {
v := n.Get()

return &v
}
5 changes: 5 additions & 0 deletions pkg/apis/deployment/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pkg/apis/deployment/v2alpha1/server_group_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 @@ -212,6 +212,9 @@ type ServerGroupSpec struct {

// Numactl define Numactl options passed to the process
Numactl *ServerGroupSpecNumactl `json:"numactl,omitempty"`

// UpgradeMode Defines the upgrade mode for the Member
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`
}

func (s *ServerGroupSpec) Get() ServerGroupSpec {
Expand Down
64 changes: 64 additions & 0 deletions pkg/apis/deployment/v2alpha1/server_group_spec_upgrade_mode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// 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 v2alpha1

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

// ServerGroupUpgradeMode is used to define Upgrade mode of the Pod
type ServerGroupUpgradeMode string

const (
// ServerGroupUpgradeModeInplace define Inplace Upgrade procedure (with Upgrade initContainer).
ServerGroupUpgradeModeInplace ServerGroupUpgradeMode = "inplace"

// ServerGroupUpgradeModeReplace Replaces server instead of upgrading. Takes an effect only on DBServer
ServerGroupUpgradeModeReplace ServerGroupUpgradeMode = "replace"

// DefaultServerGroupUpgradeMode defaults to ServerGroupUpgradeModeInplace
DefaultServerGroupUpgradeMode = ServerGroupUpgradeModeInplace
)

func (n *ServerGroupUpgradeMode) Validate() error {
switch v := n.Get(); v {
case ServerGroupUpgradeModeInplace, ServerGroupUpgradeModeReplace:
return nil
default:
return errors.WithStack(errors.Wrapf(ValidationError, "Unknown UpgradeMode %s", v.String()))
}
}

func (n *ServerGroupUpgradeMode) Get() ServerGroupUpgradeMode {
if n == nil {
return DefaultServerGroupUpgradeMode
}

return *n
}

func (n *ServerGroupUpgradeMode) String() string {
return string(n.Get())
}

func (n *ServerGroupUpgradeMode) New() *ServerGroupUpgradeMode {
v := n.Get()

return &v
}
5 changes: 5 additions & 0 deletions pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading