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

[Bugfix] Use Rendered Spec in case of scheduling compare #1640

Merged
merged 1 commit into from
Apr 8, 2024
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 @@ -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