@@ -328,7 +328,7 @@ func (r *MCPServerReconciler) updateRBACResourceIfNeeded(
328
328
329
329
// ensureRBACResources ensures that the RBAC resources are in place for the MCP server
330
330
func (r * MCPServerReconciler ) ensureRBACResources (ctx context.Context , mcpServer * mcpv1alpha1.MCPServer ) error {
331
- proxyRunnerNameForRBAC := fmt . Sprintf ( "%s-proxy-runner" , mcpServer .Name )
331
+ proxyRunnerNameForRBAC := proxyRunnerServiceAccountName ( mcpServer .Name )
332
332
333
333
// Ensure Role
334
334
if err := r .ensureRBACResource (ctx , mcpServer , "Role" , func () client.Object {
@@ -552,7 +552,7 @@ func (r *MCPServerReconciler) deploymentForMCPServer(m *mcpv1alpha1.MCPServer) *
552
552
Labels : ls , // Keep original labels for pod template
553
553
},
554
554
Spec : corev1.PodSpec {
555
- ServiceAccountName : fmt . Sprintf ( "%s-proxy-runner" , m .Name ),
555
+ ServiceAccountName : proxyRunnerServiceAccountName ( m .Name ),
556
556
Containers : []corev1.Container {{
557
557
Image : getToolhiveRunnerImage (),
558
558
Name : "toolhive" ,
@@ -895,7 +895,8 @@ func deploymentNeedsUpdate(deployment *appsv1.Deployment, mcpServer *mcpv1alpha1
895
895
}
896
896
897
897
// Check if the service account name has changed
898
- if deployment .Spec .Template .Spec .ServiceAccountName != "toolhive" {
898
+ expectedServiceAccountName := proxyRunnerServiceAccountName (mcpServer .Name )
899
+ if deployment .Spec .Template .Spec .ServiceAccountName != expectedServiceAccountName {
899
900
return true
900
901
}
901
902
@@ -978,6 +979,11 @@ func resourceRequirementsForMCPServer(m *mcpv1alpha1.MCPServer) corev1.ResourceR
978
979
return resources
979
980
}
980
981
982
+ // proxyRunnerServiceAccountName returns the service account name for the proxy runner
983
+ func proxyRunnerServiceAccountName (mcpServerName string ) string {
984
+ return fmt .Sprintf ("%s-proxy-runner" , mcpServerName )
985
+ }
986
+
981
987
// labelsForMCPServer returns the labels for selecting the resources
982
988
// belonging to the given MCPServer CR name.
983
989
func labelsForMCPServer (name string ) map [string ]string {
0 commit comments