Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
INTLY-2663 add user level sso
Browse files Browse the repository at this point in the history
verification:
- have an existing integreatly cluster on openshift 3
- in the msbroker namespace
  - replace the image in the managed service broker with
    docker.io/aidenkeatingrht/managed-service-broker:INTLY-2663
  - wait for the deploy to finish
- ensure, after a few minutes, the rhsso-user service is available
  • Loading branch information
Aiden Keating committed Aug 2, 2019
1 parent 856ddb6 commit 284ff3f
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 13 deletions.
10 changes: 8 additions & 2 deletions cmd/broker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const (
apicurioServiceName = "apicurio"
fuseManagedServiceName = "fuse-managed"
rhssoServiceName = "rhsso"
userRHSSOServiceName = "user-rhsso"
)

func runWithContext(ctx context.Context) error {
Expand Down Expand Up @@ -120,7 +121,10 @@ func runWithContext(ctx context.Context) error {
deployers = append(deployers, fuse_managed.NewDeployer())
}
if shouldRegisterService(rhssoServiceName) {
deployers = append(deployers, sso.NewDeployer())
deployers = append(deployers, sso.NewClusterDeployer())
}
if shouldRegisterService(userRHSSOServiceName) {
deployers = append(deployers, sso.NewUserDeployer())
}
ctrlr := controller.CreateController(deployers)

Expand Down Expand Up @@ -163,7 +167,9 @@ func shouldRegisterService(serviceName string) bool {
case fuseManagedServiceName:
return os.Getenv("SHARED_FUSE_DASHBOARD_URL") != ""
case rhssoServiceName:
return os.Getenv("SSO_URL") != ""
return os.Getenv(sso.DefaultManagedURLEnv) != ""
case userRHSSOServiceName:
return os.Getenv(sso.DefaultUserURLEnv) != ""
}
return false
}
36 changes: 27 additions & 9 deletions pkg/deploys/sso/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,39 @@ import (
glog "github.com/sirupsen/logrus"
)

type RHSSOManagedDeployer struct{}
const (
DefaultManagedURLEnv = "SSO_URL"
DefaultUserURLEnv = "USER_SSO_URL"
)

type RHSSODeployer struct {
URLEnv string
CatalogServiceObjGetter func() []*brokerapi.Service
}

func NewClusterDeployer() *RHSSODeployer {
return &RHSSODeployer{
URLEnv: DefaultManagedURLEnv,
CatalogServiceObjGetter: getManagedCatalogServicesObj,
}
}

func NewDeployer() *RHSSOManagedDeployer {
return &RHSSOManagedDeployer{}
func NewUserDeployer() *RHSSODeployer {
return &RHSSODeployer{
URLEnv: DefaultUserURLEnv,
CatalogServiceObjGetter: getUserCatalogServicesObj,
}
}

func (fd *RHSSOManagedDeployer) GetCatalogEntries() []*brokerapi.Service {
func (d *RHSSODeployer) GetCatalogEntries() []*brokerapi.Service {
glog.Infof("Getting RH-SSO managed catalog entries")
return getCatalogServicesObj()
return d.CatalogServiceObjGetter()
}

func (fd *RHSSOManagedDeployer) Deploy(req *brokerapi.ProvisionRequest, async bool) (*brokerapi.ProvisionResponse, error) {
func (d *RHSSODeployer) Deploy(req *brokerapi.ProvisionRequest, async bool) (*brokerapi.ProvisionResponse, error) {
glog.Infof("Deploying RH-SSO from deployer, id: %s", req.InstanceId)

dashboardUrl := os.Getenv("SSO_URL")
dashboardUrl := os.Getenv(d.URLEnv)

return &brokerapi.ProvisionResponse{
Code: http.StatusAccepted,
Expand All @@ -31,11 +49,11 @@ func (fd *RHSSOManagedDeployer) Deploy(req *brokerapi.ProvisionRequest, async bo
}, nil
}

func (fd *RHSSOManagedDeployer) RemoveDeploy(req *brokerapi.DeprovisionRequest, async bool) (*brokerapi.DeprovisionResponse, error) {
func (d *RHSSODeployer) RemoveDeploy(req *brokerapi.DeprovisionRequest, async bool) (*brokerapi.DeprovisionResponse, error) {
return &brokerapi.DeprovisionResponse{Operation: "remove"}, nil
}

func (fd *RHSSOManagedDeployer) ServiceInstanceLastOperation(req *brokerapi.LastOperationRequest) (*brokerapi.LastOperationResponse, error) {
func (d *RHSSODeployer) ServiceInstanceLastOperation(req *brokerapi.LastOperationRequest) (*brokerapi.LastOperationResponse, error) {
glog.Infof("Getting last operation for %s", req.InstanceId)

return &brokerapi.LastOperationResponse{
Expand Down
30 changes: 28 additions & 2 deletions pkg/deploys/sso/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import (
brokerapi "github.com/integr8ly/managed-service-broker/pkg/broker"
)

// sso managed plan
func getCatalogServicesObj() []*brokerapi.Service {
func getManagedCatalogServicesObj() []*brokerapi.Service {
return []*brokerapi.Service{
{
Name: "rhsso",
Expand All @@ -31,3 +30,30 @@ func getCatalogServicesObj() []*brokerapi.Service {
},
}
}

func getUserCatalogServicesObj() []*brokerapi.Service {
return []*brokerapi.Service{
{
Name: "user-rhsso",
ID: "user-rhsso-service-id",
Description: "User RH-SSO",
Metadata: map[string]string{"serviceName": "user-rhsso", "serviceType": "rhsso"},
Plans: []brokerapi.ServicePlan{
{
Name: "default-user-rhsso",
ID: "default-user-rhsso",
Description: "default user rhsso plan",
Free: true,
Schemas: &brokerapi.Schemas{
ServiceBinding: &brokerapi.ServiceBindingSchema{
Create: &brokerapi.RequestResponseSchema{},
},
ServiceInstance: &brokerapi.ServiceInstanceSchema{
Create: &brokerapi.InputParametersSchema{},
},
},
},
},
},
}
}

0 comments on commit 284ff3f

Please sign in to comment.