fix: replace autodelete ClusterRoleBinding+default SA with scoped RoleBinding#406
Open
mgrzybek wants to merge 6 commits into
Open
fix: replace autodelete ClusterRoleBinding+default SA with scoped RoleBinding#406mgrzybek wants to merge 6 commits into
mgrzybek wants to merge 6 commits into
Conversation
…eBinding The autodelete CronJob was created without a dedicated ServiceAccount, falling back to `default`. The operator then bound `default` to the cluster-wide `azimuth-caas-operator:edit` ClusterRole, which granted every workload sharing that ServiceAccount in the namespace the ability to manage CaaS resources. Changes in create_scheduled_delete_job: - Create a dedicated ServiceAccount `autodelete-<cluster>` in the tenant namespace with an ownerReference on the Cluster object so it is garbage-collected automatically on cluster deletion. - Replace the ClusterRoleBinding (cluster-scoped, `default` SA) with a namespaced RoleBinding targeting the new SA. A RoleBinding that references a ClusterRole scopes its permissions to the namespace. - Inject serviceAccountName into the CronJob pod spec. - Add pod-level securityContext (runAsNonRoot, runAsUser 65534, seccompProfile RuntimeDefault) and container-level securityContext (allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, capabilities.drop ALL). - Reorder resource creation: ConfigMap → ServiceAccount → RoleBinding → CronJob, so the CronJob always starts with its identity and permissions in place.
Signed-off-by: Mathieu Grzybek <mathieu@stackhpc.com>
Signed-off-by: Mathieu Grzybek <mathieu@stackhpc.com>
irt-shpc
previously approved these changes
Jun 29, 2026
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.
The autodelete CronJob was created without a dedicated ServiceAccount, falling back to
default. The operator then bounddefaultto the cluster-wideazimuth-caas-operator:editClusterRole, which granted every workload sharing that ServiceAccount in the namespace the ability to manage CaaS resources.Changes in create_scheduled_delete_job:
autodelete-<cluster>in the tenant namespace with an ownerReference on the Cluster object so it is garbage-collected automatically on cluster deletion.defaultSA) with a namespaced RoleBinding targeting the new SA. A RoleBinding that references a ClusterRole scopes its permissions to the namespace.