Skip to content
Draft
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
16 changes: 16 additions & 0 deletions pkg/operator/apiserver/controllerset/apiservercontrollerset.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,22 @@ func WithStatusControllerPdbCompatibleHighInertia(workloadConditionsPrefix strin
}
}

// WithStatusControllerAPIServicesAvailableInertia sets inertia for APIServicesAvailable
// conditions to prevent brief transient errors from causing Available=False.
// This is useful for handling temporary network issues or brief missing HTTP headers
// that self-resolve within seconds.
func WithStatusControllerAPIServicesAvailableInertia() func(s *status.StatusSyncer) *status.StatusSyncer {
return func(s *status.StatusSyncer) *status.StatusSyncer {
return s.WithAvailableInertia(status.MustNewInertia(
0, // default: no inertia for other conditions
status.InertiaCondition{
ConditionTypeMatcher: regexp.MustCompile("^APIServicesAvailable$"),
Duration: 5 * time.Second, // tolerate brief transient errors
}).Inertia,
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to get @wking 's opinion on this (a few years ago I recall he was opposed to a change similar to this one, but I don't remember well).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'd showed him his PR but mentioned i was going to work on reproducing the issue and then confirming that this fixes it before I asked for more attention. Moving this back to draft for now.

}

func (cs *APIServerControllerSet) WithoutClusterOperatorStatusController() *APIServerControllerSet {
cs.clusterOperatorStatusController.controller = nil
cs.clusterOperatorStatusController.emptyAllowed = true
Expand Down
11 changes: 10 additions & 1 deletion pkg/operator/status/status_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type StatusSyncer struct {
controllerFactory *factory.Factory
recorder events.Recorder
degradedInertia Inertia
availableInertia Inertia

removeUnusedVersions bool
}
Expand Down Expand Up @@ -123,6 +124,14 @@ func (c *StatusSyncer) WithDegradedInertia(inertia Inertia) *StatusSyncer {
return &output
}

// WithAvailableInertia returns a copy of the StatusSyncer with the
// requested inertia function for available conditions.
func (c *StatusSyncer) WithAvailableInertia(inertia Inertia) *StatusSyncer {
output := *c
output.availableInertia = inertia
return &output
}

// WithVersionRemoval returns a copy of the StatusSyncer that will
// remove versions that are missing in VersionGetter from the status.
func (c *StatusSyncer) WithVersionRemoval() *StatusSyncer {
Expand Down Expand Up @@ -217,7 +226,7 @@ func (c StatusSyncer) Sync(ctx context.Context, syncCtx factory.SyncContext) err

configv1helpers.SetStatusCondition(&clusterOperatorObj.Status.Conditions, UnionClusterCondition(configv1.OperatorDegraded, operatorv1.ConditionFalse, c.degradedInertia, currentDetailedStatus.Conditions...), c.clock)
configv1helpers.SetStatusCondition(&clusterOperatorObj.Status.Conditions, UnionClusterCondition(configv1.OperatorProgressing, operatorv1.ConditionFalse, nil, currentDetailedStatus.Conditions...), c.clock)
configv1helpers.SetStatusCondition(&clusterOperatorObj.Status.Conditions, UnionClusterCondition(configv1.OperatorAvailable, operatorv1.ConditionTrue, nil, currentDetailedStatus.Conditions...), c.clock)
configv1helpers.SetStatusCondition(&clusterOperatorObj.Status.Conditions, UnionClusterCondition(configv1.OperatorAvailable, operatorv1.ConditionTrue, c.availableInertia, currentDetailedStatus.Conditions...), c.clock)
configv1helpers.SetStatusCondition(&clusterOperatorObj.Status.Conditions, UnionClusterCondition(configv1.OperatorUpgradeable, operatorv1.ConditionTrue, nil, currentDetailedStatus.Conditions...), c.clock)
configv1helpers.SetStatusCondition(&clusterOperatorObj.Status.Conditions, UnionClusterCondition(configv1.EvaluationConditionsDetected, operatorv1.ConditionFalse, nil, currentDetailedStatus.Conditions...), c.clock)

Expand Down