diff --git a/keep/secretmanager/kubernetessecretmanager.py b/keep/secretmanager/kubernetessecretmanager.py index 90bf30830..88e31047f 100644 --- a/keep/secretmanager/kubernetessecretmanager.py +++ b/keep/secretmanager/kubernetessecretmanager.py @@ -4,7 +4,7 @@ import kubernetes.client import kubernetes.config -from kubernetes.client.rest import ApiException +from kubernetes.client.exceptions import ApiException from keep.secretmanager.secretmanager import BaseSecretManager @@ -32,7 +32,7 @@ def write_secret(self, secret_name: str, secret_value: str) -> None: ApiException: If an error occurs while writing the secret. """ # k8s requirements: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - secret_name = secret_name.replace("_", "-") + secret_name = secret_name.replace("_", "-").lower() self.logger.info("Writing secret", extra={"secret_name": secret_name}) body = kubernetes.client.V1Secret( @@ -70,7 +70,7 @@ def write_secret(self, secret_name: str, secret_value: str) -> None: def read_secret(self, secret_name: str, is_json: bool = False) -> str | dict: # k8s requirements: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - secret_name = secret_name.replace("_", "-") + secret_name = secret_name.replace("_", "-").lower() self.logger.info("Getting secret", extra={"secret_name": secret_name}) try: response = self.api.read_namespaced_secret( @@ -91,6 +91,7 @@ def read_secret(self, secret_name: str, is_json: bool = False) -> str | dict: raise def delete_secret(self, secret_name: str) -> None: + secret_name = secret_name.replace("_", "-").lower() self.logger.info("Deleting secret", extra={"secret_name": secret_name}) try: self.api.delete_namespaced_secret( diff --git a/pyproject.toml b/pyproject.toml index 8fc497f7d..413d0e05f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "keep" -version = "0.32.1" +version = "0.32.2" description = "Alerting. for developers, by developers." authors = ["Keep Alerting LTD"] packages = [{include = "keep"}]