Skip to content

Commit

Permalink
Merge pull request #45 from coveooss/fix/DEF-2460-log-out-of-sync-reason
Browse files Browse the repository at this point in the history
Log the out-of-sync issues, so we can fix them
  • Loading branch information
JPLachance authored Jan 31, 2024
2 parents bbf1b19 + aeea872 commit 1de9465
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ You can also test the operator locally in a minikube context.
```bash
# Choose a specific ref and tag if needed
REF=master
TAG=0.7.0
TAG=0.8.1

cat <<EOF > kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/auth-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ spec:
- --verbose
- --liveness=http://0.0.0.0:8080/healthz
- --standalone
image: ghcr.io/coveooss/aws_auth_eks_crd:0.7.0
image: ghcr.io/coveooss/aws_auth_eks_crd:0.8.1
imagePullPolicy: IfNotPresent
name: operator
ports:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ resources:
images:
- name: coveo/aws-auth-operator:0.1
newName: ghcr.io/coveooss/aws_auth_eks_crd
newTag: 0.7.0
newTag: 0.8.1
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aws_auth_eks_crd"
version = "0.8.0"
version = "0.8.1"
description = "Operator to configure the aws-auth config map with IamIdentityMappings"
readme = "README.md"
repository = "https://github.com/coveooss/aws_auth_eks_crd"
Expand Down
11 changes: 10 additions & 1 deletion src/kubernetes_operator/iam_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,17 @@ def check_synchronization() -> bool:
identities_to_ignore = identities_to_ignore + environ.get("IGNORED_CM_IDENTITIES", "").split(",")

identities_in_cm_set = set(identities_in_cm) - set(identities_to_ignore)
identities_in_crd_set = set(identities_in_crd)

if identities_in_cm_set != identities_in_crd_set:
logger.error(
"The aws-auth configmap and the IamIdentityMappings are out of sync.\n"
"The following users are in the aws-auth configmap but not in the IamIdentityMappings: %s\n"
"The following users are in the IamIdentityMappings but not in the aws-auth configmap: %s\n",
list(identities_in_cm_set - identities_in_crd_set),
list(identities_in_crd_set - identities_in_cm_set),
)

if identities_in_cm_set != set(identities_in_crd):
# Raise exception to make the monitoring probe fail
raise RuntimeError("monitoring check result : out-of-sync")

Expand Down

0 comments on commit 1de9465

Please sign in to comment.