Skip to content

Commit

Permalink
pilot: fix to ensure we only use mesh config after it is initialized (i…
Browse files Browse the repository at this point in the history
…stio#52820)

* pilot: fix to ensure we only use mesh config after it is initialized

Fixes istio#52803

* add comment
  • Loading branch information
howardjohn authored Aug 27, 2024
1 parent 9d826e8 commit 5d9f6d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pilot/pkg/bootstrap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,12 @@ func NewServer(args *PilotArgs, initFuncs ...func(*Server)) (*Server, error) {
istiodCertBundleWatcher: keycertbundle.NewWatcher(),
webhookInfo: &webhookInfo{},
}
s.workloadTrustBundle = tb.NewTrustBundle(nil, e.Watcher)

// Apply custom initialization functions.
for _, fn := range initFuncs {
fn(s)
}
// Initialize workload Trust Bundle before XDS Server
e.TrustBundle = s.workloadTrustBundle
s.XDSServer = xds.NewDiscoveryServer(e, args.RegistryOptions.KubeOptions.ClusterAliases)
configGen := core.NewConfigGenerator(s.XDSServer.Cache)

Expand Down Expand Up @@ -288,6 +286,10 @@ func NewServer(args *PilotArgs, initFuncs ...func(*Server)) (*Server, error) {
return nil, err
}

// Initialize trust bundle after mesh config which it depends on
s.workloadTrustBundle = tb.NewTrustBundle(nil, e.Watcher)
e.TrustBundle = s.workloadTrustBundle

// Options based on the current 'defaults' in istio.
caOpts := &caOptions{
TrustDomain: s.environment.Mesh().TrustDomain,
Expand Down

0 comments on commit 5d9f6d0

Please sign in to comment.