Skip to content

Conversation

@mitchnielsen
Copy link
Contributor

Users deploying PrefectWorkPool resources through GitOps workflows were encountering RBAC permission errors because worker pods always used the namespace's default ServiceAccount. This caused pod and job listing failures with "APIForbiddenError: pods is forbidden" messages.

Added an optional serviceAccountName field to the PrefectWorkPoolSpec that allows users to specify a custom ServiceAccount for worker pods. When not specified, the field defaults to empty string, maintaining backward compatibility by using the namespace's default ServiceAccount.

Changes

  • Added serviceAccountName optional field to PrefectWorkPoolSpec
  • Updated controller to apply the ServiceAccount to worker pod deployments
  • Added helper function to handle default behavior when field is not set
  • Generated updated CRDs with the new field
  • Added three test cases covering custom SA, default SA, and empty string scenarios
  • Updated sample manifests with commented example
  • Regenerated CRD documentation

Testing

All 128 unit tests pass, including 3 new tests specifically for ServiceAccount behavior.

Closes #243

Users deploying PrefectWorkPool resources through GitOps workflows were encountering RBAC permission errors because worker pods always used the namespace's default ServiceAccount. This caused pod and job listing failures with "APIForbiddenError: pods is forbidden" messages.

Added an optional `serviceAccountName` field to the PrefectWorkPoolSpec that allows users to specify a custom ServiceAccount for worker pods. When not specified, the field defaults to empty string, maintaining backward compatibility by using the namespace's default ServiceAccount.

Changes:
- Added `serviceAccountName` optional field to PrefectWorkPoolSpec
- Updated controller to apply the ServiceAccount to worker pod deployments
- Added helper function to handle default behavior when field is not set
- Generated updated CRDs with the new field
- Added three test cases covering custom SA, default SA, and empty string scenarios
- Updated sample manifests with commented example
- Regenerated CRD documentation

Closes #243

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request/Question] Ability to configure a custom ServiceAccount for PrefectWorkPool worker pods

1 participant