mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Bugfix] Use Rendered Spec in case of scheduling compare (#1640)
This commit is contained in:
parent
f5c362eba7
commit
a4d7331a0c
2 changed files with 22 additions and 22 deletions
|
@ -19,6 +19,7 @@
|
||||||
- (Feature) Scheduler BatchJob Integration Service
|
- (Feature) Scheduler BatchJob Integration Service
|
||||||
- (Maintenance) Update Go to 1.22.2
|
- (Maintenance) Update Go to 1.22.2
|
||||||
- (Feature) Object Checksum
|
- (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)
|
## [1.2.39](https://github.com/arangodb/kube-arangodb/tree/1.2.39) (2024-03-11)
|
||||||
- (Feature) Extract Scheduler API
|
- (Feature) Extract Scheduler API
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// DISCLAIMER
|
// DISCLAIMER
|
||||||
//
|
//
|
||||||
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
|
// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -67,33 +67,32 @@ func (r *Reconciler) createMemberPodSchedulingFailurePlan(ctx context.Context,
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.isSchedulingParametersChanged(renderedPod.Spec, m.Member, context) {
|
cache, ok := context.ACS().ClusterCache(m.Member.ClusterID)
|
||||||
l.Info("Adding KillMemberPod action: scheduling failed and parameters already updated")
|
if !ok {
|
||||||
p = append(p,
|
continue
|
||||||
actions.NewAction(api.ActionTypeKillMemberPod, m.Group, m.Member, "Scheduling failed"),
|
}
|
||||||
)
|
|
||||||
|
memberName := m.Member.ArangoMemberName(context.GetName(), m.Group)
|
||||||
|
member, ok := cache.ArangoMember().V1().GetSimple(memberName)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
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 p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *Reconciler) schedulingParametersAreTheSame(expectedSpec, actualSpec core.PodSpec) bool {
|
func (r *Reconciler) schedulingParametersAreTheSame(expectedSpec, actualSpec core.PodSpec) bool {
|
||||||
if expectedSpec.PriorityClassName != actualSpec.PriorityClassName {
|
if expectedSpec.PriorityClassName != actualSpec.PriorityClassName {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue