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

enhance: validate snapshot task #11

Closed
wants to merge 1 commit into from

Conversation

yyzxw
Copy link
Collaborator

@yyzxw yyzxw commented Aug 13, 2024

Fail fast when pod or container not found

@yyzxw yyzxw force-pushed the feat/validate-snapshot-task branch from fbb3917 to bcabfa8 Compare August 14, 2024 02:43
}, &pod)
if err != nil {
if errors.IsNotFound(err) {
spt.Status.Conditions = append(spt.Status.Conditions, metav1.Condition{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个在 Reconcile 中应该会统一处理。

_, i, ok := lo.FindIndexOf(spt.Status.Conditions, func(item metav1.Condition) bool {
return item.Type == rec.typ
})
if !ok {
c := metav1.Condition{
Type: rec.typ,
Status: metav1.ConditionUnknown,
Reason: rec.typ + "Ready",
LastTransitionTime: metav1.Now(),
}
i = len(spt.Status.Conditions)
spt.Status.Conditions = append(spt.Status.Conditions, c)
}
old := spt.Status.Conditions[i]
if old.Status == metav1.ConditionTrue {
// already done
continue
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看没有吧,目的是当pod或者contanier不存在的时候就不需要重复的调谐了,直接标记状态为failed

@yyzxw yyzxw force-pushed the feat/validate-snapshot-task branch from bcabfa8 to 871e776 Compare August 14, 2024 02:55
@yyzxw yyzxw closed this Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants