Skip to content

Commit c9a55d8

Browse files
committed
test only changes
1 parent 0365165 commit c9a55d8

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

pkg/cvo/internal/operatorstatus.go

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ func (b *clusterOperatorBuilder) Do(ctx context.Context) error {
127127
return waitForOperatorStatusToBeDone(ctx, 1*time.Second, b.client, os, b.mode)
128128
}
129129

130+
func fakeFail(name string) bool {
131+
if name != "kube-apiserver" && name != "openshift-apiserver" {
132+
return false
133+
}
134+
now := metav1.Now()
135+
threshold := now.Add(-(45 * time.Minute))
136+
if payload.COUpdateStartTimesGet(name).Before(threshold) {
137+
return false
138+
}
139+
return true
140+
}
141+
130142
func waitForOperatorStatusToBeDone(ctx context.Context, interval time.Duration, client ClusterOperatorsGetter, expected *configv1.ClusterOperator, mode resourcebuilder.Mode) error {
131143
var lastErr error
132144
err := wait.PollImmediateUntil(interval, func() (bool, error) {
@@ -206,14 +218,18 @@ func waitForOperatorStatusToBeDone(ctx context.Context, interval time.Duration,
206218
case resourcebuilder.InitializingMode:
207219
// during initialization we allow degraded as long as the component goes available
208220
if available && (!progressing || len(expected.Status.Versions) > 0) {
209-
return true, nil
221+
if (expected.Name != "kube-apiserver" && expected.Name != "openshift-apiserver") || !fakeFail(expected.Name) {
222+
return true, nil
223+
}
210224
}
211225
default:
212226
// if we're at the correct version, and available, and not degraded, we are done
213227
// if we're available, not degraded, and not progressing, we're also done
214228
// TODO: remove progressing once all cluster operators report expected versions
215229
if available && (!progressing || len(expected.Status.Versions) > 0) && !degraded {
216-
return true, nil
230+
if (expected.Name != "kube-apiserver" && expected.Name != "openshift-apiserver") || !fakeFail(expected.Name) {
231+
return true, nil
232+
}
217233
}
218234
}
219235

@@ -235,13 +251,23 @@ func waitForOperatorStatusToBeDone(ctx context.Context, interval time.Duration,
235251
Message: message,
236252
Name: actual.Name,
237253
}
238-
return false, nil
254+
if (expected.Name != "kube-apiserver" && expected.Name != "openshift-apiserver") || !fakeFail(expected.Name) {
255+
return false, nil
256+
}
239257
}
240258
}
241259

242260
updateEffect := payload.UpdateEffectFail
243-
if available {
244-
updateEffect = payload.UpdateEffectFailAfterInterval
261+
if fakeFail(expected.Name) {
262+
if available && expected.Name == "openshift-apiserver" {
263+
updateEffect = payload.UpdateEffectFailAfterInterval
264+
} else if available && expected.Name != "kube-apiserver" {
265+
updateEffect = payload.UpdateEffectFailAfterInterval
266+
}
267+
} else {
268+
if available {
269+
updateEffect = payload.UpdateEffectFailAfterInterval
270+
}
245271
}
246272
lastErr = &payload.UpdateError{
247273
Nested: fmt.Errorf("cluster operator %s is not done; it is available=%v, progressing=%v, degraded=%v",

pkg/cvo/status.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ func (optr *Operator) syncStatus(ctx context.Context, original, config *configv1
273273
Message: fmt.Sprintf("Error while reconciling %s: %s", version, msg),
274274
LastTransitionTime: now,
275275
})
276+
klog.Infof("!!!! %s", fmt.Sprintf("Error while reconciling %s: %s", version, msg))
276277
} else {
277278
resourcemerge.SetOperatorStatusCondition(&config.Status.Conditions, configv1.ClusterOperatorStatusCondition{
278279
Type: configv1.OperatorProgressing,
@@ -281,6 +282,7 @@ func (optr *Operator) syncStatus(ctx context.Context, original, config *configv1
281282
Message: fmt.Sprintf("Unable to apply %s: %s", version, msg),
282283
LastTransitionTime: now,
283284
})
285+
klog.Infof("!!!! %s", fmt.Sprintf("Unable to apply %s: %s", version, msg))
284286
}
285287

286288
} else {
@@ -331,6 +333,7 @@ func (optr *Operator) syncStatus(ctx context.Context, original, config *configv1
331333
Message: message,
332334
LastTransitionTime: now,
333335
})
336+
klog.Infof("!!!! %s", message)
334337
}
335338
}
336339

@@ -357,33 +360,44 @@ func (optr *Operator) syncStatus(ctx context.Context, original, config *configv1
357360
// its last update to go ready, or an hour has elapsed since the update began, before the condition is ignored.
358361
func convertErrorToProgressing(history []configv1.UpdateHistory, now time.Time, status *SyncWorkerStatus) (reason string, message string, ok bool) {
359362
if len(history) == 0 || status.Failure == nil || status.Reconciling {
363+
klog.Infof("!!!! 1")
360364
return "", "", false
361365
}
362366
uErr, ok := status.Failure.(*payload.UpdateError)
363367
if !ok {
368+
klog.Infof("!!!! 2")
364369
return "", "", false
365370
}
366371
if uErr.Reason == "ClusterOperatorNotAvailable" || uErr.Reason == "ClusterOperatorsNotAvailable" {
367372
switch uErr.UpdateEffect {
368373
case payload.UpdateEffectNone:
374+
klog.Infof("!!!! 3")
369375
return uErr.Reason, fmt.Sprintf("waiting on %s", uErr.Name), true
370376
case payload.UpdateEffectFail:
377+
klog.Infof("!!!! 4")
371378
return "", "", false
372379
case payload.UpdateEffectFailAfterInterval:
373380
var exceeded []string
374-
threshold := now.Add(-(40 * time.Minute))
381+
//threshold := now.Add(-(40 * time.Minute))
382+
threshold := now.Add(-(20 * time.Minute))
375383
for _, name := range strings.Split(uErr.Name, ", ") {
376384
if payload.COUpdateStartTimesGet(name).Before(threshold) {
385+
klog.Infof("!!!! exceeded=%s", name)
377386
exceeded = append(exceeded, name)
378387
}
379388
}
380389
if len(exceeded) > 0 {
381-
return uErr.Reason, fmt.Sprintf("wait has exceeded 40 minutes for these operators: %s", strings.Join(exceeded, ", ")), false
390+
klog.Infof("!!!! 5")
391+
//return uErr.Reason, fmt.Sprintf("wait has exceeded 40 minutes for these operators: %s", strings.Join(exceeded, ", ")), false
392+
return uErr.Reason, fmt.Sprintf("wait has exceeded 20 minutes for these operators: %s", strings.Join(exceeded, ", ")), false
382393
} else {
383-
return uErr.Reason, fmt.Sprintf("waiting up to 40 minutes on %s", uErr.Name), true
394+
klog.Infof("!!!! 6")
395+
//return uErr.Reason, fmt.Sprintf("waiting up to 40 minutes on %s", uErr.Name), true
396+
return uErr.Reason, fmt.Sprintf("waiting up to 20 minutes on %s", uErr.Name), true
384397
}
385398
}
386399
}
400+
klog.Infof("!!!! 7")
387401
return "", "", false
388402
}
389403

0 commit comments

Comments
 (0)