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 32221b2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 32 deletions.
54 changes: 30 additions & 24 deletions 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 Down Expand Up @@ -642,35 +646,37 @@ func (w *SyncWorker) apply(ctx context.Context, payloadUpdate *payload.Update, w
})
}

// update each object
errs := payload.RunGraph(ctx, graph, maxWorkers, func(ctx context.Context, tasks []*payload.Task) error {
for _, task := range tasks {
if contextIsCancelled(ctx) {
return cr.CancelError()
}
cr.Update()
/*
// update each object
errs := payload.RunGraph(ctx, graph, maxWorkers, func(ctx context.Context, tasks []*payload.Task) error {
for _, task := range tasks {
if contextIsCancelled(ctx) {
return cr.CancelError()
}
cr.Update()
klog.V(4).Infof("Running sync for %s", task)
klog.V(5).Infof("Manifest: %s", string(task.Manifest.Raw))
klog.V(4).Infof("Running sync for %s", task)
klog.V(5).Infof("Manifest: %s", string(task.Manifest.Raw))
ov, ok := getOverrideForManifest(work.Overrides, w.exclude, task.Manifest)
if ok && ov.Unmanaged {
klog.V(4).Infof("Skipping %s as unmanaged", task)
continue
}
ov, ok := getOverrideForManifest(work.Overrides, w.exclude, task.Manifest)
if ok && ov.Unmanaged {
klog.V(4).Infof("Skipping %s as unmanaged", task)
continue
}
if err := task.Run(ctx, version, w.builder, work.State); err != nil {
return err
if err := task.Run(ctx, version, w.builder, work.State); err != nil {
return err
}
cr.Inc()
klog.V(4).Infof("Done syncing for %s", task)
}
cr.Inc()
klog.V(4).Infof("Done syncing for %s", task)
return nil
})
if len(errs) > 0 {
err := cr.Errors(errs)
return err
}
return nil
})
if len(errs) > 0 {
err := cr.Errors(errs)
return err
}
*/

// update the status
cr.Complete()
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 32221b2

Please sign in to comment.