fix: scope RBAC permissions and fix hardcoded Helm resource names#522
fix: scope RBAC permissions and fix hardcoded Helm resource names#522
Conversation
|
6a054f8 to
88afd6d
Compare
Things I want to clean up nextWhile working on this PR I went through the whole chart and found a few things might be worth fixing. Keeping this PR focused on RBAC/naming but wanted to write these down so they don't get lost. Template duplication
Also, Modernization
Questions
|
liam-mackie
left a comment
There was a problem hiding this comment.
Commenting rather than approving at the moment as if it's changed, it will break the upgrade process. We'll need to update the C# code (or the upgrade script itself) to get the right auto-upgrader service account. This is likely a change that we should include in v3 to enforce compatibility with a server version that includes the changes we'd need to get that account.
I think the easiest way forward is to remove the auto-upgrade changes specifically in this PR and introduce separately in a v3-compatible change.
| */}} | ||
| {{- define "kubernetes-agent.autoUpgraderServiceAccountName" -}} | ||
| {{- print "octopus-agent-auto-upgrader" }} | ||
| {{- .Values.autoUpgrader.serviceAccount.name | default (printf "%s-auto-upgrader" (include "kubernetes-agent.name" .) | trunc 63 | trimSuffix "-") }} |
There was a problem hiding this comment.
There was a problem hiding this comment.
Good catch! Reverted the auto-upgrader service account name change - it's back to the hardcoded octopus-agent-auto-upgrader. We can make it dynamic in a v3-compatible change once the server-side code is updated :)
Kept the RBAC rule override support for auto-upgrader roles/clusterroles since those don't change any default behavior - they just add the ability to override rules.
- Replace apiGroups wildcards with specific groups for core resources - Fix scriptPodDeleter ClusterRole using apiGroups * instead of core group - Fix hardcoded service account and PDB names to use release-based naming - Add override mechanisms for RBAC rules across all roles - Add validation for override rule inputs - Update tests and snapshots
Co-authored with pre-existing pattern from scriptPods overrides. selfNamespaceRoleRules and targetNamespaceRoleRules now default to [] in values.yaml like all other overrides, removing dead template code. Also align doc comments across all override values.
The Octopus Server C# code hardcodes "octopus-agent-auto-upgrader" as the service account name. Making it dynamic would break existing upgrades until the server-side code is updated. Deferring to a v3-compatible change. Keeps the RBAC rule override support for auto-upgrader roles/clusterroles.
88afd6d to
b2fea3c
Compare
liam-mackie
left a comment
There was a problem hiding this comment.
These changes look good to me! I'd like to get @APErebus to take a look at some point soon, since I think he had opinions on how we configured the role rules in the values.yaml - especially around how we set defaults.
No description provided.