Skip to content
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

fix(api-server)!: when normalizing roles, make wildcard verb for stages include promote #2877

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

krancour
Copy link
Member

@krancour krancour commented Oct 30, 2024

Related to #2864

When creating/updating "Kargo Roles," which are an abstraction over a ServiceAccount/Role/RoleBinding trio, policy rules are normalized when read from or written to the underlying Role. Among other things, this normalization includes expansion of the verb * to create, delete, deletecollection, get, list, patch, update, watch.

Stages have an additional, custom promote verb that is unaccounted for.

The result is that when, the * verb is used in defining policy rules involving non-Stage resource types, the * correctly expands to all the verbs supported by those resource types, but when using the * verb in defining policy rules involving the Stage resource type, the expanded verbs lack the important custom promote verb.

This PR special cases expansion of the * verb when the resource type in the policy rule is stages, but only does so for verbs that are being added/removed. When normalizing existing rules, whether simply for retrieval/display or in preparation to be modified, expansion of * does not include the custom promote verb because Kubernetes itself does not interpret a * verb in a Role's policy rules as including any custom verbs.

This is breaking only insofar as it expands the meaning of * in relation to creating/updating "Kargo Roles" going forward. This has no effect on anything existing.

Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Copy link

netlify bot commented Oct 30, 2024

Deploy Preview for docs-kargo-io canceled.

Name Link
🔨 Latest commit fcc0075
🔍 Latest deploy log https://app.netlify.com/sites/docs-kargo-io/deploys/67225412e050d1000836d8a7

@krancour krancour changed the title fix: when normalizing roles, make wildcard verb for stages include promote fix!(api-server): when normalizing roles, make wildcard verb for stages include promote Oct 30, 2024
@krancour krancour changed the title fix!(api-server): when normalizing roles, make wildcard verb for stages include promote fix(api-server)!: when normalizing roles, make wildcard verb for stages include promote Oct 30, 2024
@krancour krancour added this pull request to the merge queue Oct 30, 2024
Merged via the queue into akuity:main with commit 78b9b29 Oct 30, 2024
29 checks passed
@krancour krancour deleted the krancour/stage-splat branch October 30, 2024 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants