Skip to content

[Feature] Promote RestartPolicy Always Feature #1872

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 6 commits into from
Apr 22, 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 @@ -10,6 +10,7 @@
- (Feature) AutoDiscover Operator Access
- (Feature) (Platform) Adjust Gateway timeouts
- (Feature) (Platform) Docs and Installer improvements
- (Feature) Promote RestartPolicy Always Feature

## [1.2.47](https://github.com/arangodb/kube-arangodb/tree/1.2.47) (2025-03-28)
- (Bugfix) Use Profile Annotations
Expand Down
105 changes: 105 additions & 0 deletions docs/api/ArangoDeployment.V1.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,21 @@ Links:

***

### .spec.agents.restartPolicy

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

RestartPolicy for all pods within the group.

Links:
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)

Possible Values:
* `"Always"` (default) - Means that containers within the pod are always restarted.
* `"Never"` - Means that containers within the pod are never restarted.

***

### .spec.agents.schedulerName

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.47/pkg/apis/deployment/v1/server_group_spec.go#L58)</sup>
Expand Down Expand Up @@ -1691,6 +1706,21 @@ Links:

***

### .spec.coordinators.restartPolicy

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

RestartPolicy for all pods within the group.

Links:
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)

Possible Values:
* `"Always"` (default) - Means that containers within the pod are always restarted.
* `"Never"` - Means that containers within the pod are never restarted.

***

### .spec.coordinators.schedulerName

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.47/pkg/apis/deployment/v1/server_group_spec.go#L58)</sup>
Expand Down Expand Up @@ -2641,6 +2671,21 @@ Links:

***

### .spec.dbservers.restartPolicy

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

RestartPolicy for all pods within the group.

Links:
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)

Possible Values:
* `"Always"` (default) - Means that containers within the pod are always restarted.
* `"Never"` - Means that containers within the pod are never restarted.

***

### .spec.dbservers.schedulerName

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.47/pkg/apis/deployment/v1/server_group_spec.go#L58)</sup>
Expand Down Expand Up @@ -3754,6 +3799,21 @@ Links:

***

### .spec.gateways.restartPolicy

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

RestartPolicy for all pods within the group.

Links:
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)

Possible Values:
* `"Always"` (default) - Means that containers within the pod are always restarted.
* `"Never"` - Means that containers within the pod are never restarted.

***

### .spec.gateways.schedulerName

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.47/pkg/apis/deployment/v1/server_group_spec.go#L58)</sup>
Expand Down Expand Up @@ -5469,6 +5529,21 @@ Links:

***

### .spec.single.restartPolicy

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

RestartPolicy for all pods within the group.

Links:
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)

Possible Values:
* `"Always"` (default) - Means that containers within the pod are always restarted.
* `"Never"` - Means that containers within the pod are never restarted.

***

### .spec.single.schedulerName

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.47/pkg/apis/deployment/v1/server_group_spec.go#L58)</sup>
Expand Down Expand Up @@ -6633,6 +6708,21 @@ Links:

***

### .spec.syncmasters.restartPolicy

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

RestartPolicy for all pods within the group.

Links:
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)

Possible Values:
* `"Always"` (default) - Means that containers within the pod are always restarted.
* `"Never"` - Means that containers within the pod are never restarted.

***

### .spec.syncmasters.schedulerName

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.47/pkg/apis/deployment/v1/server_group_spec.go#L58)</sup>
Expand Down Expand Up @@ -7575,6 +7665,21 @@ Links:

***

### .spec.syncworkers.restartPolicy

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

RestartPolicy for all pods within the group.

Links:
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)

Possible Values:
* `"Always"` (default) - Means that containers within the pod are always restarted.
* `"Never"` - Means that containers within the pod are never restarted.

***

### .spec.syncworkers.schedulerName

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.47/pkg/apis/deployment/v1/server_group_spec.go#L58)</sup>
Expand Down
37 changes: 36 additions & 1 deletion pkg/apis/deployment/v1/member_status.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 @@ -136,6 +136,41 @@ func (s MemberStatus) Age() time.Duration {
return time.Since(s.CreatedAt.Time)
}

// AppendLastTermination appends termination to the list if required
func (s *MemberStatus) AppendLastTermination(termination time.Time) bool {
if s == nil {
return false
}

if len(s.RecentTerminations) == 0 {
s.RecentTerminations = []meta.Time{
meta.NewTime(termination),
}
return true
}

if s.RecentTerminations[0].Time.Before(termination) {
s.RecentTerminations = append([]meta.Time{meta.NewTime(termination)}, s.RecentTerminations...)

return true
}

return false
}

// LastTermination returns last termination time
func (s *MemberStatus) LastTermination() time.Time {
if s == nil {
return time.Time{}
}

if len(s.RecentTerminations) == 0 {
return time.Time{}
}

return s.RecentTerminations[0].Time
}

// RemoveTerminationsBefore removes all recent terminations before the given timestamp.
// It returns the number of terminations that have been removed.
func (s *MemberStatus) RemoveTerminationsBefore(timestamp time.Time) int {
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/deployment/v1/server_group_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ type ServerGroupSpec struct {
// +doc/enum: replace|Replaces server instead of upgrading. Takes an effect only on DBServer
// +doc/default: inplace
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`

// RestartPolicy for all pods within the group.
// +doc/type: core.RestartPolicy
// +doc/enum: Always|Means that containers within the pod are always restarted.
// +doc/enum: Never|Means that containers within the pod are never restarted.
// +doc/link: Documentation of core.RestartPolicy|https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po
RestartPolicy *core.RestartPolicy `json:"restartPolicy,omitempty"`
}

func (s *ServerGroupSpec) Get() ServerGroupSpec {
Expand Down
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.

37 changes: 36 additions & 1 deletion pkg/apis/deployment/v2alpha1/member_status.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 @@ -136,6 +136,41 @@ func (s MemberStatus) Age() time.Duration {
return time.Since(s.CreatedAt.Time)
}

// AppendLastTermination appends termination to the list if required
func (s *MemberStatus) AppendLastTermination(termination time.Time) bool {
if s == nil {
return false
}

if len(s.RecentTerminations) == 0 {
s.RecentTerminations = []meta.Time{
meta.NewTime(termination),
}
return true
}

if s.RecentTerminations[0].Time.Before(termination) {
s.RecentTerminations = append([]meta.Time{meta.NewTime(termination)}, s.RecentTerminations...)

return true
}

return false
}

// LastTermination returns last termination time
func (s *MemberStatus) LastTermination() time.Time {
if s == nil {
return time.Time{}
}

if len(s.RecentTerminations) == 0 {
return time.Time{}
}

return s.RecentTerminations[0].Time
}

// RemoveTerminationsBefore removes all recent terminations before the given timestamp.
// It returns the number of terminations that have been removed.
func (s *MemberStatus) RemoveTerminationsBefore(timestamp time.Time) int {
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/deployment/v2alpha1/server_group_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ type ServerGroupSpec struct {
// +doc/enum: replace|Replaces server instead of upgrading. Takes an effect only on DBServer
// +doc/default: inplace
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`

// RestartPolicy for all pods within the group.
// +doc/type: core.RestartPolicy
// +doc/enum: Always|Means that containers within the pod are always restarted.
// +doc/enum: Never|Means that containers within the pod are never restarted.
// +doc/link: Documentation of core.RestartPolicy|https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po
RestartPolicy *core.RestartPolicy `json:"restartPolicy,omitempty"`
}

func (s *ServerGroupSpec) Get() ServerGroupSpec {
Expand Down
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