-
Notifications
You must be signed in to change notification settings - Fork 34
cloudrun: GKE client to cloudrun server test #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eshitachandwani
merged 61 commits into
grpc:main
from
eshitachandwani:eshita_gke_cloudrun
Apr 22, 2025
Merged
Changes from 58 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
ad3d5ca
cloudrun server test
sourabhsinghs 45f84dc
Merge branch 'main' into feature/cloudrun/server-test
sourabhsinghs 6859957
cloudrun server test
sourabhsinghs 39c5cbe
check patch
eshitachandwani 87317ec
correct logging import and remove clourun server flag
eshitachandwani a9f88b0
client test not working
eshitachandwani 0142857
changes
eshitachandwani 579f782
running tests
eshitachandwani 64cd9f1
run black and isort
eshitachandwani 1a1c974
pylint error
eshitachandwani 6d5e0de
pylint error
eshitachandwani bc64577
remove unwanted files
eshitachandwani b9be8ca
address comments
eshitachandwani 521bf5e
pylint
eshitachandwani 8455a1e
address comments
eshitachandwani d04238e
pylint
eshitachandwani 10e9589
black
eshitachandwani 91ddacc
working cloudrun_server test
eshitachandwani bc72f63
formatting
eshitachandwani a70ea9b
pylint
eshitachandwani 2685397
pylint
eshitachandwani 75184b9
address comments
eshitachandwani 0b235ee
black
eshitachandwani 486c554
add cloudrunlogs
eshitachandwani 47447cf
flag file
eshitachandwani ab09f9c
test suit
eshitachandwani 9af09ec
pull from main
eshitachandwani 2c270c2
create_resource
eshitachandwani 65f29bf
address comments
eshitachandwani 54e9052
black
eshitachandwani e701237
minor changes
eshitachandwani cd54ed4
use gcpstandardresource
eshitachandwani 5759ea6
neg changes
eshitachandwani 8d0f40e
correct keyerror
eshitachandwani 1ad1b42
change yaml
eshitachandwani 7f2fe02
Merge branch 'main' into eshita_gke_cloudrun
eshitachandwani d25b162
comments
eshitachandwani 32303e3
gerg
eshitachandwani 3b3ae6a
common.py
eshitachandwani 0917ffa
pylint
eshitachandwani aca0c15
pylint
eshitachandwani 4a7feb9
comments
eshitachandwani d3d0ebe
Merge branch 'main' into eshita_gke_cloudrun
eshitachandwani 8bc4940
comments
eshitachandwani 9405c48
Merge branch 'eshita_gke_cloudrun' of https://github.com/eshitachandw…
eshitachandwani 7fc75d3
Merge branch 'main' into eshita_gke_cloudrun
eshitachandwani 224e2d8
address comments
eshitachandwani 7bf2e26
Merge branch 'eshita_gke_cloudrun' of https://github.com/eshitachandw…
eshitachandwani aec4ad8
pulint
eshitachandwani f37e51b
Merge branch 'main' into eshita_gke_cloudrun
eshitachandwani 74676f8
pulint
eshitachandwani 4d3bb70
Merge branch 'eshita_gke_cloudrun' of https://github.com/eshitachandw…
eshitachandwani 9660983
comments
eshitachandwani 1e7c4a5
Moving is_trusted_xds_server_experimental to client deployment args
sergiitk 5128b98
Specify supported cloud run langs/versions in is_supported
sergiitk 984dd50
refactor deploy_service
eshitachandwani f45b383
deploy_services
eshitachandwani bedb294
deploy_services
eshitachandwani f9a9c20
fix test
eshitachandwani 544c361
test
eshitachandwani 97cbf2f
change test
eshitachandwani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Copyright 2025 gRPC authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| """ | ||
| Run test xds server. | ||
|
|
||
| Typical usage examples: | ||
|
|
||
| # Help. | ||
| ./run.sh ./bin/run_test_server_cloud_run.py --help | ||
|
|
||
| """ | ||
| import logging | ||
|
|
||
| from absl import app | ||
| from absl import flags | ||
|
|
||
| from bin.lib import common | ||
| from framework import xds_flags | ||
| from framework import xds_k8s_flags | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| flags.adopt_module_key_flags(xds_flags) | ||
| flags.adopt_module_key_flags(xds_k8s_flags) | ||
| flags.adopt_module_key_flags(common) | ||
|
|
||
|
|
||
| def main(argv): | ||
|
sergiitk marked this conversation as resolved.
|
||
| if len(argv) > 1: | ||
| raise app.UsageError("Too many command-line arguments.") | ||
|
|
||
| xds_flags.set_socket_default_timeout_from_flag() | ||
|
|
||
| server_runner = common.make_cloud_run_server_runner() | ||
| server_runner.run() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| app.run(main) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Common config file for Cloudrun PSM tests. | ||
| --cloud_run_region=us-central1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Copyright 2025 gRPC authors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| import abc | ||
| import dataclasses | ||
| import logging | ||
| from typing import Any, Final | ||
|
|
||
| from framework.infrastructure import gcp | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
sergiitk marked this conversation as resolved.
Outdated
|
||
|
|
||
| @dataclasses.dataclass(frozen=True) | ||
| class CloudRunService: | ||
| service_name: str | ||
| url: str | ||
|
sergiitk marked this conversation as resolved.
Outdated
|
||
|
|
||
| @classmethod | ||
| def from_response( | ||
| cls, name: str, response: dict[str, Any] | ||
| ) -> "CloudRunService": | ||
| return cls( | ||
| service_name=name, | ||
| url=response["uri"], | ||
| ) | ||
|
|
||
|
|
||
| class CloudRunV2(gcp.api.GcpStandardCloudApiResource, metaclass=abc.ABCMeta): | ||
| """Cloud Run API v2.""" | ||
|
|
||
| SERVICES: Final[str] = "services" | ||
|
|
||
| region: str | ||
|
|
||
| def __init__( | ||
| self, api_manager: gcp.api.GcpApiManager, project: str, region: str | ||
| ): | ||
| if not project: | ||
| raise ValueError("Project ID cannot be empty or None.") | ||
| if not region: | ||
| raise ValueError("Region cannot be empty or None.") | ||
| self.region = region | ||
| super().__init__(api_manager.cloudrun(self.api_version), project) | ||
| self._services_collection = self.api.projects().locations().services() | ||
|
|
||
| @property | ||
| def api_name(self) -> str: | ||
| """Returns the API name for Cloud Run.""" | ||
| return "Cloud Run" | ||
|
|
||
| @property | ||
| def api_version(self) -> str: | ||
| """Returns the API version for Cloud Run.""" | ||
| return "v2" | ||
|
|
||
| def create_service(self, service_name: str, body: dict) -> None: | ||
| return self._create_resource( | ||
| collection=self._services_collection, | ||
| location=self.region, | ||
| serviceId=service_name, | ||
| body=body, | ||
| ) | ||
|
|
||
| def get_service(self, service_name: str) -> CloudRunService: | ||
| result = self._get_resource( | ||
| collection=self._services_collection, | ||
| full_name=self.resource_full_name( | ||
| service_name, self.SERVICES, self.region | ||
| ), | ||
| ) | ||
| return CloudRunService.from_response( | ||
| self.resource_full_name(service_name, self.SERVICES, self.region), | ||
| result, | ||
| ) | ||
|
|
||
| def delete_service(self, service_name: str): | ||
| self._delete_resource( | ||
| self._services_collection, | ||
| full_name=self.resource_full_name( | ||
| service_name, self.SERVICES, self.region | ||
| ), | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.