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

feat: add missing target control plane condition for backups #133

Merged
merged 1 commit into from
Jan 3, 2025
Merged
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
15 changes: 15 additions & 0 deletions apis/spaces/v1alpha1/backup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package v1alpha1

import (
"fmt"
"reflect"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -175,6 +176,8 @@ const (
BackupRetryReason xpv1.ConditionReason = "BackupRetry"
// BackupSuccessReason is the reason for a successful backup.
BackupSuccessReason xpv1.ConditionReason = "BackupSuccess"
// BackupControlPlaneNotFoundReason is the reason for a control plane not being found.
BackupControlPlaneNotFoundReason xpv1.ConditionReason = "TargetControlPlaneNotFound"
)

// BackupFailed returns a condition indicating that the backup has failed.
Expand All @@ -199,6 +202,18 @@ func BackupRetry(msg string) xpv1.Condition {
}
}

// BackupControlPlaneNotFound returns a condition indicating that the control
// plane was not found.
func BackupControlPlaneNotFound(ns, name string) xpv1.Condition {
return xpv1.Condition{
Type: ConditionTypeFailed,
Status: corev1.ConditionTrue,
LastTransitionTime: metav1.Now(),
Reason: BackupControlPlaneNotFoundReason,
Message: fmt.Sprintf("target control plane '%s/%s' not found", ns, name),
}
}

// BackupStatus represents the observed state of a Backup.
type BackupStatus struct {
xpv1.ResourceStatus `json:",inline"`
Expand Down
Loading