Skip to content

Commit f750540

Browse files
authored
[Feature] Promote RestartPolicy Always Feature (#1872)
1 parent 7d2b41d commit f750540

15 files changed

+577
-146
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- (Feature) AutoDiscover Operator Access
1111
- (Feature) (Platform) Adjust Gateway timeouts
1212
- (Feature) (Platform) Docs and Installer improvements
13+
- (Feature) Promote RestartPolicy Always Feature
1314

1415
## [1.2.47](https://github.com/arangodb/kube-arangodb/tree/1.2.47) (2025-03-28)
1516
- (Bugfix) Use Profile Annotations

docs/api/ArangoDeployment.V1.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,21 @@ Links:
609609

610610
***
611611

612+
### .spec.agents.restartPolicy
613+
614+
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>
615+
616+
RestartPolicy for all pods within the group.
617+
618+
Links:
619+
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)
620+
621+
Possible Values:
622+
* `"Always"` (default) - Means that containers within the pod are always restarted.
623+
* `"Never"` - Means that containers within the pod are never restarted.
624+
625+
***
626+
612627
### .spec.agents.schedulerName
613628

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

16921707
***
16931708

1709+
### .spec.coordinators.restartPolicy
1710+
1711+
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>
1712+
1713+
RestartPolicy for all pods within the group.
1714+
1715+
Links:
1716+
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)
1717+
1718+
Possible Values:
1719+
* `"Always"` (default) - Means that containers within the pod are always restarted.
1720+
* `"Never"` - Means that containers within the pod are never restarted.
1721+
1722+
***
1723+
16941724
### .spec.coordinators.schedulerName
16951725

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

26422672
***
26432673

2674+
### .spec.dbservers.restartPolicy
2675+
2676+
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>
2677+
2678+
RestartPolicy for all pods within the group.
2679+
2680+
Links:
2681+
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)
2682+
2683+
Possible Values:
2684+
* `"Always"` (default) - Means that containers within the pod are always restarted.
2685+
* `"Never"` - Means that containers within the pod are never restarted.
2686+
2687+
***
2688+
26442689
### .spec.dbservers.schedulerName
26452690

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

37553800
***
37563801

3802+
### .spec.gateways.restartPolicy
3803+
3804+
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>
3805+
3806+
RestartPolicy for all pods within the group.
3807+
3808+
Links:
3809+
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)
3810+
3811+
Possible Values:
3812+
* `"Always"` (default) - Means that containers within the pod are always restarted.
3813+
* `"Never"` - Means that containers within the pod are never restarted.
3814+
3815+
***
3816+
37573817
### .spec.gateways.schedulerName
37583818

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

54705530
***
54715531

5532+
### .spec.single.restartPolicy
5533+
5534+
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>
5535+
5536+
RestartPolicy for all pods within the group.
5537+
5538+
Links:
5539+
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)
5540+
5541+
Possible Values:
5542+
* `"Always"` (default) - Means that containers within the pod are always restarted.
5543+
* `"Never"` - Means that containers within the pod are never restarted.
5544+
5545+
***
5546+
54725547
### .spec.single.schedulerName
54735548

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

66346709
***
66356710

6711+
### .spec.syncmasters.restartPolicy
6712+
6713+
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>
6714+
6715+
RestartPolicy for all pods within the group.
6716+
6717+
Links:
6718+
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)
6719+
6720+
Possible Values:
6721+
* `"Always"` (default) - Means that containers within the pod are always restarted.
6722+
* `"Never"` - Means that containers within the pod are never restarted.
6723+
6724+
***
6725+
66366726
### .spec.syncmasters.schedulerName
66376727

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

75767666
***
75777667

7668+
### .spec.syncworkers.restartPolicy
7669+
7670+
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>
7671+
7672+
RestartPolicy for all pods within the group.
7673+
7674+
Links:
7675+
* [Documentation of core.RestartPolicy](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po)
7676+
7677+
Possible Values:
7678+
* `"Always"` (default) - Means that containers within the pod are always restarted.
7679+
* `"Never"` - Means that containers within the pod are never restarted.
7680+
7681+
***
7682+
75787683
### .spec.syncworkers.schedulerName
75797684

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

pkg/apis/deployment/v1/member_status.go

Lines changed: 36 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.
@@ -136,6 +136,41 @@ func (s MemberStatus) Age() time.Duration {
136136
return time.Since(s.CreatedAt.Time)
137137
}
138138

