Skip to content

Commit

Permalink
Merge branch 'main' into eds-config
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneo authored Aug 29, 2024
2 parents b416b03 + 0e87a36 commit b2bf3f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions framework/helpers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def __init__(
manager: ProcessManager,
**config: types.ContainerConfig,
):
logger.info("Running image %s as [%s]", image, name)
self.name = name
self.config = Configure(config, image, name)
self.container = None
Expand Down
16 changes: 16 additions & 0 deletions framework/infrastructure/gcp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
default=discovery.V2_DISCOVERY_URI,
help="Override v2 Discovery URI",
)
V2_DISCOVERY_FORCE_API_KEY = flags.DEFINE_boolean(
"v2_discovery_force_api_key",
default=False,
help=(
"Set flag to add API key when accessing staging networksecurity, "
"networkservices endpoints"
),
)
COMPUTE_V1_DISCOVERY_FILE = flags.DEFINE_string(
"compute_v1_discovery_file",
default=None,
Expand Down Expand Up @@ -91,6 +99,7 @@ def __init__(
private_api_key_secret_name=None,
gcp_ui_url=None,
verbose_gcp_api: bool = False,
v2_discovery_force_api_key: bool = False,
):
# Log GCP API requests and responses.
# Note: this modifies a global variable on googleapiclient.model.
Expand All @@ -110,6 +119,10 @@ def __init__(
# TODO(sergiitk): add options to pass google Credentials
self._exit_stack = contextlib.ExitStack()

self.v2_discovery_force_api_key = (
v2_discovery_force_api_key or V2_DISCOVERY_FORCE_API_KEY.value
)

def close(self):
self._exit_stack.close()
# Reset value of global googleapiclient.model.dump_request_response,
Expand Down Expand Up @@ -256,6 +269,9 @@ def _build_from_discovery_v2(
params = {}
if api_key:
params["key"] = api_key
elif self.v2_discovery_force_api_key:
params["key"] = self.private_api_key

if visibility_labels:
# Dash-separated list of labels.
params["labels"] = "_".join(visibility_labels)
Expand Down
3 changes: 0 additions & 3 deletions tests/fallback_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@ def setUpClass():
)

def setUp(self):
logger.info("Starting %s", self.id())
self.process_manager = framework.helpers.docker.ProcessManager(
bootstrap=FallbackTest.bootstrap,
node_id=_NODE_ID.value,
)

def start_client(self, port: int = None, name: str = None):
logger.debug("Starting client process")
return framework.helpers.docker.Client(
manager=self.process_manager,
name=name or framework.xds_flags.CLIENT_NAME.value,
Expand All @@ -99,7 +97,6 @@ def start_client(self, port: int = None, name: str = None):
def start_control_plane(
self, name: str, port: int, upstream_port: int, cluster_name=None
):
logger.debug('Starting control plane "%s"', name)
return framework.helpers.docker.ControlPlane(
self.process_manager,
name=name,
Expand Down

0 comments on commit b2bf3f6

Please sign in to comment.