Run config entry controller routines on leader (#16054)
This commit is contained in:
parent
8661b6844f
commit
3e5e03aa95
|
@ -5,11 +5,15 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/sync/errgroup"
|
||||||
|
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
|
|
||||||
|
"github.com/hashicorp/go-version"
|
||||||
|
|
||||||
|
"github.com/hashicorp/consul/agent/consul/gateways"
|
||||||
"github.com/hashicorp/consul/agent/structs"
|
"github.com/hashicorp/consul/agent/structs"
|
||||||
"github.com/hashicorp/consul/logging"
|
"github.com/hashicorp/consul/logging"
|
||||||
"github.com/hashicorp/go-version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -51,6 +55,7 @@ func (s *Server) startConnectLeader(ctx context.Context) error {
|
||||||
s.leaderRoutineManager.Start(ctx, caRootMetricRoutineName, rootCAExpiryMonitor(s).Monitor)
|
s.leaderRoutineManager.Start(ctx, caRootMetricRoutineName, rootCAExpiryMonitor(s).Monitor)
|
||||||
s.leaderRoutineManager.Start(ctx, caSigningMetricRoutineName, signingCAExpiryMonitor(s).Monitor)
|
s.leaderRoutineManager.Start(ctx, caSigningMetricRoutineName, signingCAExpiryMonitor(s).Monitor)
|
||||||
s.leaderRoutineManager.Start(ctx, virtualIPCheckRoutineName, s.runVirtualIPVersionCheck)
|
s.leaderRoutineManager.Start(ctx, virtualIPCheckRoutineName, s.runVirtualIPVersionCheck)
|
||||||
|
s.leaderRoutineManager.Start(ctx, configEntryControllersRoutineName, s.runConfigEntryControllers)
|
||||||
|
|
||||||
return s.startIntentionConfigEntryMigration(ctx)
|
return s.startIntentionConfigEntryMigration(ctx)
|
||||||
}
|
}
|
||||||
|
@ -63,6 +68,28 @@ func (s *Server) stopConnectLeader() {
|
||||||
s.leaderRoutineManager.Stop(caRootMetricRoutineName)
|
s.leaderRoutineManager.Stop(caRootMetricRoutineName)
|
||||||
s.leaderRoutineManager.Stop(caSigningMetricRoutineName)
|
s.leaderRoutineManager.Stop(caSigningMetricRoutineName)
|
||||||
s.leaderRoutineManager.Stop(virtualIPCheckRoutineName)
|
s.leaderRoutineManager.Stop(virtualIPCheckRoutineName)
|
||||||
|
s.leaderRoutineManager.Stop(configEntryControllersRoutineName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) runConfigEntryControllers(ctx context.Context) error {
|
||||||
|
group, ctx := errgroup.WithContext(ctx)
|
||||||
|
|
||||||
|
group.Go(func() error {
|
||||||
|
logger := s.logger.Named(logging.APIGatewayController)
|
||||||
|
return gateways.NewAPIGatewayController(s.fsm, s.publisher, logger).Run(ctx)
|
||||||
|
})
|
||||||
|
|
||||||
|
group.Go(func() error {
|
||||||
|
logger := s.logger.Named(logging.HTTPRouteController)
|
||||||
|
return gateways.NewHTTPRouteController(s.fsm, s.publisher, logger).Run(ctx)
|
||||||
|
})
|
||||||
|
|
||||||
|
group.Go(func() error {
|
||||||
|
logger := s.logger.Named(logging.TCPRouteController)
|
||||||
|
return gateways.NewTCPRouteController(s.fsm, s.publisher, logger).Run(ctx)
|
||||||
|
})
|
||||||
|
|
||||||
|
return group.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) runCARootPruning(ctx context.Context) error {
|
func (s *Server) runCARootPruning(ctx context.Context) error {
|
||||||
|
|
|
@ -122,6 +122,7 @@ const (
|
||||||
caRootPruningRoutineName = "CA root pruning"
|
caRootPruningRoutineName = "CA root pruning"
|
||||||
caRootMetricRoutineName = "CA root expiration metric"
|
caRootMetricRoutineName = "CA root expiration metric"
|
||||||
caSigningMetricRoutineName = "CA signing expiration metric"
|
caSigningMetricRoutineName = "CA signing expiration metric"
|
||||||
|
configEntryControllersRoutineName = "config entry controllers"
|
||||||
configReplicationRoutineName = "config entry replication"
|
configReplicationRoutineName = "config entry replication"
|
||||||
federationStateReplicationRoutineName = "federation state replication"
|
federationStateReplicationRoutineName = "federation state replication"
|
||||||
federationStateAntiEntropyRoutineName = "federation state anti-entropy"
|
federationStateAntiEntropyRoutineName = "federation state anti-entropy"
|
||||||
|
|
|
@ -22,8 +22,10 @@ const (
|
||||||
Envoy string = "envoy"
|
Envoy string = "envoy"
|
||||||
FederationState string = "federation_state"
|
FederationState string = "federation_state"
|
||||||
FSM string = "fsm"
|
FSM string = "fsm"
|
||||||
|
APIGatewayController string = "api_gateway_controller"
|
||||||
GatewayLocator string = "gateway_locator"
|
GatewayLocator string = "gateway_locator"
|
||||||
HTTP string = "http"
|
HTTP string = "http"
|
||||||
|
HTTPRouteController string = "http_route_controller"
|
||||||
IngressGateway string = "ingress_gateway"
|
IngressGateway string = "ingress_gateway"
|
||||||
Intentions string = "intentions"
|
Intentions string = "intentions"
|
||||||
Internal string = "internal"
|
Internal string = "internal"
|
||||||
|
@ -52,6 +54,7 @@ const (
|
||||||
Partition string = "partition"
|
Partition string = "partition"
|
||||||
Peering string = "peering"
|
Peering string = "peering"
|
||||||
PeeringMetrics string = "peering_metrics"
|
PeeringMetrics string = "peering_metrics"
|
||||||
|
TCPRouteController string = "tcp_route_controller"
|
||||||
TerminatingGateway string = "terminating_gateway"
|
TerminatingGateway string = "terminating_gateway"
|
||||||
TLSUtil string = "tlsutil"
|
TLSUtil string = "tlsutil"
|
||||||
Transaction string = "txn"
|
Transaction string = "txn"
|
||||||
|
|
Loading…
Reference in New Issue