Skip to content

Commit 999afcb

Browse files
authored
GT-495 Make scale_down_candidate annotation obsolete (#1429)
1 parent 411efad commit 999afcb

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- (Maintenance) Add IndexMethod Documentation
1212
- (Bugfix) Fix VersionCheck args propagation
1313
- (Feature) EnforcedResignLeadership action
14+
- (Maintenance) Make scale_down_candidate annotation obsolete
1415

1516
## [1.2.33](https://github.com/arangodb/kube-arangodb/tree/1.2.33) (2023-09-27)
1617
- (Maintenance) Bump golang.org/x/net to v0.13.0

pkg/apis/deployment/annotations.go

Lines changed: 10 additions & 8 deletions
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-2023 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.
@@ -21,12 +21,14 @@
2121
package deployment
2222

2323
const (
24-
ArangoDeploymentAnnotationPrefix = "deployment.arangodb.com"
25-
ArangoDeploymentPodMaintenanceAnnotation = ArangoDeploymentAnnotationPrefix + "/maintenance"
26-
ArangoDeploymentPodChangeArchAnnotation = ArangoDeploymentAnnotationPrefix + "/arch"
27-
ArangoDeploymentPodRotateAnnotation = ArangoDeploymentAnnotationPrefix + "/rotate"
28-
ArangoDeploymentPodReplaceAnnotation = ArangoDeploymentAnnotationPrefix + "/replace"
29-
ArangoDeploymentPodDeleteNow = ArangoDeploymentAnnotationPrefix + "/delete_now"
24+
ArangoDeploymentAnnotationPrefix = "deployment.arangodb.com"
25+
ArangoDeploymentPodMaintenanceAnnotation = ArangoDeploymentAnnotationPrefix + "/maintenance"
26+
ArangoDeploymentPodChangeArchAnnotation = ArangoDeploymentAnnotationPrefix + "/arch"
27+
ArangoDeploymentPodRotateAnnotation = ArangoDeploymentAnnotationPrefix + "/rotate"
28+
ArangoDeploymentPodReplaceAnnotation = ArangoDeploymentAnnotationPrefix + "/replace"
29+
ArangoDeploymentPodDeleteNow = ArangoDeploymentAnnotationPrefix + "/delete_now"
30+
ArangoDeploymentPlanCleanAnnotation = "plan." + ArangoDeploymentAnnotationPrefix + "/clean"
31+
32+
// Deprecated: use ArangoMemberSpec.DeletionPriority instead
3033
ArangoDeploymentPodScaleDownCandidateAnnotation = ArangoDeploymentAnnotationPrefix + "/scale_down_candidate"
31-
ArangoDeploymentPlanCleanAnnotation = "plan." + ArangoDeploymentAnnotationPrefix + "/clean"
3234
)

pkg/apis/deployment/v1/arango_member_spec.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ type ArangoMemberSpec struct {
4141
// Template keeps template which is gonna be applied on the Pod.
4242
Template *ArangoMemberPodTemplate `json:"template,omitempty"`
4343

44+
// DeletionPriority define Deletion Priority.
45+
// Higher value means higher priority. Default is 0.
46+
// Example: set 1 for Coordinator which should be deleted first and scale down coordinators by one.
4447
DeletionPriority *int `json:"deletion_priority,omitempty"`
4548
}
4649

pkg/apis/deployment/v2alpha1/arango_member_spec.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ type ArangoMemberSpec struct {
4141
// Template keeps template which is gonna be applied on the Pod.
4242
Template *ArangoMemberPodTemplate `json:"template,omitempty"`
4343

44+
// DeletionPriority define Deletion Priority.
45+
// Higher value means higher priority. Default is 0.
46+
// Example: set 1 for Coordinator which should be deleted first and scale down coordinators by one.
4447
DeletionPriority *int `json:"deletion_priority,omitempty"`
4548
}
4649

pkg/deployment/reconcile/plan_builder_scale.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,13 @@ func (r *Reconciler) scaleDownCandidate(ctx context.Context, apiObject k8sutil.A
185185
continue
186186
}
187187

188+
//nolint:staticcheck
188189
if _, ok := am.Annotations[deployment.ArangoDeploymentPodScaleDownCandidateAnnotation]; ok {
189190
annotationExists = true
190191
}
191192

192193
if pod, ok := cache.Pod().V1().GetSimple(m.Member.Pod.GetName()); ok {
194+
//nolint:staticcheck
193195
if _, ok := pod.Annotations[deployment.ArangoDeploymentPodScaleDownCandidateAnnotation]; ok {
194196
annotationExists = true
195197
}

0 commit comments

Comments
 (0)