From 1c488ebc57a8d5a7901c4c4175251dceb9184b2b Mon Sep 17 00:00:00 2001 From: bikalpa Date: Mon, 5 Aug 2024 14:10:53 +0800 Subject: [PATCH] [DPE-5015] Encode keys before keeping them in K8s secrets (#9) --- files/scripts/monitor_sa.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/scripts/monitor_sa.py b/files/scripts/monitor_sa.py index 92c5ab8..1ee436d 100644 --- a/files/scripts/monitor_sa.py +++ b/files/scripts/monitor_sa.py @@ -16,6 +16,7 @@ from spark8t.literals import HUB_LABEL from spark8t.domain import PropertyFile +from spark8t.utils import PercentEncodingSerializer logger = logging.getLogger(__name__) logging.basicConfig( @@ -63,7 +64,10 @@ def read_configuration_file(file_path: str) -> Optional[Dict[str, str]]: logger.info(f"Service account: {sa_name} --- namespace: {namespace}") # skip in case of deletion or operation that do not need secret update. logger.info(f"Config file: {args.config}") - options = read_configuration_file(args.config) + options = { + PercentEncodingSerializer().serialize(key): value + for key, value in read_configuration_file(args.config).items() + } if options: logger.info(f"Number of options: {len(options)}") else: