[CLOUDP-339048] Fix a bug in regenerate_public_rbac_multi_cluster#670
Merged
viveksinghggits merged 2 commits intomasterfrom Jan 9, 2026
Merged
[CLOUDP-339048] Fix a bug in regenerate_public_rbac_multi_cluster#670viveksinghggits merged 2 commits intomasterfrom
regenerate_public_rbac_multi_cluster#670viveksinghggits merged 2 commits intomasterfrom
Conversation
regenerate_public_rbac_multi_clusterregenerate_public_rbac_multi_cluster
MCK 1.6.2 Release NotesBug Fixes
|
anandsyncs
approved these changes
Jan 7, 2026
nammn
approved these changes
Jan 7, 2026
6633ccd to
683064f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the buggy check that we had to generate multi-cluster. The statement
if echo "${git_last_changed}" | grep -q -e 'cmd/kubectl-mongodb' -e 'pkg/kubectl-mongodb'; thenwas failing sometimes because of root cause mentioned below. But even if we apply the fix we didn't achieve a lot time wise, that's why as a solution we are removing the check and alway generating the RBAC.Root cause
The function
regenerate_public_rbac_multi_clusterfromgenerate_files.shwas trying to list all the files from the git repo using the commandand then it was trying to check if the kubectl plugin related files are in the listed files. And if that was the cases we re-generated the RBAC for multi-cluster.
But this has a small problem, since we are running
git ls-treethe output of the command can become quite big at times, and because of that when we runecho "${git_last_changed}"and then usegrep -q, we some times get unexpected result, i.e., even though the filescmd/kubectl-mongodband/orpkg/kubectl-mongodbwere present in the output ofecho "${git_last_changed}", the output of the lineecho 'regenerating multicluster RBAC public example'was not printed which resulted into the RBACs not getting generated.The
ifstatement behaved mysteriously because, if the size ofgit_last_changedis big, and the grep statement is satisfied, because of-qthe grep statement will return and the pipe|will be closed but the echo is not done yet because of the size ofgit_last_changedand because of that it (echo ${git_last_changed}) will try to put more data to the pipe which will result into an error because the pipe is closed. This will result intoifstatement misbehaving.https://biriukov.dev/docs/fd-pipe-session-terminal/2-pipes/#sigpipe-signal
To fix that we are not using
-qanymore so that the pipe is not closed andSIGPIPEis not sent toecho, which would result into everything working fine.Proof of Work
Manual test.
Checklist
skip-changeloglabel if not needed