139+
// AppendLastTermination appends termination to the list if required
140+
func (s *MemberStatus) AppendLastTermination(termination time.Time) bool {
141+
if s == nil {
142+
return false
143+
}
144+
145+
if len(s.RecentTerminations) == 0 {
146+
s.RecentTerminations = []meta.Time{
147+
meta.NewTime(termination),
148+
}
149+
return true
150+
}
151+
152+
if s.RecentTerminations[0].Time.Before(termination) {
153+
s.RecentTerminations = append([]meta.Time{meta.NewTime(termination)}, s.RecentTerminations...)
154+
155+
return true
156+
}
157+
158+
return false
159+
}
160+
161+
// LastTermination returns last termination time
162+
func (s *MemberStatus) LastTermination() time.Time {
163+
if s == nil {
164+
return time.Time{}
165+
}
166+
167+
if len(s.RecentTerminations) == 0 {
168+
return time.Time{}
169+
}
170+
171+
return s.RecentTerminations[0].Time
172+
}
173+
139174
// RemoveTerminationsBefore removes all recent terminations before the given timestamp.
140175
// It returns the number of terminations that have been removed.
141176
func (s *MemberStatus) RemoveTerminationsBefore(timestamp time.Time) int {

pkg/apis/deployment/v1/server_group_spec.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ type ServerGroupSpec struct {
215215
// +doc/enum: replace|Replaces server instead of upgrading. Takes an effect only on DBServer
216216
// +doc/default: inplace
217217
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`
218+
219+
// RestartPolicy for all pods within the group.
220+
// +doc/type: core.RestartPolicy
221+
// +doc/enum: Always|Means that containers within the pod are always restarted.
222+
// +doc/enum: Never|Means that containers within the pod are never restarted.
223+
// +doc/link: Documentation of core.RestartPolicy|https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po
224+
RestartPolicy *core.RestartPolicy `json:"restartPolicy,omitempty"`
218225
}
219226

220227
func (s *ServerGroupSpec) Get() ServerGroupSpec {

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/member_status.go

Lines changed: 36 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.
@@ -136,6 +136,41 @@ func (s MemberStatus) Age() time.Duration {
136136
return time.Since(s.CreatedAt.Time)
137137
}
138138

139+
// AppendLastTermination appends termination to the list if required
140+
func (s *MemberStatus) AppendLastTermination(termination time.Time) bool {
141+
if s == nil {
142+
return false
143+
}
144+
145+
if len(s.RecentTerminations) == 0 {
146+
s.RecentTerminations = []meta.Time{
147+
meta.NewTime(termination),
148+
}
149+
return true
150+
}
151+
152+
if s.RecentTerminations[0].Time.Before(termination) {
153+
s.RecentTerminations = append([]meta.Time{meta.NewTime(termination)}, s.RecentTerminations...)
154+
155+
return true
156+
}
157+
158+
return false
159+
}
160+
161+
// LastTermination returns last termination time
162+
func (s *MemberStatus) LastTermination() time.Time {
163+
if s == nil {
164+
return time.Time{}
165+
}
166+
167+
if len(s.RecentTerminations) == 0 {
168+
return time.Time{}
169+
}
170+
171+
return s.RecentTerminations[0].Time
172+
}
173+
139174
// RemoveTerminationsBefore removes all recent terminations before the given timestamp.
140175
// It returns the number of terminations that have been removed.
141176
func (s *MemberStatus) RemoveTerminationsBefore(timestamp time.Time) int {

pkg/apis/deployment/v2alpha1/server_group_spec.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ type ServerGroupSpec struct {
215215
// +doc/enum: replace|Replaces server instead of upgrading. Takes an effect only on DBServer
216216
// +doc/default: inplace
217217
UpgradeMode *ServerGroupUpgradeMode `json:"upgradeMode,omitempty"`
218+
219+
// RestartPolicy for all pods within the group.
220+
// +doc/type: core.RestartPolicy
221+
// +doc/enum: Always|Means that containers within the pod are always restarted.
222+
// +doc/enum: Never|Means that containers within the pod are never restarted.
223+
// +doc/link: Documentation of core.RestartPolicy|https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-po
224+
RestartPolicy *core.RestartPolicy `json:"restartPolicy,omitempty"`
218225
}
219226

220227
func (s *ServerGroupSpec) Get() ServerGroupSpec {

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)