Skip to content

Commit d0602f3

Browse files
authored
Merge pull request #21 from cloudfoundry/develop
Develop
2 parents 062b61b + 27b7c9b commit d0602f3

File tree

6 files changed

+12128
-21862
lines changed

6 files changed

+12128
-21862
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@
77
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/cloudfoundry/stratos/blob/master/LICENSE)
88
[![slack.cloudfoundry.org](https://slack.cloudfoundry.org/badge.svg)](https://cloudfoundry.slack.com/messages/C80EP4Y57/)
99

10+
# Roadmap
11+
12+
1. Upgrade Stratos Frontend to Angular >= v17 LTS (currently in progress)
13+
1. Convert GoLang backend (Jetstream) to use Cloud Foundry V3 API and remove Vi2 API calls
14+
1. Convert Frontend to call either Jetstream API or V3 API directly. V3 API calls can require more roundtrips than the V2 APIs they replace.
15+
1. Upgrade Stratos Frontend to Angular v18-v20 Active/LTS (v17 EOL is 2025-05-15)
16+
17+
1018
(Please note: The official repository is at cloudfoundry/stratos and the cloudfoundry-community/stratos will track this but may be used for some testing purposes)
1119

20+
# About
21+
1222
Stratos is an Open Source Web-based UI (Console) for managing Cloud Foundry. It allows users and administrators to both manage applications running in the Cloud Foundry cluster and perform cluster management tasks.
1323

1424
![Stratos Application view](website/static/images/screenshots/app-summary.png)
@@ -17,7 +27,7 @@ Please visit our new [documentation site](https://stratos.app/). There you can d
1727

1828
1. Our [introduction](https://stratos.app/docs/), including quick start, contributing and troubleshooting guides.
1929
1. How to [deploy](https://stratos.app/docs/deploy/overview) Stratos in a number of environments.
20-
1. [Cloud Foundry](https://stratos.app/docs/deploy/cloud-foundry/cloud-foundry), as an application.
30+
1. [Cloud Foundry](https://stratos.app/docs/deploy/cloud-foundry/cloud-foundry), as an application. (Recommended)
2131
1. [Kubernetes](https://stratos.app/docs/deploy/kubernetes), using a Helm chart.
2232
1. [Docker](https://stratos.app/docs/deploy/all-in-one), as a single container deploying all components.
2333
1. Configuring advanced features such a [Single Sign On](https://stratos.app/docs/advanced/sso) and Cloud Foundry '[invite to org](https://stratos.app/docs/advanced/invite-user-guide)'.

src/jetstream/api/structs.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ type AuthProvider struct {
2323
UserInfo GetUserInfoFromToken
2424
}
2525

26+
type ApiRoot struct {
27+
Links struct {
28+
LogCache struct {
29+
Href string `json:"href"`
30+
} `json:"log_cache"`
31+
} `json:"links"`
32+
}
33+
2634
// V2Info is the response for the Cloud Foundry /v2/info API
2735
type V2Info struct {
2836
AuthorizationEndpoint string `json:"authorization_endpoint"`
@@ -37,6 +45,11 @@ type V2Info struct {
3745
MinRecommendedCLIVersion string `json:"min_recommended_cli_version"`
3846
}
3947

48+
type EndpointInfo struct {
49+
ApiRoot ApiRoot
50+
V2Info V2Info
51+
}
52+
4053
type InfoFunc func(apiEndpoint string, skipSSLValidation bool, caCert string) (CNSIRecord, interface{}, error)
4154

4255
// TODO this could be moved back to cnsis subpackage, and extensions could import it?

src/jetstream/plugins/cfapppush/info.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ func (c *CFPushApp) setEndpointInfo(config *configv3.Config) error {
2626
return err
2727
}
2828

29-
if info, ok := endpointInfo.(api.V2Info); ok {
29+
if info, ok := endpointInfo.(api.EndpointInfo); ok {
3030
// Got the info we need - update the config with it
3131
config.SetTargetInformation(
3232
configv3.TargetInformationArgs{
3333
Api: apiEndpoint,
34-
ApiVersion: info.APIVersion,
35-
Auth: info.AuthorizationEndpoint,
36-
MinCLIVersion: info.MinCLIVersion,
37-
Doppler: info.DopplerLoggingEndpoint,
38-
Routing: info.RoutingEndpoint,
34+
ApiVersion: info.V2Info.APIVersion,
35+
Auth: info.V2Info.AuthorizationEndpoint,
36+
MinCLIVersion: info.V2Info.MinCLIVersion,
37+
Doppler: info.V2Info.DopplerLoggingEndpoint,
38+
LogCache: info.ApiRoot.Links.LogCache.Href,
39+
Routing: info.V2Info.RoutingEndpoint,
3940
SkipSSLValidation: skipSSLValidation,
4041
},
4142
)

src/jetstream/plugins/cfapppush/pushapp.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ import (
1212

1313
"code.cloudfoundry.org/cli/actor/sharedaction"
1414
"code.cloudfoundry.org/cli/actor/v7action"
15+
"code.cloudfoundry.org/cli/actor/v7pushaction"
1516
"code.cloudfoundry.org/cli/api/cloudcontroller/ccversion"
1617
"code.cloudfoundry.org/cli/cf/commandregistry"
1718
"code.cloudfoundry.org/cli/command"
1819
"code.cloudfoundry.org/clock"
1920

2021
"code.cloudfoundry.org/cli/util/configv3"
22+
"code.cloudfoundry.org/cli/util/manifestparser"
2123
"code.cloudfoundry.org/cli/util/progressbar"
2224
"code.cloudfoundry.org/cli/util/ui"
2325
"github.com/gorilla/websocket"
@@ -223,6 +225,8 @@ func (c *CFPushApp) Init(appDir string, manifestPath string, overrides CFPushApp
223225

224226
// Manifest path
225227
c.pushCommand.PathToManifest = flag.ManifestPathWithExistenceCheck(manifestPath)
228+
c.pushCommand.ManifestLocator = manifestparser.NewLocator()
229+
c.pushCommand.ManifestParser = manifestparser.ManifestParser{}
226230

227231
return nil
228232
}
@@ -231,6 +235,8 @@ func (c *CFPushApp) Init(appDir string, manifestPath string, overrides CFPushApp
231235
func (c *CFPushApp) setConfig(config *configv3.Config) error {
232236
config.SetOrganizationInformation(c.config.OrgGUID, c.config.OrgName)
233237
config.SetSpaceInformation(c.config.SpaceGUID, c.config.SpaceName, false)
238+
c.pushCommand.VersionActor = c.pushCommand.Actor
239+
c.pushCommand.PushActor = v7pushaction.NewActor(c.pushCommand.Actor, sharedaction.NewActor(config))
234240
return nil
235241
}
236242

@@ -263,7 +269,11 @@ func (c *CFPushApp) Run(msgSender DeployAppMessageSender, clientWebsocket *webso
263269
defer commandUI.FlushDeferred()
264270

265271
err = c.setup(config, commandUI, msgSender, clientWebsocket)
266-
// err = c.pushCommand.Setup(config, commandUI)
272+
if err != nil {
273+
return handleError(err, *commandUI)
274+
}
275+
276+
err = c.pushCommand.Setup(config, commandUI)
267277
if err != nil {
268278
return handleError(err, *commandUI)
269279
}
@@ -276,6 +286,7 @@ func (c *CFPushApp) Run(msgSender DeployAppMessageSender, clientWebsocket *webso
276286

277287
// Set to a null progress bar
278288
c.pushCommand.ProgressBar = &cfPushProgressBar{}
289+
c.pushCommand.DiffDisplayer = shared.NewManifestDiffDisplayer(commandUI)
279290

280291
// Perform the push
281292
args := make([]string, 0)
@@ -294,7 +305,7 @@ func (c *CFPushApp) setup(config command.Config, ui command.UI, msgSender Deploy
294305
sharedActor := sharedaction.NewActor(config)
295306
cmd.SharedActor = sharedActor
296307

297-
ccClient, uaaClient, routingClient, err := shared.GetNewClientsAndConnectToCF(config, ui, ccversion.MinSupportedClientVersionV8)
308+
ccClient, uaaClient, routingClient, err := shared.GetNewClientsAndConnectToCF(config, ui, ccversion.MinSupportedV2ClientVersion)
298309
if err != nil {
299310
return err
300311
}
@@ -313,6 +324,7 @@ func (c *CFPushApp) setup(config command.Config, ui command.UI, msgSender Deploy
313324
return err
314325
}
315326

327+
ccClientV3.Requester = ccClient.Requester
316328
v7Actor := v7action.NewActor(ccClientV3, config, sharedActor, uaaClient, routingClient, clock.NewClock())
317329

318330
cmd.Actor = v7Actor

src/jetstream/plugins/cloudfoundry/main.go

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ func (c *CloudFoundrySpecification) AddSessionGroupRoutes(echoGroup *echo.Group)
202202
func (c *CloudFoundrySpecification) Info(apiEndpoint string, skipSSLValidation bool, caCert string) (api.CNSIRecord, interface{}, error) {
203203
log.Debug("Info")
204204
var v2InfoResponse api.V2Info
205+
var apiRootResponse api.ApiRoot
206+
var endpointInfo api.EndpointInfo
205207
var newCNSI api.CNSIRecord
206208

207209
newCNSI.CNSIType = EndpointType
@@ -211,7 +213,6 @@ func (c *CloudFoundrySpecification) Info(apiEndpoint string, skipSSLValidation b
211213
return newCNSI, nil, err
212214
}
213215

214-
uri.Path = "v2/info"
215216
h := c.portalProxy.GetHttpClient(skipSSLValidation, caCert)
216217

217218
res, err := h.Get(uri.String())
@@ -228,15 +229,36 @@ func (c *CloudFoundrySpecification) Info(apiEndpoint string, skipSSLValidation b
228229
}
229230

230231
dec := json.NewDecoder(res.Body)
231-
if err = dec.Decode(&v2InfoResponse); err != nil {
232+
if err = dec.Decode(&apiRootResponse); err != nil {
233+
return newCNSI, nil, err
234+
}
235+
236+
uri.Path = "v2/info"
237+
238+
res, err = h.Get(uri.String())
239+
if err != nil {
232240
return newCNSI, nil, err
233241
}
234242

243+
if res.StatusCode != 200 {
244+
buf := &bytes.Buffer{}
245+
io.Copy(buf, res.Body)
246+
defer res.Body.Close()
247+
248+
return newCNSI, nil, fmt.Errorf("%s endpoint returned %d\n%s", uri.String(), res.StatusCode, buf)
249+
}
250+
251+
dec = json.NewDecoder(res.Body)
252+
if err = dec.Decode(&v2InfoResponse); err != nil {
253+
return newCNSI, nil, err
254+
}
235255
newCNSI.TokenEndpoint = v2InfoResponse.TokenEndpoint
236256
newCNSI.AuthorizationEndpoint = v2InfoResponse.AuthorizationEndpoint
237257
newCNSI.DopplerLoggingEndpoint = v2InfoResponse.DopplerLoggingEndpoint
238258

239-
return newCNSI, v2InfoResponse, nil
259+
endpointInfo.ApiRoot = apiRootResponse
260+
endpointInfo.V2Info = v2InfoResponse
261+
return newCNSI, endpointInfo, nil
240262
}
241263

242264
func (c *CloudFoundrySpecification) UpdateMetadata(info *api.Info, userGUID string, echoContext echo.Context) {

0 commit comments

Comments
 (0)