diff --git a/tools/internal_ci/linux/grpc_xds_k8s_lb.cfg b/tools/internal_ci/linux/grpc_xds_k8s_lb.cfg index 6ec4fa7b43b..6b38cae7557 100644 --- a/tools/internal_ci/linux/grpc_xds_k8s_lb.cfg +++ b/tools/internal_ci/linux/grpc_xds_k8s_lb.cfg @@ -16,7 +16,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/linux/grpc_xds_k8s_lb.sh" -timeout_mins: 90 +timeout_mins: 180 action { define_artifacts { regex: "artifacts/**/*sponge_log.xml" diff --git a/tools/internal_ci/linux/grpc_xds_k8s_lb.sh b/tools/internal_ci/linux/grpc_xds_k8s_lb.sh index 2fc89d4de3a..a3595e384a1 100755 --- a/tools/internal_ci/linux/grpc_xds_k8s_lb.sh +++ b/tools/internal_ci/linux/grpc_xds_k8s_lb.sh @@ -105,7 +105,14 @@ run_test() { --secondary_kube_context="${SECONDARY_KUBE_CONTEXT}" \ --server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \ --client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \ - --xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" + --xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \ + ${@:2} +} + +run_alpha_test() { + local test_name=$1 + run_test ${test_name} \ + --compute_api_version="v1alpha" } ####################################### @@ -144,6 +151,7 @@ main() { # Run tests cd "${TEST_DRIVER_FULL_DIR}" local failed_tests=0 + run_alpha_test subsetting_test || (( failed_tests++ )) test_suites=("change_backend_service_test" "failover_test" "remove_neg_test" "round_robin_test" "affinity_test") for test in "${test_suites[@]}"; do run_test $test || (( failed_tests++ )) diff --git a/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/api.py b/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/api.py index c9e18c76670..07cf15aa5dc 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/api.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/api.py @@ -115,6 +115,8 @@ class GcpApiManager: return self._build_from_file(self.compute_v1_discovery_file) else: return self._build_from_discovery_v1(api_name, version) + elif version == 'v1alpha': + return self._build_from_discovery_v1(api_name, 'alpha') raise NotImplementedError(f'Compute {version} not supported') diff --git a/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/compute.py b/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/compute.py index c17f4c7559d..c8a408f53c9 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/compute.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/compute.py @@ -40,8 +40,11 @@ class ComputeV1(gcp.api.GcpProjectApiResource): class ZonalGcpResource(GcpResource): zone: str - def __init__(self, api_manager: gcp.api.GcpApiManager, project: str): - super().__init__(api_manager.compute('v1'), project) + def __init__(self, + api_manager: gcp.api.GcpApiManager, + project: str, + version: str = 'v1'): + super().__init__(api_manager.compute(version), project) class HealthCheckProtocol(enum.Enum): TCP = enum.auto() diff --git a/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/traffic_director.py b/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/traffic_director.py index 326b23dd8d8..6e8bbfed919 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/traffic_director.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/infrastructure/traffic_director.py @@ -68,9 +68,12 @@ class TrafficDirectorManager: resource_prefix: str, resource_suffix: str, network: str = 'default', + compute_api_version: str = 'v1', ): # API - self.compute = _ComputeV1(gcp_api_manager, project) + self.compute = _ComputeV1(gcp_api_manager, + project, + version=compute_api_version) # Settings self.project: str = project diff --git a/tools/run_tests/xds_k8s_test_driver/framework/xds_flags.py b/tools/run_tests/xds_k8s_test_driver/framework/xds_flags.py index e93a45a0481..578f4e3fe6d 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/xds_flags.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/xds_flags.py @@ -36,6 +36,10 @@ RESOURCE_SUFFIX = flags.DEFINE_string( NETWORK = flags.DEFINE_string("network", default="default", help="GCP Network ID") +COMPUTE_API_VERSION = flags.DEFINE_string( + "compute_api_version", + default='v1', + help="The version of the GCP Compute API, e.g., v1, v1alpha") # Mirrors --xds-server-uri argument of Traffic Director gRPC Bootstrap XDS_SERVER_URI = flags.DEFINE_string( "xds_server_uri", diff --git a/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py b/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py index 0e8bef8c0aa..ff10e61b853 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py @@ -90,6 +90,7 @@ class XdsKubernetesTestCase(absltest.TestCase, metaclass=abc.ABCMeta): cls.xds_server_uri = xds_flags.XDS_SERVER_URI.value cls.ensure_firewall = xds_flags.ENSURE_FIREWALL.value cls.firewall_allowed_ports = xds_flags.FIREWALL_ALLOWED_PORTS.value + cls.compute_api_version = xds_flags.COMPUTE_API_VERSION.value # Resource names. cls.resource_prefix = xds_flags.RESOURCE_PREFIX.value @@ -329,11 +330,13 @@ class RegularXdsKubernetesTestCase(XdsKubernetesTestCase): cls.server_maintenance_port = KubernetesServerRunner.DEFAULT_MAINTENANCE_PORT def initTrafficDirectorManager(self) -> TrafficDirectorManager: - return TrafficDirectorManager(self.gcp_api_manager, - project=self.project, - resource_prefix=self.resource_prefix, - resource_suffix=self.resource_suffix, - network=self.network) + return TrafficDirectorManager( + self.gcp_api_manager, + project=self.project, + resource_prefix=self.resource_prefix, + resource_suffix=self.resource_suffix, + network=self.network, + compute_api_version=self.compute_api_version) def initKubernetesServerRunner(self) -> KubernetesServerRunner: return KubernetesServerRunner( @@ -400,7 +403,8 @@ class AppNetXdsKubernetesTestCase(RegularXdsKubernetesTestCase): project=self.project, resource_prefix=self.resource_prefix, resource_suffix=self.resource_suffix, - network=self.network) + network=self.network, + compute_api_version=self.compute_api_version) class SecurityXdsKubernetesTestCase(XdsKubernetesTestCase): @@ -431,7 +435,8 @@ class SecurityXdsKubernetesTestCase(XdsKubernetesTestCase): project=self.project, resource_prefix=self.resource_prefix, resource_suffix=self.resource_suffix, - network=self.network) + network=self.network, + compute_api_version=self.compute_api_version) def initKubernetesServerRunner(self) -> KubernetesServerRunner: return KubernetesServerRunner( diff --git a/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py b/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py index e3240c78893..44d5fad8733 100644 --- a/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py +++ b/tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py @@ -159,6 +159,7 @@ class GcpResourceManager(metaclass=_MetaSingletonAndAbslFlags): resource_prefix=self.resource_prefix, resource_suffix=(self.resource_suffix or ""), network=self.network, + compute_api_version=self.compute_api_version, ) # Kubernetes namespace self.k8s_namespace = k8s.KubernetesNamespace(self.k8s_api_manager,