xds_flags.py
Go to the documentation of this file.
1 # Copyright 2020 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 from absl import flags
15 
16 from framework.helpers import highlighter
17 
18 # GCP
19 PROJECT = flags.DEFINE_string("project",
20  default=None,
21  help="(required) GCP Project ID.")
22 RESOURCE_PREFIX = flags.DEFINE_string(
23  "resource_prefix",
24  default=None,
25  help=("(required) The prefix used to name GCP resources.\n"
26  "Together with `resource_suffix` used to create unique "
27  "resource names."))
28 RESOURCE_SUFFIX = flags.DEFINE_string(
29  "resource_suffix",
30  default=None,
31  help=("The suffix used to name GCP resources.\n"
32  "Together with `resource_prefix` used to create unique "
33  "resource names.\n"
34  "(default: test suite will generate a random suffix, based on suite "
35  "resource management preferences)"))
36 NETWORK = flags.DEFINE_string("network",
37  default="default",
38  help="GCP Network ID")
39 COMPUTE_API_VERSION = flags.DEFINE_string(
40  "compute_api_version",
41  default='v1',
42  help="The version of the GCP Compute API, e.g., v1, v1alpha")
43 # Mirrors --xds-server-uri argument of Traffic Director gRPC Bootstrap
44 XDS_SERVER_URI = flags.DEFINE_string(
45  "xds_server_uri",
46  default=None,
47  help="Override Traffic Director server URI.")
48 ENSURE_FIREWALL = flags.DEFINE_bool(
49  "ensure_firewall",
50  default=False,
51  help="Ensure the allow-health-check firewall exists before each test case")
52 FIREWALL_SOURCE_RANGE = flags.DEFINE_list(
53  "firewall_source_range",
54  default=['35.191.0.0/16', '130.211.0.0/22'],
55  help="Update the source range of the firewall rule.")
56 FIREWALL_ALLOWED_PORTS = flags.DEFINE_list(
57  "firewall_allowed_ports",
58  default=['8080-8100'],
59  help="Update the allowed ports of the firewall rule.")
60 
61 # Test server
62 SERVER_NAME = flags.DEFINE_string(
63  "server_name",
64  default="psm-grpc-server",
65  help="The name to use for test server deployments.")
66 SERVER_PORT = flags.DEFINE_integer(
67  "server_port",
68  default=8080,
69  lower_bound=1,
70  upper_bound=65535,
71  help="Server test port.\nMust be within --firewall_allowed_ports.")
72 SERVER_MAINTENANCE_PORT = flags.DEFINE_integer(
73  "server_maintenance_port",
74  default=None,
75  lower_bound=1,
76  upper_bound=65535,
77  help=("Server port running maintenance services: Channelz, CSDS, Health, "
78  "XdsUpdateHealth, and ProtoReflection (optional).\n"
79  "Must be within --firewall_allowed_ports.\n"
80  "(default: the port is chosen automatically based on "
81  "the security configuration)"))
82 SERVER_XDS_HOST = flags.DEFINE_string(
83  "server_xds_host",
84  default="xds-test-server",
85  help=("The xDS hostname of the test server.\n"
86  "Together with `server_xds_port` makes test server target URI, "
87  "xds:///hostname:port"))
88 # Note: port 0 known to represent a request for dynamically-allocated port
89 # https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers#Well-known_ports
90 SERVER_XDS_PORT = flags.DEFINE_integer(
91  "server_xds_port",
92  default=8080,
93  lower_bound=0,
94  upper_bound=65535,
95  help=("The xDS port of the test server.\n"
96  "Together with `server_xds_host` makes test server target URI, "
97  "xds:///hostname:port\n"
98  "Must be unique within a GCP project.\n"
99  "Set to 0 to select any unused port."))
100 
101 # Test client
102 CLIENT_NAME = flags.DEFINE_string(
103  "client_name",
104  default="psm-grpc-client",
105  help="The name to use for test client deployments")
106 CLIENT_PORT = flags.DEFINE_integer(
107  "client_port",
108  default=8079,
109  lower_bound=1,
110  upper_bound=65535,
111  help=(
112  "The port test client uses to run gRPC services: Channelz, CSDS, "
113  "XdsStats, XdsUpdateClientConfigure, and ProtoReflection (optional).\n"
114  "Doesn't have to be within --firewall_allowed_ports."))
115 
116 # Testing metadata
117 TESTING_VERSION = flags.DEFINE_string(
118  "testing_version",
119  default=None,
120  help="The testing gRPC version branch name. Like master, v1.41.x, v1.37.x")
121 
122 FORCE_CLEANUP = flags.DEFINE_bool(
123  "force_cleanup",
124  default=False,
125  help="Force resource cleanup, even if not created by this test run")
126 
127 flags.adopt_module_key_flags(highlighter)
128 
129 flags.mark_flags_as_required([
130  "project",
131  "resource_prefix",
132 ])
framework.helpers
Definition: tools/run_tests/xds_k8s_test_driver/framework/helpers/__init__.py:1


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:56