Skip to content
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

GT-495 Make scale_down_candidate annotation obsolete #1429

Merged
merged 6 commits into from
Oct 13, 2023
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 @@ -11,6 +11,7 @@
- (Maintenance) Add IndexMethod Documentation
- (Bugfix) Fix VersionCheck args propagation
- (Feature) EnforcedResignLeadership action
- (Maintenance) Make scale_down_candidate annotation obsolete

## [1.2.33](https://github.com/arangodb/kube-arangodb/tree/1.2.33) (2023-09-27)
- (Maintenance) Bump golang.org/x/net to v0.13.0
Expand Down
18 changes: 10 additions & 8 deletions pkg/apis/deployment/annotations.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-2023 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 All @@ -21,12 +21,14 @@
package deployment

const (
ArangoDeploymentAnnotationPrefix = "deployment.arangodb.com"
ArangoDeploymentPodMaintenanceAnnotation = ArangoDeploymentAnnotationPrefix + "/maintenance"
ArangoDeploymentPodChangeArchAnnotation = ArangoDeploymentAnnotationPrefix + "/arch"
ArangoDeploymentPodRotateAnnotation = ArangoDeploymentAnnotationPrefix + "/rotate"
ArangoDeploymentPodReplaceAnnotation = ArangoDeploymentAnnotationPrefix + "/replace"
ArangoDeploymentPodDeleteNow = ArangoDeploymentAnnotationPrefix + "/delete_now"
ArangoDeploymentAnnotationPrefix = "deployment.arangodb.com"
ArangoDeploymentPodMaintenanceAnnotation = ArangoDeploymentAnnotationPrefix + "/maintenance"
ArangoDeploymentPodChangeArchAnnotation = ArangoDeploymentAnnotationPrefix + "/arch"
ArangoDeploymentPodRotateAnnotation = ArangoDeploymentAnnotationPrefix + "/rotate"
ArangoDeploymentPodReplaceAnnotation = ArangoDeploymentAnnotationPrefix + "/replace"
ArangoDeploymentPodDeleteNow = ArangoDeploymentAnnotationPrefix + "/delete_now"
ArangoDeploymentPlanCleanAnnotation = "plan." + ArangoDeploymentAnnotationPrefix + "/clean"

// Deprecated: use ArangoMemberSpec.DeletionPriority instead
ArangoDeploymentPodScaleDownCandidateAnnotation = ArangoDeploymentAnnotationPrefix + "/scale_down_candidate"
ArangoDeploymentPlanCleanAnnotation = "plan." + ArangoDeploymentAnnotationPrefix + "/clean"
)
3 changes: 3 additions & 0 deletions pkg/apis/deployment/v1/arango_member_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type ArangoMemberSpec struct {
// Template keeps template which is gonna be applied on the Pod.
Template *ArangoMemberPodTemplate `json:"template,omitempty"`

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

Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/deployment/v2alpha1/arango_member_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type ArangoMemberSpec struct {
// Template keeps template which is gonna be applied on the Pod.
Template *ArangoMemberPodTemplate `json:"template,omitempty"`

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

Expand Down
2 changes: 2 additions & 0 deletions pkg/deployment/reconcile/plan_builder_scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,13 @@ func (r *Reconciler) scaleDownCandidate(ctx context.Context, apiObject k8sutil.A
continue
}

//nolint:staticcheck
if _, ok := am.Annotations[deployment.ArangoDeploymentPodScaleDownCandidateAnnotation]; ok {
annotationExists = true
}

if pod, ok := cache.Pod().V1().GetSimple(m.Member.Pod.GetName()); ok {
//nolint:staticcheck
if _, ok := pod.Annotations[deployment.ArangoDeploymentPodScaleDownCandidateAnnotation]; ok {
annotationExists = true
}
Expand Down