Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Jan 8, 2024
1 parent 4d9c169 commit 84314a7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
1 change: 1 addition & 0 deletions framework/infrastructure/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
GcpSessionAffinityPolicy = DynResourceInstance
GcpSessionAffinityFilter = DynResourceInstance
GcpBackendPolicy = DynResourceInstance
PodMonitoring = DynResourceInstance

_timedelta = datetime.timedelta
_datetime = datetime.datetime
Expand Down
39 changes: 24 additions & 15 deletions framework/test_app/runners/k8s/k8s_base_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,23 +299,32 @@ def _reuse_namespace(self) -> k8s.V1Namespace:
logger.info("Reusing namespace: %s", self.k8s_namespace.name)
return self.k8s_namespace.get()

def _create_pod_monitoring(self, template, **kwargs) -> None:
if not kwargs["namespace_name"]:
raise _RunnerError(
"namespace_name required to create PodMonitoring resource"
)
if not kwargs["deployment_id"]:
raise _RunnerError(
"deployment_id required to create PodMonitoring resource"
)
if not kwargs["pod_monitoring_name"]:
raise _RunnerError(
"pod_monitoring_name required to create PodMonitoring resource"
)
def _create_pod_monitoring(
self,
template,
*,
namespace_name: str,
deployment_id: str,
pod_monitoring_name: str,
**kwargs,
) -> None:
pod_monitoring = self._create_from_template(
template, custom_object=True, **kwargs
template,
custom_object=True,
namespace_name=namespace_name,
deployment_id=deployment_id,
pod_monitoring_name=pod_monitoring_name,
**kwargs,
)
if pod_monitoring.metadata.namespace != kwargs["namespace_name"]:
if not (
isinstance(pod_monitoring, k8s.PodMonitoring)
and pod_monitoring.kind == "PodMonitoring"
):
raise _RunnerError(
f"Expected ResourceInstance[PodMonitoring] to be created from"
f" manifest {template}"
)
if pod_monitoring.metadata.namespace != namespace_name:
raise _RunnerError(
"PodMonitoring resource created with unexpected namespace: "
f"{pod_monitoring.metadata.namespace}"
Expand Down
2 changes: 1 addition & 1 deletion framework/test_app/runners/k8s/k8s_xds_client_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def run( # pylint: disable=arguments-differ
"csm/pod-monitoring.yaml",
namespace_name=self.k8s_namespace.name,
deployment_id=self.deployment_id,
pod_monitoring_name="%s-gmp" % self.deployment_id,
pod_monitoring_name=f"{self.deployment_id}-gmp",
)

# Load test client pod. We need only one client at the moment
Expand Down
2 changes: 1 addition & 1 deletion tests/gamma/csm_observability_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


class CsmObservabilityTest(xds_gamma_testcase.GammaXdsKubernetesTestCase):
def test_ping_pong(self):
def test_csm_observability(self):
# TODO(sergiitk): [GAMMA] Consider moving out custom gamma
# resource creation out of self.startTestServers()
with self.subTest("1_run_test_server"):
Expand Down

0 comments on commit 84314a7

Please sign in to comment.