-
Notifications
You must be signed in to change notification settings - Fork 166
updateconfig: Add ACL support for ConfigMap updates #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
updateconfig: Add ACL support for ConfigMap updates #577
Conversation
This enhancement adds Access Control List (ACL) functionality to the
updateconfig plugin, allowing administrators to control which organizations
and repositories can trigger ConfigMap updates.
## New Features
- **AllowedRepos**: A list of org or org/repo entries that are permitted to
update a configmap. If specified, only PRs from these sources will trigger
updates. When empty, all repos are allowed (unless explicitly denied).
- **DeniedRepos**: A list of org or org/repo entries that are blocked from
updating a configmap. Deny rules take precedence over allow rules.
## Configuration Format
Entries can be specified in two formats:
- Org-level: "kubernetes" (matches all repos in the kubernetes org)
- Repo-level: "kubernetes/test-infra" (matches only this specific repo)
Example configuration:
```yaml
config_updater:
maps:
prow/config.yaml:
name: config
allowed_repos:
- kubernetes # Allow entire org
- istio/istio # Allow specific repo
denied_repos:
- kubernetes/fork # Block specific repo within allowed org
```
## ACL Precedence Rules
1. If repo is in denied list (exact match) → denied
2. If org is in denied list → denied
3. If allow lists exist, repo must match an allowed entry
4. If no allow lists specified → allowed (unless denied above)
## Implementation Details
- Added `AllowedRepos` and `DeniedRepos` fields to `ConfigMapSpec`
- Added `IsAllowed(repo string) bool` method to `ConfigMapSpec`
- Updated `FilterChanges` to accept `repo` parameter and filter updates
- Updated `config-bootstrapper` to pass empty repo (bypasses ACL checks)
- Uses `config.SplitRepoName` for org/repo parsing
## Testing
- Added `TestConfigMapSpecIsAllowed` with 14 test cases covering:
- No ACLs configured
- Org-level and repo-level allow/deny entries
- Mixed org and org/repo entries
- Deny precedence over allow
- Empty repo handling for config-bootstrapper
- Added `TestFilterChangesWithACLs` with 7 test cases covering:
- End-to-end filtering with various ACL configurations
- Multiple configmaps with different ACLs
✅ Deploy Preview for k8s-prow ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hi @midnightconman. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: midnightconman The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
e8fe35d to
63cbfe6
Compare
|
I would like this not to be a breaking change, so I would like to see a passing test, when the |
|
@Prucek Sounds good to me 👍 Can you add |
|
/ok-to-test |
This enhancement adds Access Control List (ACL) functionality to the updateconfig plugin, allowing administrators to control which organizations and repositories can trigger ConfigMap updates.
New Features
AllowedRepos: A list of org or org/repo entries that are permitted to update a configmap. If specified, only PRs from these sources will trigger updates. When empty, all repos are allowed (unless explicitly denied).
DeniedRepos: A list of org or org/repo entries that are blocked from updating a configmap. Deny rules take precedence over allow rules.
Configuration Format
Entries can be specified in two formats:
Example configuration:
ACL Precedence Rules
Implementation Details
AllowedReposandDeniedReposfields toConfigMapSpecIsAllowed(repo string) boolmethod toConfigMapSpecFilterChangesto acceptrepoparameter and filter updatesconfig-bootstrapperto pass empty repo (bypasses ACL checks)config.SplitRepoNamefor org/repo parsingTesting
Added
TestConfigMapSpecIsAllowedwith 14 test cases covering:Added
TestFilterChangesWithACLswith 7 test cases covering: