Skip to content

Commit

Permalink
Introduce GatewayControllerMode
Browse files Browse the repository at this point in the history
  • Loading branch information
eoinfennessy committed May 21, 2024
1 parent 5e381e6 commit 6ddec66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pilot/pkg/bootstrap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ func (s *Server) initControllers(args *PilotArgs) error {

s.initSDSServer()

if features.EnableEnhancedResourceScoping {
if features.EnableEnhancedResourceScoping || features.EnableGatewayControllerMode {
// setup namespace filter
args.RegistryOptions.KubeOptions.DiscoveryNamespacesFilter = s.multiclusterController.DiscoveryNamespacesFilter
}
Expand Down
4 changes: 4 additions & 0 deletions pilot/pkg/features/pilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,10 @@ var (
"generated root certificate.").Get()

EnableFederation = env.RegisterBoolVar("PILOT_ENABLE_FEDERATION", false, "").Get()

EnableGatewayControllerMode = env.Register("PILOT_ENABLE_GATEWAY_CONTROLLER_MODE", false,
"If enabled, istiod will watch Gateway API and k8s resources in every namespace, but Istio resources will be limited to "+
"namespaces that match the meshConfig.discoverySelectors").Get()
)

// UnsafeFeaturesEnabled returns true if any unsafe features are enabled.
Expand Down
4 changes: 4 additions & 0 deletions pilot/pkg/serviceregistry/kube/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ func NewController(kubeClient kubelib.Client, options Options) *Controller {
)
}

// don't use discoveryFilters if in gw-controller mode. always watch all namespaces
if features.EnableGatewayControllerMode {
c.opts.DiscoveryNamespacesFilter = namespace.NewDiscoveryNamespacesFilter(c.namespaces, []*metav1.LabelSelector{})
}
if c.opts.DiscoveryNamespacesFilter == nil {
c.opts.DiscoveryNamespacesFilter = namespace.NewDiscoveryNamespacesFilter(c.namespaces, options.MeshWatcher.Mesh().DiscoverySelectors)
}
Expand Down

0 comments on commit 6ddec66

Please sign in to comment.