Skip to content

Commit 1adbf38

Browse files
authored
[Feature] Pod Scheduled condition (#1152)
1 parent 7e9b97d commit 1adbf38

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- (Bugfix) Fix Go routine leak
1515
- (Feature) Extend Pod Security context
1616
- (Improvement) Update DeploymentReplicationStatus on configuration error
17+
- (Feature) Pod Scheduled condition
1718

1819
## [1.2.19](https://github.com/arangodb/kube-arangodb/tree/1.2.19) (2022-10-05)
1920
- (Bugfix) Prevent changes when UID is wrong

pkg/apis/deployment/v1/conditions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const (
4141
ConditionTypeStarted ConditionType = "Started"
4242
// ConditionTypeReachable indicates that the member is reachable.
4343
ConditionTypeReachable ConditionType = "Reachable"
44+
// ConditionTypeScheduled indicates that the member primary pod is scheduled.
45+
ConditionTypeScheduled ConditionType = "Scheduled"
4446
// ConditionTypeServing indicates that the member core services are running.
4547
ConditionTypeServing ConditionType = "Serving"
4648
// ConditionTypeActive indicates that the member server container started.

pkg/apis/deployment/v2alpha1/conditions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const (
4141
ConditionTypeStarted ConditionType = "Started"
4242
// ConditionTypeReachable indicates that the member is reachable.
4343
ConditionTypeReachable ConditionType = "Reachable"
44+
// ConditionTypeScheduled indicates that the member primary pod is scheduled.
45+
ConditionTypeScheduled ConditionType = "Scheduled"
4446
// ConditionTypeServing indicates that the member core services are running.
4547
ConditionTypeServing ConditionType = "Serving"
4648
// ConditionTypeActive indicates that the member server container started.

pkg/deployment/member/phase_updates.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func removeMemberConditionsMapFunc(m *api.MemberStatus) {
8484
m.Conditions.Remove(api.ConditionTypeReady)
8585
m.Conditions.Remove(api.ConditionTypeActive)
8686
m.Conditions.Remove(api.ConditionTypeStarted)
87+
m.Conditions.Remove(api.ConditionTypeScheduled)
8788
m.Conditions.Remove(api.ConditionTypeReachable)
8889
m.Conditions.Remove(api.ConditionTypeServing)
8990
m.Conditions.Remove(api.ConditionTypeTerminated)

pkg/deployment/resources/pod_inspector.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,19 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
360360
}
361361
}
362362

363-
if k8sutil.IsPodNotScheduledFor(pod, podScheduleTimeout) {
364-
// Pod cannot be scheduled for to long
365-
log.Str("pod-name", pod.GetName()).Debug("Pod scheduling timeout")
366-
podNamesWithScheduleTimeout = append(podNamesWithScheduleTimeout, pod.GetName())
367-
} else if !k8sutil.IsPodScheduled(pod) {
368-
unscheduledPodNames = append(unscheduledPodNames, pod.GetName())
363+
if k8sutil.IsPodScheduled(pod) {
364+
if memberStatus.Conditions.Update(api.ConditionTypeScheduled, true, "Pod is scheduled", "") {
365+
updateMemberStatusNeeded = true
366+
nextInterval = nextInterval.ReduceTo(recheckSoonPodInspectorInterval)
367+
}
368+
} else {
369+
if k8sutil.IsPodNotScheduledFor(pod, podScheduleTimeout) {
370+
// Pod cannot be scheduled for to long
371+
log.Str("pod-name", pod.GetName()).Debug("Pod scheduling timeout")
372+
podNamesWithScheduleTimeout = append(podNamesWithScheduleTimeout, pod.GetName())
373+
} else {
374+
unscheduledPodNames = append(unscheduledPodNames, pod.GetName())
375+
}
369376
}
370377

371378
if k8sutil.IsPodMarkedForDeletion(pod) {

0 commit comments

Comments
 (0)