Skip to content

Commit

Permalink
fix: Failed to create Versioneddataset with the inherited historical …
Browse files Browse the repository at this point in the history
…version
  • Loading branch information
dayuy committed Jan 12, 2024
1 parent 4737e37 commit a99b1b5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apiserver/pkg/versioneddataset/versioned_dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,19 @@ func CreateVersionedDataset(ctx context.Context, c dynamic.Interface, input *gen
return nil, err
}
if v.Spec.Version == *input.InheritedFrom {
isReady := false
var errMessage error
for _, cond := range v.Status.Conditions {
if !(cond.Type == v1alpha1.TypeReady && cond.Status == v1.ConditionTrue) {
return nil, fmt.Errorf("inherit from a version with an incorrect synchronization state will not be created. reason: %s, errMsg: %s", cond.Reason, cond.Message)
if cond.Type == v1alpha1.TypeReady && cond.Status == v1.ConditionTrue {
isReady = true
break
}
if cond.Type == v1alpha1.TypeReady && cond.Status != v1.ConditionTrue {
errMessage = fmt.Errorf("inherit from a version with an incorrect synchronization state will not be created. reason: %s, errMsg: %s", cond.Reason, cond.Message)
}
}
if !isReady {
return nil, errMessage
}
}
}
Expand Down

0 comments on commit a99b1b5

Please sign in to comment.