hunk.code_window: 		SetupUserServiceAccount(userID int, teamIDs []int, restrictDefaultNamespace bool) error
   		GetServiceAccount(tokendata *TokenData) (*v1.ServiceAccount, error)
   		GetServiceAccountBearerToken(userID int) (string, error)
   		CreateUserShellPod(ctx context.Context, serviceAccountName string) (*KubernetesShellPod, error)
   		StartExecProcess(token string, useAdminToken bool, namespace, podName, containerName string, command []string, stdin io.Reader, stdout io.Writer) error
   		NamespaceAccessPoliciesDeleteNamespace(namespace string) error
   		GetNodesLimits() (K8sNodesLimits, error)
   		GetNamespaceAccessPolicies() (map[string]K8sNamespaceAccessPolicy, error)
   		UpdateNamespaceAccessPolicies(accessPolicies map[string]K8sNamespaceAccessPolicy) error
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.after_edit: 		StartExecProcess(token string, useAdminToken bool, namespace, podName, containerName string, command []string, stdin io.Reader, stdout io.Writer, errChan chan error)
  
hunk.file_path: api/portainer.go
hunk.type: replace
file: package endpointgroups
  
  import (
  	portainer "github.com/portainer/portainer/api"
  	"github.com/portainer/portainer/api/internal/edge"
  )
  
  func (handler *Handler) updateEndpointRelations(endpoint *portainer.Endpoint, endpointGroup *portainer.EndpointGroup) error {
  	if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment {
  		return nil
  	}
  
  	if endpointGroup == nil {
  		unassignedGroup, err := handler.DataStore.EndpointGroup().EndpointGroup(portainer.EndpointGroupID(1))
  		if err != nil {
  			return err
  		}
  
  		endpointGroup = unassignedGroup
  	}
  
  	endpointRelation, err := handler.DataStore.EndpointRelation().EndpointRelation(endpoint.ID)
  	if err != nil {
  		return err
  	}
  
  	edgeGroups, err := handler.DataStore.EdgeGroup().EdgeGroups()
  	if err != nil {
  		return err
  	}
  
  	edgeStacks, err := handler.DataStore.EdgeStack().EdgeStacks()
  	if err != nil {
  		return err
  	}
  
  	endpointStacks := edge.EndpointRelatedEdgeStacks(endpoint, endpointGroup, edgeGroups, edgeStacks)
  	stacksSet := map[portainer.EdgeStackID]bool{}
  	for _, edgeStackID := range endpointStacks {
  		stacksSet[edgeStackID] = true
  	}
  	endpointRelation.EdgeStacks = stacksSet
  
  	return handler.DataStore.EndpointRelation().UpdateEndpointRelation(endpoint.ID, endpointRelation)
  }
  