Skip to content

Commit da17fe7

Browse files
committed
[Test Framework] Support Pilot mesh config
1 parent 07e1d31 commit da17fe7

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

pkg/test/framework/components/environment/native/native.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ package native
1717
import (
1818
"io"
1919

20-
meshConfig "istio.io/api/mesh/v1alpha1"
21-
"istio.io/istio/pilot/pkg/model"
2220
"istio.io/istio/pkg/test/framework/components/environment"
2321
"istio.io/istio/pkg/test/framework/components/environment/api"
2422
"istio.io/istio/pkg/test/framework/resource"
@@ -38,12 +36,6 @@ type Environment struct {
3836
id resource.ID
3937
ctx api.Context
4038

41-
// TODO: It is not correct to have fixed meshconfig at the environment level. We should align this with Galley's
42-
// mesh usage as well, which is per-component instantiation.
43-
44-
// Mesh for configuring pilot.
45-
Mesh *meshConfig.MeshConfig
46-
4739
// SystemNamespace is the namespace used for all Istio system components.
4840
SystemNamespace string
4941

@@ -58,16 +50,13 @@ var _ resource.Environment = &Environment{}
5850

5951
// New returns a new native environment.
6052
func New(ctx api.Context) (resource.Environment, error) {
61-
mesh := model.DefaultMeshConfig()
62-
6353
portMgr, err := reserveport.NewPortManager()
6454
if err != nil {
6555
return nil, err
6656
}
6757

6858
e := &Environment{
6959
ctx: ctx,
70-
Mesh: &mesh,
7160
SystemNamespace: systemNamespace,
7261
Domain: domain,
7362
PortManager: portMgr,

pkg/test/framework/components/pilot/native.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
meshconfig "istio.io/api/mesh/v1alpha1"
2525
"istio.io/istio/pilot/pkg/bootstrap"
26+
"istio.io/istio/pilot/pkg/model"
2627
"istio.io/istio/pilot/pkg/proxy/envoy"
2728
"istio.io/istio/pkg/test/framework/components/environment/native"
2829
"istio.io/istio/pkg/test/framework/resource"
@@ -70,10 +71,16 @@ func newNative(ctx resource.Context, config Config) (Instance, error) {
7071
SecureGrpcAddr: "",
7172
}
7273

74+
tmpMesh := model.DefaultMeshConfig()
75+
mesh := &tmpMesh
76+
if config.MeshConfig != nil {
77+
mesh = config.MeshConfig
78+
}
79+
7380
bootstrapArgs := bootstrap.PilotArgs{
7481
Namespace: env.SystemNamespace,
7582
DiscoveryOptions: options,
76-
MeshConfig: instance.environment.Mesh,
83+
MeshConfig: mesh,
7784
// Use the config store for service entries as well.
7885
Service: bootstrap.ServiceArgs{
7986
// A ServiceEntry registry is added by default, which is what we want. Don't include any other registries.

pkg/test/framework/components/pilot/pilot.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
xdsapi "github.com/envoyproxy/go-control-plane/envoy/api/v2"
2525

26+
meshConfig "istio.io/api/mesh/v1alpha1"
2627
"istio.io/istio/pkg/test/framework/components/galley"
2728
"istio.io/istio/pkg/test/framework/resource"
2829
)
@@ -41,6 +42,10 @@ type Config struct {
4142
fmt.Stringer
4243
// If set then pilot takes a dependency on the referenced Galley instance
4344
Galley galley.Instance
45+
46+
// The MeshConfig to be used for Pilot in native environment. In Kube environment this can be
47+
// configured with Helm.
48+
MeshConfig *meshConfig.MeshConfig
4449
}
4550

4651
// New returns a new instance of echo.

0 commit comments

Comments
 (0)