Skip to content

Commit

Permalink
Rebase onto main
Browse files Browse the repository at this point in the history
  • Loading branch information
larry-safran committed Jul 30, 2024
1 parent 3ad61fc commit f5e643c
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 20 deletions.
2 changes: 2 additions & 0 deletions config/common-dualstack.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
--resource_prefix=psm-ds
--enable_dualstack
--noenable_workload_identity
--compute_api_version=v1beta
--network=dualstack
5 changes: 4 additions & 1 deletion framework/test_app/runners/k8s/gamma_server_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(
deployment_name: str,
image_name: str,
td_bootstrap_image: str,
app_label: str = "",
network: str = "default",
xds_server_uri: Optional[str] = None,
gcp_api_manager: gcp.api.GcpApiManager,
Expand All @@ -88,6 +89,7 @@ def __init__(
deployment_name=deployment_name,
image_name=image_name,
td_bootstrap_image=td_bootstrap_image,
app_label=app_label,
network=network,
xds_server_uri=xds_server_uri,
gcp_api_manager=gcp_api_manager,
Expand Down Expand Up @@ -154,7 +156,7 @@ def run( # pylint: disable=arguments-differ
self.service_template,
service_name=self.service_name,
namespace_name=self.k8s_namespace.name,
deployment_name=self.deployment_name,
app_label=self.app_label,
neg_name=self.gcp_neg_name,
test_port=test_port,
)
Expand Down Expand Up @@ -199,6 +201,7 @@ def run( # pylint: disable=arguments-differ
deployment_name=self.deployment_name,
image_name=self.image_name,
namespace_name=self.k8s_namespace.name,
app_label=self.app_label,
service_account_name=self.service_account_name,
td_bootstrap_image=self.td_bootstrap_image,
xds_server_uri=self.xds_server_uri,
Expand Down
8 changes: 4 additions & 4 deletions framework/test_app/runners/k8s/k8s_base_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class KubernetesBaseRunner(base_runner.BaseRunner, metaclass=ABCMeta):
# Required fields.
k8s_namespace: k8s.KubernetesNamespace
deployment_name: str
app_label: str
image_name: str
gcp_project: str
gcp_service_account: str
Expand Down Expand Up @@ -141,6 +142,7 @@ def __init__(
gcp_project: str,
gcp_service_account: str,
gcp_ui_url: str,
app_label: str = "",
namespace_template: Optional[str] = "namespace.yaml",
reuse_namespace: bool = False,
):
Expand All @@ -150,6 +152,7 @@ def __init__(
self.deployment_name = deployment_name
self.image_name = image_name
self.gcp_project = gcp_project
self.app_label = app_label or deployment_name
# Maps GCP service account to Kubernetes service account
self.gcp_service_account = gcp_service_account
self.gcp_ui_url = gcp_ui_url
Expand Down Expand Up @@ -999,10 +1002,7 @@ def _wait_pod_started(self, name, **kwargs) -> k8s.V1Pod:
self.k8s_namespace.wait_for_pod_started(name, **kwargs)
pod = self.k8s_namespace.get_pod(name)

if hasattr(pod.status, "pod_ip_s"): # if running with dualstack support
pod_ips = pod.status.pod_ip_s
else:
pod_ips = pod.status.pod_ip
pod_ips = pod.status.pod_i_ps or pod.status.pod_ip
logger.info("Pod %s ready, IP: %s", pod.metadata.name, pod_ips)
return pod

Expand Down
3 changes: 3 additions & 0 deletions framework/test_app/runners/k8s/k8s_xds_client_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__( # pylint: disable=too-many-locals
deployment_name: str,
image_name: str,
td_bootstrap_image: str,
app_label: str = "",
network="default",
xds_server_uri: Optional[str] = None,
gcp_api_manager: gcp.api.GcpApiManager,
Expand All @@ -84,6 +85,7 @@ def __init__( # pylint: disable=too-many-locals
deployment_name=deployment_name,
image_name=image_name,
gcp_project=gcp_project,
app_label=app_label,
gcp_service_account=gcp_service_account,
gcp_ui_url=gcp_api_manager.gcp_ui_url,
namespace_template=namespace_template,
Expand Down Expand Up @@ -173,6 +175,7 @@ def run( # pylint: disable=arguments-differ
deployment_name=self.deployment_name,
image_name=self.image_name,
namespace_name=self.k8s_namespace.name,
app_label=self.app_label,
service_account_name=self.service_account_name,
td_bootstrap_image=self.td_bootstrap_image,
xds_server_uri=self.xds_server_uri,
Expand Down
7 changes: 6 additions & 1 deletion framework/test_app/runners/k8s/k8s_xds_server_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__( # pylint: disable=too-many-locals
deployment_name: str,
image_name: str,
td_bootstrap_image: str,
app_label: str = "",
network: str = "default",
xds_server_uri: Optional[str] = None,
gcp_api_manager: gcp.api.GcpApiManager,
Expand All @@ -115,6 +116,7 @@ def __init__( # pylint: disable=too-many-locals
deployment_name=deployment_name,
image_name=image_name,
gcp_project=gcp_project,
app_label=app_label,
gcp_service_account=gcp_service_account,
gcp_ui_url=gcp_api_manager.gcp_ui_url,
namespace_template=namespace_template,
Expand Down Expand Up @@ -170,6 +172,7 @@ def run( # pylint: disable=arguments-differ,too-many-branches
test_port: int = DEFAULT_TEST_PORT,
maintenance_port: Optional[int] = None,
secure_mode: bool = False,
address_type: str = "",
replica_count: int = 1,
log_to_stdout: bool = False,
bootstrap_version: Optional[str] = None,
Expand Down Expand Up @@ -222,7 +225,7 @@ def run( # pylint: disable=arguments-differ,too-many-branches
self.service_template,
service_name=self.service_name,
namespace_name=self.k8s_namespace.name,
deployment_name=self.deployment_name,
app_label=self.app_label,
neg_name=self.gcp_neg_name,
test_port=test_port,
enable_dualstack=self.enable_dualstack,
Expand Down Expand Up @@ -252,6 +255,7 @@ def run( # pylint: disable=arguments-differ,too-many-branches
deployment_name=self.deployment_name,
image_name=self.image_name,
namespace_name=self.k8s_namespace.name,
app_label=self.app_label,
service_account_name=self.service_account_name,
td_bootstrap_image=self.td_bootstrap_image,
xds_server_uri=self.xds_server_uri,
Expand All @@ -260,6 +264,7 @@ def run( # pylint: disable=arguments-differ,too-many-branches
test_port=test_port,
maintenance_port=maintenance_port,
secure_mode=secure_mode,
address_type=address_type,
bootstrap_version=bootstrap_version,
**self.deployment_args.as_dict(),
)
Expand Down
3 changes: 3 additions & 0 deletions framework/test_app/server_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def __init__(
self.xds_host, self.xds_port = xds_host, xds_port
self.monitoring_port = monitoring_port

def __repr__(self):
return f"XdsTestServer(ip={self.ip}, hostname={self.hostname})"

@property
@functools.lru_cache(None)
def channelz(self) -> _ChannelzServiceClient:
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/client-secure.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ metadata:
name: ${deployment_name}
namespace: ${namespace_name}
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
spec:
replicas: 1
selector:
matchLabels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
template:
metadata:
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
annotations:
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/client.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ metadata:
name: ${deployment_name}
namespace: ${namespace_name}
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
spec:
replicas: 1
selector:
matchLabels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
template:
metadata:
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
spec:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-manifests/gamma/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
spec:
type: ClusterIP
selector:
app: ${deployment_name}
app: ${app_label}
ports:
- port: ${test_port}
protocol: TCP
Expand Down
6 changes: 3 additions & 3 deletions kubernetes-manifests/server-secure.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ metadata:
name: ${deployment_name}
namespace: ${namespace_name}
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
spec:
replicas: ${replica_count}
selector:
matchLabels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
template:
metadata:
annotations:
security.cloud.google.com/use-workload-certificates: ""
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
spec:
Expand Down
11 changes: 8 additions & 3 deletions kubernetes-manifests/server.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ metadata:
name: ${deployment_name}
namespace: ${namespace_name}
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
spec:
replicas: ${replica_count}
selector:
matchLabels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
template:
metadata:
labels:
app: ${deployment_name}
app: ${app_label}
deployment_id: ${deployment_id}
owner: xds-k8s-interop-test
spec:
Expand All @@ -32,19 +32,24 @@ spec:
- name: ${deployment_name}
image: ${image_name}
imagePullPolicy: Always
% if address_type != "ipv6":
startupProbe:
tcpSocket:
port: ${test_port}
periodSeconds: 3
## Extend the number of probes well beyond the duration of the test
## driver waiting for the container to start.
failureThreshold: 1000
% endif
${prestop_hook.main_lifecycle() if pre_stop_hook else ''}
args:
- "--port=${test_port}"
% if enable_csm_observability:
- "--enable_csm_observability=true"
% endif
% if address_type:
- "--address_type=${address_type}"
% endif
ports:
- containerPort: ${test_port}
env:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-manifests/server.service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
- IPv4
% endif
selector:
app: ${deployment_name}
app: ${app_label}
ports:
- port: ${test_port}
protocol: TCP
Expand Down
Loading

0 comments on commit f5e643c

Please sign in to comment.