Skip to content

Commit

Permalink
tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
jottofar committed May 5, 2020
1 parent 27cea86 commit 1b15119
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
8 changes: 7 additions & 1 deletion pkg/cvo/sync_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ func (w *SyncWorker) syncOnce(ctx context.Context, work *SyncWork, maxWorkers in
Reconciling: work.State.Reconciling(),
Actual: update,
})
klog.Infof("RetrievePayload %v", err)
return err
}

Expand All @@ -506,6 +507,7 @@ func (w *SyncWorker) syncOnce(ctx context.Context, work *SyncWork, maxWorkers in
Actual: update,
Verified: info.Verified,
})
klog.Infof("VerifyPayload %v", err)
return err
}
payloadUpdate.VerifiedImage = info.Verified
Expand All @@ -526,6 +528,7 @@ func (w *SyncWorker) syncOnce(ctx context.Context, work *SyncWork, maxWorkers in
Verified: info.Verified,
})
if err := precondition.Summarize(w.preconditions.RunAll(ctx, precondition.ReleaseContext{DesiredVersion: payloadUpdate.ReleaseVersion})); err != nil {
klog.Infof("precondition error %v", err)
if update.Force {
klog.V(4).Infof("Forcing past precondition failures: %s", err)
} else {
Expand All @@ -538,6 +541,7 @@ func (w *SyncWorker) syncOnce(ctx context.Context, work *SyncWork, maxWorkers in
Actual: update,
Verified: info.Verified,
})
klog.Infof("PreconditionChecks %v", err)
return err
}
}
Expand All @@ -547,7 +551,9 @@ func (w *SyncWorker) syncOnce(ctx context.Context, work *SyncWork, maxWorkers in
klog.V(4).Infof("Payload loaded from %s with hash %s", payloadUpdate.ReleaseImage, payloadUpdate.ManifestHash)
}

return w.apply(ctx, w.payload, work, maxWorkers, reporter)
//return w.apply(ctx, w.payload, work, maxWorkers, reporter)
klog.Infof("return nil")
return nil
}

// apply updates the server with the contents of the provided image or returns an error.
Expand Down
3 changes: 3 additions & 0 deletions pkg/cvo/upgradeable.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func (optr *Operator) syncUpgradeable(config *configv1.ClusterVersion) error {
if u != nil && u.RecentlyChanged(optr.minimumUpdateCheckInterval) {
klog.V(4).Infof("Upgradeable conditions were recently checked, will try later.")
return nil
} else {
klog.Infof("Checking upgradeable conditions.")
}

now := metav1.Now()
Expand Down Expand Up @@ -181,6 +183,7 @@ func (check *clusterOperatorsUpgradeable) Check() *configv1.ClusterOperatorStatu
}
cond.Reason = reason
cond.Message = msg
klog.Infof("%s", msg)
return cond
}

Expand Down
18 changes: 10 additions & 8 deletions pkg/payload/precondition/clusterversion/upgradeable.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ func (pf *Upgradeable) Run(ctx context.Context, releaseContext precondition.Rele
Name: pf.Name(),
}
}
klog.Infof("pf.Name(): %s", pf.Name())

// if we are upgradeable==true we can always upgrade
up := resourcemerge.FindOperatorStatusCondition(cv.Status.Conditions, configv1.OperatorUpgradeable)
if up == nil {
klog.V(4).Infof("Precondition %s passed: no Upgradeable condition on ClusterVersion.", pf.Name())
return nil
}
klog.Infof("Status: %s", up.Status)
if up.Status != configv1.ConditionFalse {
klog.V(4).Infof("Precondition %s passed: Upgradeable %s since %v: %s: %s", pf.Name(), up.Status, up.LastTransitionTime, up.Reason, up.Message)
return nil
Expand All @@ -63,16 +65,16 @@ func (pf *Upgradeable) Run(ctx context.Context, releaseContext precondition.Rele
}

// only perform minor version check if upgradeable is not false
if up.Status != configv1.ConditionFalse {
currentMinor := getEffectiveMinor(cv.Status.History[0].Version)
desiredMinor := getEffectiveMinor(releaseContext.DesiredVersion)
//if up.Status != configv1.ConditionFalse {
currentMinor := getEffectiveMinor(cv.Status.History[0].Version)
desiredMinor := getEffectiveMinor(releaseContext.DesiredVersion)

// 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
if currentMinor == desiredMinor {
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)
return nil
}
// 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
if currentMinor == desiredMinor {
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)
return nil
}
//}

return &precondition.Error{
Nested: err,
Expand Down
1 change: 1 addition & 0 deletions pkg/payload/precondition/precondition.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type List []Precondition
func (pfList List) RunAll(ctx context.Context, releaseContext ReleaseContext) []error {
var errs []error
for _, pf := range pfList {
klog.Infof("Running precondition %q", pf.Name())
if err := pf.Run(ctx, releaseContext); err != nil {
klog.Errorf("Precondition %q failed: %v", pf.Name(), err)
errs = append(errs, err)
Expand Down

0 comments on commit 1b15119

Please sign in to comment.