Skip to content

Commit

Permalink
add patch to avoid unnecessary xDS generation for our CRD
Browse files Browse the repository at this point in the history
This change is missed when those CRDs are first added.
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander committed Sep 12, 2024
1 parent 82b6aa8 commit 26a9cd8
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions patch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ This list documents each patch:
* 20240529-fix-routes-overwrite-when-merging-same-host-from-multi-virtualservices.patch: Backport https://github.com/istio/istio/commit/0cb5c33595cdfaea732178a4d70265ac0a762255 to Istio 1.21. The filename in the patch is renamed to match the file in Istio 1.21. The bug occurred sometimes when multiple virtualservices has the same domain.
* 20240823-server-side-filter.patch: Add server-side filters to filter istio CRD.
* 20240903-dynamic-configs.patch: Add DynamicConfig CRD.
* 20240912-optimize-xds-generation.patch: Avoid unnecessary xDS generation for our CRD.
89 changes: 89 additions & 0 deletions patch/istio/1.21/20240912-optimize-xds-generation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
diff --git a/pilot/pkg/xds/cds.go b/pilot/pkg/xds/cds.go
index d3dcb96..3c0527e 100644
--- a/pilot/pkg/xds/cds.go
+++ b/pilot/pkg/xds/cds.go
@@ -31,6 +31,9 @@ var _ model.XdsDeltaResourceGenerator = &CdsGenerator{}

// Map of all configs that do not impact CDS
var skippedCdsConfigs = sets.New(
+ kind.FilterPolicy,
+ kind.Consumer,
+ kind.ServiceRegistry,
kind.DynamicConfig,

kind.Gateway,
diff --git a/pilot/pkg/xds/eds.go b/pilot/pkg/xds/eds.go
index c117dfa..a7dce42 100644
--- a/pilot/pkg/xds/eds.go
+++ b/pilot/pkg/xds/eds.go
@@ -90,7 +90,10 @@ var _ model.XdsDeltaResourceGenerator = &EdsGenerator{}

// Map of all configs that do not impact EDS
var skippedEdsConfigs = map[kind.Kind]struct{}{
- kind.DynamicConfig: {},
+ kind.FilterPolicy: {},
+ kind.Consumer: {},
+ kind.ServiceRegistry: {},
+ kind.DynamicConfig: {},

kind.Gateway: {},
kind.VirtualService: {},
diff --git a/pilot/pkg/xds/lds.go b/pilot/pkg/xds/lds.go
index f93be3f..dc9967f 100644
--- a/pilot/pkg/xds/lds.go
+++ b/pilot/pkg/xds/lds.go
@@ -33,6 +33,8 @@ var _ model.XdsResourceGenerator = &LdsGenerator{}
// Map of all configs that do not impact LDS
var skippedLdsConfigs = map[model.NodeType]sets.Set[kind.Kind]{
model.Router: sets.New[kind.Kind](
+ kind.ServiceRegistry,
+
// for autopassthrough gateways, we build filterchains per-dr subset
kind.WorkloadGroup,
kind.WorkloadEntry,
@@ -41,6 +43,8 @@ var skippedLdsConfigs = map[model.NodeType]sets.Set[kind.Kind]{
kind.DNSName,
),
model.SidecarProxy: sets.New[kind.Kind](
+ kind.ServiceRegistry,
+
kind.Gateway,
kind.WorkloadGroup,
kind.WorkloadEntry,
@@ -49,6 +53,8 @@ var skippedLdsConfigs = map[model.NodeType]sets.Set[kind.Kind]{
kind.DNSName,
),
model.Waypoint: sets.New[kind.Kind](
+ kind.ServiceRegistry,
+
kind.Gateway,
kind.WorkloadGroup,
kind.WorkloadEntry,
diff --git a/pilot/pkg/xds/nds.go b/pilot/pkg/xds/nds.go
index e556221..7c827f4 100644
--- a/pilot/pkg/xds/nds.go
+++ b/pilot/pkg/xds/nds.go
@@ -38,6 +38,9 @@ var _ model.XdsResourceGenerator = &NdsGenerator{}

// Map of all configs that do not impact NDS
var skippedNdsConfigs = sets.New[kind.Kind](
+ kind.FilterPolicy,
+ kind.Consumer,
+ kind.ServiceRegistry,
kind.DynamicConfig,

kind.Gateway,
diff --git a/pilot/pkg/xds/rds.go b/pilot/pkg/xds/rds.go
index bc2a17f..a88ab1e 100644
--- a/pilot/pkg/xds/rds.go
+++ b/pilot/pkg/xds/rds.go
@@ -29,6 +29,9 @@ var _ model.XdsResourceGenerator = &RdsGenerator{}

// Map of all configs that do not impact RDS
var skippedRdsConfigs = sets.New[kind.Kind](
+ kind.Consumer,
+ kind.ServiceRegistry,
+
kind.WorkloadEntry,
kind.WorkloadGroup,
kind.AuthorizationPolicy,

0 comments on commit 26a9cd8

Please sign in to comment.