Skip to content

Commit

Permalink
Merge pull request #278 from kube-tarian/config-sso-update-cluster
Browse files Browse the repository at this point in the history
configure SSO for apps when cluster updated
  • Loading branch information
vramk23 authored Oct 28, 2023
2 parents fe757be + 055da7e commit 9e14f76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions server/pkg/api/configure_app_sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func (s *Server) configureSSOForClusterApps(ctx context.Context, orgId, clusterI
return errors.WithMessagef(err, "failed to register app %s on cluster %s with IAM", app.ReleaseName, clusterID)
}

s.log.Infof("Configuring SSO for app %s, clusterId: %s, [org: %s]",
app.ReleaseName, appClientName, clusterID, orgId)
s.log.Infof("Configuring SSO for app %s, clusterId: %s, [org: %s]", app.ReleaseName, clusterID, orgId)
ssoResp, err := agentClient.GetClient().ConfigureAppSSO(ctx, &agentpb.ConfigureAppSSORequest{
ReleaseName: app.ReleaseName,
ClientId: clientID,
Expand All @@ -38,7 +37,7 @@ func (s *Server) configureSSOForClusterApps(ctx context.Context, orgId, clusterI
})

if err != nil || ssoResp == nil || ssoResp.Status != agentpb.StatusCode_OK {
return fmt.Errorf("failed to configure sso for app %s on cluster %s, err: %v", app.ReleaseName, clusterID, ssoResp)
return fmt.Errorf("failed to configure sso for app %s on cluster %s, err: %v", app.ReleaseName, clusterID, ssoResp.StatusMessage)
}
s.log.Infof("Configure SSO for app %s triggerred, clusterId: %s, [org: %s]",
app.ReleaseName, appClientName, clusterID, orgId)
Expand Down
10 changes: 10 additions & 0 deletions server/pkg/api/update_cluster_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ func (s *Server) UpdateClusterRegistration(ctx context.Context, request *serverp
}, nil
}

if s.cfg.RegisterLaunchAppsConifg {
if err := s.configureSSOForClusterApps(ctx, orgId, request.ClusterID); err != nil {
s.log.Errorf("%v", err)
return &serverpb.UpdateClusterRegistrationResponse{
Status: serverpb.StatusCode_INTERNRAL_ERROR,
StatusMessage: "failed to configure SSO for cluster apps",
}, nil
}
}

s.log.Infof("Update cluster registration request for cluster %s successful, [org: %s]", request.ClusterName, orgId)
return &serverpb.UpdateClusterRegistrationResponse{
Status: serverpb.StatusCode_OK,
Expand Down

0 comments on commit 9e14f76

Please sign in to comment.