Skip to content

Commit 99f9e2d

Browse files
Merge pull request #6554 from manojcns:postgres-gke-pr1-core
PiperOrigin-RevId: 889921873
2 parents b1e2fd7 + 0b5096e commit 99f9e2d

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

perfkitbenchmarker/providers/gcp/google_kubernetes_engine.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ class GkeCluster(BaseGkeCluster):
269269

270270
def __init__(self, spec: container_spec_lib.ContainerClusterSpec):
271271
super().__init__(spec)
272+
# Initialize event_poller to None to avoid AttributeError
273+
if not hasattr(self, 'event_poller'):
274+
self.event_poller = None
272275
# Update the environment for gcloud commands:
273276
if gcp_flags.GKE_API_OVERRIDE.value:
274277
os.environ['CLOUDSDK_API_ENDPOINT_OVERRIDES_CONTAINER'] = (

perfkitbenchmarker/resources/container_service/kubernetes_cluster.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,33 @@ def _WaitForIngress(self, name: str, namespace: str, port: int) -> str:
260260
])
261261
return f'{self._GetAddressFromIngress(stdout)}:{port}'
262262

263+
def ApplyManifest(self, manifest_file: str, **kwargs) -> Any:
264+
"""Applies a declarative Kubernetes manifest; possibly with jinja."""
265+
return kubernetes_commands.ApplyManifest(manifest_file, **kwargs)
266+
267+
def WaitForResource(
268+
self,
269+
resource_name: str,
270+
condition_name: str,
271+
namespace: str | None = None,
272+
timeout: int = vm_util.DEFAULT_TIMEOUT,
273+
wait_for_all: bool = False,
274+
condition_type: str = 'condition=',
275+
extra_args: list[str] | None = None,
276+
**kwargs,
277+
) -> None:
278+
"""Waits for a condition on a Kubernetes resource (eg: deployment, pod)."""
279+
return kubernetes_commands.WaitForResource(
280+
resource_name,
281+
condition_name,
282+
namespace,
283+
timeout,
284+
wait_for_all,
285+
condition_type,
286+
extra_args,
287+
**kwargs,
288+
)
289+
263290
def _GetAddressFromIngress(self, ingress_out: str):
264291
"""Gets the endpoint address from the Ingress resource."""
265292
ingress = json.loads(ingress_out.strip("'"))
@@ -306,7 +333,7 @@ def _DeleteAllFromDefaultNamespace():
306333
kubectl.RunRetryableKubectlCommand(run_cmd, timeout=timeout)
307334

308335
run_cmd = ['delete', 'pvc', '--all', '-n', 'default']
309-
kubectl.RunKubectlCommand(run_cmd)
336+
kubectl.RunRetryableKubectlCommand(run_cmd, timeout=timeout)
310337
# There maybe a slight race if resources are cleaned up in the background
311338
# where deleting the cluster immediately prevents the PVCs from being
312339
# deleted.

0 commit comments

Comments
 (0)