Skip to content

Commit

Permalink
oauthendpoints: use separate resync intervals for each EndpointAccess…
Browse files Browse the repository at this point in the history
…ibleController
  • Loading branch information
liouk committed Nov 9, 2023
1 parent b50b977 commit 78cce05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions pkg/controllers/oauthendpoints/oauth_endpoints_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import (
"fmt"
"net"
"strconv"
"time"

"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog/v2"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -65,7 +67,8 @@ func NewOAuthRouteCheckController(
routeInformer,
ingressInformer,
},
recorder)
recorder,
wait.Jitter(5*time.Minute, 0.1))
}

// NewOAuthServiceCheckController returns a controller that checks the health of authentication service.
Expand All @@ -90,7 +93,8 @@ func NewOAuthServiceCheckController(
kubeInformersForTargetNS.Core().V1().ConfigMaps().Informer(),
kubeInformersForTargetNS.Core().V1().Services().Informer(),
},
recorder)
recorder,
wait.Jitter(time.Minute, 1.0))
}

// NewOAuthServiceEndpointsCheckController returns a controller that checks the health of authentication service
Expand All @@ -116,7 +120,8 @@ func NewOAuthServiceEndpointsCheckController(
kubeInformersForTargetNS.Core().V1().Endpoints().Informer(),
kubeInformersForTargetNS.Core().V1().ConfigMaps().Informer(),
},
recorder)
recorder,
wait.Jitter(time.Minute, 1.0))
}

func listOAuthServiceEndpoints(endpointsLister corev1listers.EndpointsLister) ([]string, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/libs/endpointaccessible/endpoint_accessible_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

apierrors "k8s.io/apimachinery/pkg/api/errors"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/wait"

operatorv1 "github.com/openshift/api/operator/v1"
"github.com/openshift/library-go/pkg/controller/factory"
Expand All @@ -38,6 +37,7 @@ func NewEndpointAccessibleController(
getTLSConfigFn EndpointTLSConfigFunc,
triggers []factory.Informer,
recorder events.Recorder,
resyncInterval time.Duration,
) factory.Controller {
controllerName := name + "EndpointAccessibleController"

Expand All @@ -52,7 +52,7 @@ func NewEndpointAccessibleController(
WithInformers(triggers...).
WithInformers(operatorClient.Informer()).
WithSync(c.sync).
ResyncEvery(wait.Jitter(time.Minute, 1.0)).
ResyncEvery(resyncInterval).
WithSyncDegradedOnError(operatorClient).
ToController(controllerName, recorder.WithComponentSuffix(name+"endpoint-accessible-controller"))
}
Expand Down

0 comments on commit 78cce05

Please sign in to comment.