diff --git a/README.md b/README.md index 63cdd3d..82548fe 100644 --- a/README.md +++ b/README.md @@ -466,11 +466,11 @@ issues are observed in the logs. `--max-retries-on-conflict` -: Optional: Specifies the maximum number of retries KubeDownscaler should perform +: Optional: Specifies the maximum number of retries KubeDownscaler should perform when encountering a conflict error (HTTP 409). These errors occur when one of the resources, just before being processed by Kube Downscaler, is modified by another entity, such as an HPA, CI/CD pipeline, or manual intervention. If enabled, Kube Downscaler will -retry the update immediately, without waiting for the next iteration (default: 0). This +retry the update immediately, without waiting for the next iteration (default: 0). This argument is strongly recommended when using the `--once` argument to process large clusters diff --git a/kube_downscaler/scaler.py b/kube_downscaler/scaler.py index 35e7c82..883606b 100644 --- a/kube_downscaler/scaler.py +++ b/kube_downscaler/scaler.py @@ -15,7 +15,6 @@ from pykube import CronJob from pykube import CustomResourceDefinition from pykube import DaemonSet -from pykube import HTTPClient from pykube import Deployment from pykube import HorizontalPodAutoscaler from pykube import HTTPClient @@ -312,6 +311,7 @@ def get_resources(kind, api, namespaces: FrozenSet[str], excluded_namespaces): def get_resource(kind, api, namespace, resource_name: str): + try: resource = kind.objects(api).filter(namespace=namespace).get_or_none(name=resource_name) if resource is None: logger.debug(f"{kind.endpoint} {namespace}/{resource_name} not found")