-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from starkandwayne/check-port-issues
Check port issues
- Loading branch information
Showing
90 changed files
with
19,035 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package broker | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
brokerapi "github.com/pivotal-cf/brokerapi/domain" | ||
scsccparser "github.com/starkandwayne/spring-cloud-services-cli-config-parser" | ||
) | ||
|
||
func (broker *SCSBroker) CreateServiceInstances(ctx context.Context, instanceID string, details brokerapi.ProvisionDetails, asyncAllowed bool) error { | ||
broker.Logger.Info(fmt.Sprintf("Starting thread for creating service application these details: %s", details)) | ||
|
||
go broker.startInstances(instanceID, details) | ||
|
||
return nil | ||
} | ||
|
||
func (broker *SCSBroker) startInstances(instanceID string, details brokerapi.ProvisionDetails) (string, error) { | ||
var provisioner func(string, string, string, map[string]string) (string, error) | ||
|
||
envsetup := scsccparser.EnvironmentSetup{} | ||
raw := details.RawParameters | ||
if len(raw) == 0 { | ||
raw = []byte("{}") | ||
} | ||
mapparams, err := envsetup.ParseEnvironmentFromRaw(raw) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
switch details.ServiceID { | ||
case "service-registry": | ||
provisioner = broker.createRegistryServerInstance | ||
case "config-server": | ||
provisioner = broker.createConfigServerInstance | ||
|
||
} | ||
|
||
url, err := provisioner(details.ServiceID, instanceID, string(details.RawParameters), mapparams) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return url, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package broker | ||
|
||
import ( | ||
"errors" | ||
|
||
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" | ||
"code.cloudfoundry.org/lager" | ||
cf "github.com/cloudfoundry-community/go-cfclient" | ||
) | ||
|
||
func getProcessStatsByAppAndType(cfClient *ccv3.Client, community *cf.Client, logger lager.Logger, appGUID string, procType string) ([]cf.Stats, error) { | ||
stats := make([]cf.Stats, 0) | ||
|
||
procs, err := getApplicationProcessesByType(cfClient, logger, appGUID, procType) | ||
if err != nil { | ||
return stats, err | ||
} | ||
|
||
for _, proc := range procs { | ||
candidates, err := community.GetProcessStats(proc.GUID) | ||
if err != nil { | ||
continue | ||
} | ||
|
||
for _, stat := range candidates { | ||
stats = append(stats, stat) | ||
} | ||
} | ||
|
||
if len(stats) == 0 { | ||
return stats, errors.New("no stats found") | ||
} | ||
|
||
return stats, nil | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.