Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Message: This is a synthetic risk A that always applies for testing purposes htt

Test alert for updates. https://github.com/openshift/runbooks/tree/master/alerts?runbook=notfound

error: There are issues that apply to this cluster and have not been accepted. `oc adm upgrade accept` can be used to accept them: SyntheticRiskA,SyntheticRiskB,SyntheticRiskC,TestAlert
error: There are issues that apply to this cluster and have not been accepted. `oc adm upgrade accept` can be used to accept them: SyntheticRiskA,SyntheticRiskB,TestAlert

27 changes: 22 additions & 5 deletions pkg/cli/admin/upgrade/recommend/recommend.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,20 @@ func (o *options) Run(ctx context.Context) error {
return fmt.Errorf("`oc adm upgrade accept` is used to accept when the feature gate %s is enabled", features.FeatureGateClusterUpdateAcceptRisks)
}

if cvoChecking {
for _, risk := range cv.Status.ConditionalUpdateRisks {
for _, condition := range risk.Conditions {
if condition.Type == "Applies" && condition.Status != metav1.ConditionFalse {
issues.Insert(risk.Name)
if cvoChecking && o.version != nil {
v := o.version.String()
for _, cu := range cv.Status.ConditionalUpdates {
if cu.Release.Version == v {
for _, riskName := range cu.RiskNames {
if risk := findRiskByName(cv.Status.ConditionalUpdateRisks, riskName); risk != nil {
for _, condition := range risk.Conditions {
if condition.Type == "Applies" && condition.Status != metav1.ConditionFalse {
issues.Insert(risk.Name)
}
}
}
}
Comment thread
hongkailiu marked this conversation as resolved.
break
}
}
if cv.Spec.DesiredUpdate != nil {
Expand Down Expand Up @@ -450,6 +458,15 @@ func (o *options) Run(ctx context.Context) error {
return nil
}

func findRiskByName(risks []configv1.ConditionalUpdateRisk, name string) *configv1.ConditionalUpdateRisk {
for _, risk := range risks {
if risk.Name == name {
return &risk
}
}
return nil
}

func notRecommendedCondition(update configv1.ConditionalUpdate) *metav1.Condition {
if len(update.Risks) == 0 {
return nil
Expand Down