Update appnet interop (#29472)

* Update appnet interop

* Whoopsie

* Add additional debug

* Grr

* Revert "Grr"

This reverts commit 580cdea3d3.

* Revert "Add additional debug"

This reverts commit 0d5fdc6691.

* Try different strategy

* Remove debug print

* Yapf

* Review comments
pull/29491/head
Richard Belleville 3 years ago committed by GitHub
parent d6e91959a7
commit efe5a4611d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      tools/run_tests/xds_k8s_test_driver/bin/run_test_client.py
  2. 12
      tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/network_services.py
  3. 8
      tools/run_tests/xds_k8s_test_driver/framework/infrastructure/traffic_director.py
  4. 5
      tools/run_tests/xds_k8s_test_driver/framework/test_app/client_app.py
  5. 4
      tools/run_tests/xds_k8s_test_driver/framework/xds_flags.py
  6. 10
      tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py
  7. 4
      tools/run_tests/xds_k8s_test_driver/kubernetes-manifests/client-secure.deployment.yaml
  8. 4
      tools/run_tests/xds_k8s_test_driver/kubernetes-manifests/client.deployment.yaml
  9. 3
      tools/run_tests/xds_k8s_test_driver/tests/app_net_test.py

@ -35,6 +35,10 @@ _QPS = flags.DEFINE_integer('qps', default=25, help='Queries per second')
_PRINT_RESPONSE = flags.DEFINE_bool("print_response",
default=False,
help="Client prints responses")
_CONFIG_MESH = flags.DEFINE_bool(
"config_mesh",
default=None,
help="Optional. Supplied to bootstrap generator to indicate AppNet mesh.")
_REUSE_NAMESPACE = flags.DEFINE_bool("reuse_namespace",
default=True,
help="Use existing namespace if exists")
@ -69,7 +73,6 @@ def main(argv):
gcp_service_account=gcp_service_account,
xds_server_uri=xds_flags.XDS_SERVER_URI.value,
network=xds_flags.NETWORK.value,
config_scope=xds_flags.CONFIG_SCOPE.value,
stats_port=xds_flags.CLIENT_PORT.value,
reuse_namespace=_REUSE_NAMESPACE.value)
@ -94,7 +97,8 @@ def main(argv):
server_target=f'xds:///{server_xds_host}:{server_xds_port}',
qps=_QPS.value,
print_response=_PRINT_RESPONSE.value,
secure_mode=_SECURE.value)
secure_mode=_SECURE.value,
config_mesh=_CONFIG_MESH.value)
elif _CMD.value == 'cleanup':
logger.info('Cleanup client')

@ -59,9 +59,6 @@ class Mesh:
name: str
url: str
type: str
scope: Optional[str]
network: Optional[str]
routes: Optional[List[str]]
@classmethod
@ -69,9 +66,6 @@ class Mesh:
return cls(
name=name,
url=d["name"],
type=d["type"],
scope=d.get("scope"),
network=d.get("network"),
routes=list(d["routes"]) if "routes" in d else None,
)
@ -139,17 +133,13 @@ class GrpcRoute:
@dataclasses.dataclass(frozen=True)
class RouteAction:
destinations: List['Destination']
drop: Optional[int]
@classmethod
def from_response(cls, d: Dict[str, Any]) -> 'RouteAction':
destinations = [
Destination.from_response(dest) for dest in d["destinations"]
] if "destinations" in d else []
return cls(
destinations=destinations,
drop=d.get("drop"),
)
return cls(destinations=destinations)
@dataclasses.dataclass(frozen=True)
class RouteRule:

@ -642,7 +642,6 @@ class TrafficDirectorAppNetManager(TrafficDirectorManager):
project: str,
*,
resource_prefix: str,
config_scope: str,
resource_suffix: Optional[str] = None,
network: str = 'default',
compute_api_version: str = 'v1'):
@ -653,8 +652,6 @@ class TrafficDirectorAppNetManager(TrafficDirectorManager):
network=network,
compute_api_version=compute_api_version)
self.config_scope = config_scope
# API
self.netsvc = _NetworkServicesV1Alpha1(gcp_api_manager, project)
@ -665,10 +662,7 @@ class TrafficDirectorAppNetManager(TrafficDirectorManager):
def create_mesh(self) -> GcpResource:
name = self.make_resource_name(self.MESH_NAME)
logger.info("Creating Mesh %s", name)
body = {
"type": "PROXYLESS_GRPC",
"scope": self.config_scope,
}
body = {}
resource = self.netsvc.create_mesh(name, body)
self.mesh = self.netsvc.get_mesh(name)
logger.debug("Loaded Mesh: %s", self.mesh)

