Skip to content

Conversation

@memalhot
Copy link
Contributor

@memalhot memalhot commented Oct 2, 2025

No description provided.

Copy link
Collaborator

@DanNiESh DanNiESh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script worked well! Just one small comment in the cronjob.

args:
- |
# get everyone in current grouping
group_users=($(oc get groups --as system:admin $GROUP_NAME -o jsonpath='{.users[*]}'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you don't need to run --as system:admin here since the cronjob service account already has get/list/update/patch roles to groups. I've tested it without as system:admin and it worked.

# get everyone who has edit permissions on a workbench
curr_users=()

namespaces=($(oc get ns --as system:admin -o jsonpath='{.items[*].metadata.name}' | tr ' ' '\n' | grep "^${CLASS_NAME}-"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for getting namespace

echo " "

if [ ${#users_to_add[@]} -gt 0 ]; then
oc adm groups add-users --as system:admin "$GROUP_NAME" "${users_to_add[@]}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

fi

if [ ${#users_to_remove[@]} -gt 0 ]; then
oc adm groups remove-users --as system:admin "$GROUP_NAME" "${users_to_remove[@]}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@DanNiESh DanNiESh merged commit 4a8239d into OCP-on-NERC:main Oct 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants