From 5af966e1f58f66cbb3bb9215a69b86b5f237c269 Mon Sep 17 00:00:00 2001 From: Francis Mireault Date: Mon, 5 Jun 2023 14:18:08 -0400 Subject: [PATCH] Support no group --- src/kubernetes_operator/iam_mapping.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kubernetes_operator/iam_mapping.py b/src/kubernetes_operator/iam_mapping.py index ccddc68..c0e96ef 100644 --- a/src/kubernetes_operator/iam_mapping.py +++ b/src/kubernetes_operator/iam_mapping.py @@ -58,7 +58,7 @@ async def create_mapping(spec: dict, diff: list, **_) -> None: configmap = API.read_namespaced_config_map("aws-auth", "kube-system") arn_field = spec["userarn"] if spec.get("userarn") else spec["rolearn"] - logger.info("Mapping for user %s as %s to %s", arn_field, spec["username"], spec["groups"]) + logger.info("Mapping for user %s as %s to %s", arn_field, spec["username"], spec.get("groups", "(no group)")) identities = get_cm_identity_mappings(configmap) updated_mapping = ensure_identity(sanitize_spec, identities) @@ -74,7 +74,7 @@ async def delete_mapping(spec: dict, **_) -> None: configmap = API.read_namespaced_config_map("aws-auth", "kube-system") arn_field = spec["userarn"] if spec.get("userarn") else spec["rolearn"] - logger.info("Delete mapping for user %s as %s to %s", arn_field, spec["username"], spec["groups"]) + logger.info("Delete mapping for user %s as %s to %s", arn_field, spec["username"], spec.get("groups", "(no group)")) identity_mappings = get_cm_identity_mappings(configmap) updated_mappings = delete_identity(spec, identity_mappings)