@ -238,7 +238,6 @@ class KubernetesClientRunner(base_runner.KubernetesBaseRunner):
gcp_service_account: str,
xds_server_uri=None,
network='default',
config_scope=None,
service_account_name=None,
stats_port=8079,
deployment_template='client.deployment.yaml',
@ -257,7 +256,6 @@ class KubernetesClientRunner(base_runner.KubernetesBaseRunner):
self.td_bootstrap_image = td_bootstrap_image
self.xds_server_uri = xds_server_uri
self.network = network
self.config_scope = config_scope
self.deployment_template = deployment_template
self.debug_use_port_forwarding = debug_use_port_forwarding
self.enable_workload_identity = enable_workload_identity
@ -291,6 +289,7 @@ class KubernetesClientRunner(base_runner.KubernetesBaseRunner):
qps=25,
metadata='',
secure_mode=False,
config_mesh=None,
print_response=False) -> XdsTestClient:
logger.info(
'Deploying xDS test client "%s" to k8s namespace %s: '
@ -329,13 +328,13 @@ class KubernetesClientRunner(base_runner.KubernetesBaseRunner):
td_bootstrap_image=self.td_bootstrap_image,
xds_server_uri=self.xds_server_uri,
network=self.network,
config_scope=self.config_scope,
stats_port=self.stats_port,
server_target=server_target,
rpc=rpc,
qps=qps,
metadata=metadata,
secure_mode=secure_mode,
config_mesh=config_mesh,
print_response=print_response)
self._wait_deployment_with_available_replicas(self.deployment_name)

@ -36,10 +36,6 @@ RESOURCE_SUFFIX = flags.DEFINE_string(
NETWORK = flags.DEFINE_string("network",
default="default",
help="GCP Network ID")
CONFIG_SCOPE = flags.DEFINE_string(
"config_scope",
default=None,
help="Scope specified in mesh if using AppNet APIs")
COMPUTE_API_VERSION = flags.DEFINE_string(
"compute_api_version",
default='v1',

@ -77,7 +77,6 @@ class XdsKubernetesTestCase(absltest.TestCase, metaclass=abc.ABCMeta):
server_runner: KubernetesServerRunner
server_xds_port: int
td: TrafficDirectorManager
config_scope: str
@staticmethod
def isSupported(config: skips.TestConfig) -> bool:
@ -150,12 +149,6 @@ class XdsKubernetesTestCase(absltest.TestCase, metaclass=abc.ABCMeta):
logger.info('Test run resource prefix: %s, suffix: %s',
self.resource_prefix, self.resource_suffix)
if xds_flags.CONFIG_SCOPE.value is not None:
self.config_scope = xds_flags.CONFIG_SCOPE.value + "-" + framework.helpers.rand.random_resource_suffix(
)
else:
self.config_scope = None
# TD Manager
self.td = self.initTrafficDirectorManager()
@ -477,7 +470,6 @@ class RegularXdsKubernetesTestCase(XdsKubernetesTestCase):
gcp_service_account=self.gcp_service_account,
xds_server_uri=self.xds_server_uri,
network=self.network,
config_scope=self.config_scope,
debug_use_port_forwarding=self.debug_use_port_forwarding,
enable_workload_identity=self.enable_workload_identity,
stats_port=self.client_port,
@ -517,7 +509,6 @@ class AppNetXdsKubernetesTestCase(RegularXdsKubernetesTestCase):
resource_prefix=self.resource_prefix,
resource_suffix=self.resource_suffix,
network=self.network,
config_scope=self.config_scope,
compute_api_version=self.compute_api_version)
@ -579,7 +570,6 @@ class SecurityXdsKubernetesTestCase(XdsKubernetesTestCase):
gcp_service_account=self.gcp_service_account,
xds_server_uri=self.xds_server_uri,
network=self.network,
config_scope=self.config_scope,
deployment_template='client-secure.deployment.yaml',
stats_port=self.client_port,
reuse_namespace=self.server_namespace == self.client_namespace,

@ -63,8 +63,8 @@ spec:
% if xds_server_uri:
- "--xds-server-uri=${xds_server_uri}"
% endif
% if config_scope:
- "--config-scope-experimental=${config_scope_experimental}"
% if config_mesh:
- "--config-mesh-experimental=${config_mesh}"
% endif
- "--include-v3-features-experimental"
- "--include-psm-security-experimental"

@ -63,8 +63,8 @@ spec:
% if xds_server_uri:
- "--xds-server-uri=${xds_server_uri}"
% endif
% if config_scope:
- "--config-scope-experimental=${config_scope}"
% if config_mesh:
- "--config-mesh-experimental=${config_mesh}"
% endif
resources:
limits:

@ -49,7 +49,8 @@ class AppNetTest(xds_k8s_testcase.AppNetXdsKubernetesTestCase):
self.setupServerBackends()
with self.subTest('6_start_test_client'):
test_client: _XdsTestClient = self.startTestClient(test_server)
test_client: _XdsTestClient = self.startTestClient(
test_server, config_mesh=self.td.mesh.name)
with self.subTest('7_assert_xds_config_exists'):
self.assertXdsConfigExists(test_client)

Loading…
Cancel
Save