Skip to content

Commit

Permalink
[Bugfix] Use Rendered Spec in case of scheduling compare (#1640)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow authored Apr 8, 2024
1 parent f5c362e commit a4d7331
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- (Feature) Scheduler BatchJob Integration Service
- (Maintenance) Update Go to 1.22.2
- (Feature) Object Checksum
- (Bugfix) Use Rendered Spec in case of scheduling compare

## [1.2.39](https://github.com/arangodb/kube-arangodb/tree/1.2.39) (2024-03-11)
- (Feature) Extract Scheduler API
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2023-2024 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 @@ -67,31 +67,30 @@ func (r *Reconciler) createMemberPodSchedulingFailurePlan(ctx context.Context,
continue
}

if r.isSchedulingParametersChanged(renderedPod.Spec, m.Member, context) {
l.Info("Adding KillMemberPod action: scheduling failed and parameters already updated")
p = append(p,
actions.NewAction(api.ActionTypeKillMemberPod, m.Group, m.Member, "Scheduling failed"),
)
cache, ok := context.ACS().ClusterCache(m.Member.ClusterID)
if !ok {
continue
}
}

return p
}
memberName := m.Member.ArangoMemberName(context.GetName(), m.Group)
member, ok := cache.ArangoMember().V1().GetSimple(memberName)
if !ok {
continue
}

// isSchedulingParametersChanged returns true if parameters related to pod scheduling has changed
func (r *Reconciler) isSchedulingParametersChanged(expectedSpec core.PodSpec, member api.MemberStatus, context PlanBuilderContext) bool {
cache, ok := context.ACS().ClusterCache(member.ClusterID)
if !ok {
return false
}
pod, ok := cache.Pod().V1().GetSimple(member.Pod.GetName())
if !ok {
return false
}
if r.schedulingParametersAreTheSame(expectedSpec, pod.Spec) {
return false
if template := member.Spec.Template; template != nil {
if pod := template.PodSpec; pod != nil {
if !r.schedulingParametersAreTheSame(renderedPod.Spec, pod.Spec) {
l.Info("Adding KillMemberPod action: scheduling failed and parameters already updated")
p = append(p,
actions.NewAction(api.ActionTypeKillMemberPod, m.Group, m.Member, "Scheduling failed"),
)
}
}
}
}
return true

return p
}

func (r *Reconciler) schedulingParametersAreTheSame(expectedSpec, actualSpec core.PodSpec) bool {
Expand Down

0 comments on commit a4d7331

Please sign in to comment.