Skip to content

Commit 1a511af

Browse files
committed
pkg/payload/precondition/clusterversion: Logging in the Upgradeable check
So we can understand why this passes or fails more easily.
1 parent 47aae56 commit 1a511af

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/payload/precondition/clusterversion/upgradeable.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
configv1listers "github.com/openshift/client-go/config/listers/config/v1"
99
apierrors "k8s.io/apimachinery/pkg/api/errors"
1010
"k8s.io/apimachinery/pkg/api/meta"
11+
"k8s.io/klog"
1112

1213
"github.com/openshift/cluster-version-operator/lib/resourcemerge"
1314
precondition "github.com/openshift/cluster-version-operator/pkg/payload/precondition"
@@ -46,12 +47,18 @@ func (pf *Upgradeable) Run(ctx context.Context, releaseContext precondition.Rele
4647

4748
// if we are upgradeable==true we can always upgrade
4849
up := resourcemerge.FindOperatorStatusCondition(cv.Status.Conditions, configv1.OperatorUpgradeable)
49-
if up == nil || up.Status != configv1.ConditionFalse {
50+
if up == nil {
51+
klog.V(4).Infof("Precondition %s passed: no Upgradeable condition on ClusterVersion.", pf.Name())
52+
return nil
53+
}
54+
if up.Status != configv1.ConditionFalse {
55+
klog.V(4).Infof("Precondition %s passed: Upgradeable %s since %v: %s: %s", pf.Name(), up.Status, up.LastTransitionTime, up.Reason, up.Message)
5056
return nil
5157
}
5258

5359
// we can always allow the upgrade if there isn't a version already installed
5460
if len(cv.Status.History) == 0 {
61+
klog.V(4).Infof("Precondition %s passed: no release history.", pf.Name())
5562
return nil
5663
}
5764

@@ -60,6 +67,7 @@ func (pf *Upgradeable) Run(ctx context.Context, releaseContext precondition.Rele
6067

6168
// if there is no difference in the minor version (4.y.z where 4.y is the same for current and desired), then we can still upgrade
6269
if currentMinor == desiredMinor {
70+
klog.V(4).Infof("Precondition %q passed: minor from the current %s matches minor from the target %s (both %s).", pf.Name(), cv.Status.History[0].Version, releaseContext.DesiredVersion, currentMinor)
6371
return nil
6472
}
6573

0 commit comments

Comments
 (0)