Skip to content

Commit

Permalink
Merge pull request #8 from cloudfoundry-incubator/v2-master
Browse files Browse the repository at this point in the history
Merge in upstream v2-master
  • Loading branch information
Irfan Habib authored Jun 26, 2018
2 parents 32f1fc5 + f6ea4a3 commit 62f9ad8
Show file tree
Hide file tree
Showing 17 changed files with 229 additions and 86 deletions.
13 changes: 7 additions & 6 deletions deploy/ci/console-dev-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ resources:
branch: ((stratos-branch))
private_key: ((github-private-key))
tag_filter: "2*"
- name: stratos-master
- name: helm-repo
type: git
source:
uri: [email protected]:((github-organization))/((github-repository))
branch: master
uri: [email protected]:((helm-repo-github-organization))/((helm-repo-github-repository))
branch: ((helm-repo-branch))
private_key: ((github-private-key))
# Docker Images
- name: jetstream-image
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
- get: stratos
passed: [build-images]
trigger: true
- get: stratos-master
- get: helm-repo
- get: image-tag
passed: [build-images]
params:
Expand All @@ -144,6 +144,7 @@ jobs:
GIT_PRIVATE_KEY: ((github-private-key))
DOCKER_ORG: ((artifact-docker-organization))
DOCKER_REGISTRY: ((artifact-docker-registry))
HELM_REPO_PATH: ((helm-repo-path))
- put: helm-chart-tarball
params:
file: helm-chart/*.tgz
Expand All @@ -166,8 +167,8 @@ jobs:
file: stratos/deploy/ci/tasks/dev-releases/update-gh-release.yml
params:
GITHUB_TOKEN: ((github-access-token))
GITHUB_USER: ((github-organization))
GITHUB_REPO: ((github-repository))
GITHUB_USER: ((helm-repo-github-organization))
GITHUB_REPO: ((helm-repo-github-repository))
GIT_USER: ((concourse-user))
GIT_EMAIL: ((concourse-email))
GIT_PRIVATE_KEY: ((github-private-key))
12 changes: 6 additions & 6 deletions deploy/ci/tasks/dev-releases/create-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ platform: linux
inputs:
- name: stratos
- name: image-tag
- name: stratos-master
- name: helm-repo
outputs:
- name: helm-chart
image_resource:
Expand All @@ -23,7 +23,7 @@ run:
ROOT_DIR=$PWD
STRATOS=${ROOT_DIR}/stratos
source ${STRATOS}/deploy/ci/tasks/dev-releases/create-chart-helper.sh
STRATOS_MASTER=${ROOT_DIR}/stratos-master
HELM_REPO=${ROOT_DIR}/helm-repo/${HELM_REPO_PATH}
GIT_TAG=$(cat image-tag/v2-alpha-tag)
cd ${STRATOS}/deploy/kubernetes/
patchHelmChart ${GIT_TAG} ${DOCKER_ORG} ${DOCKER_REGISTRY} ./console
Expand All @@ -32,13 +32,13 @@ run:
helm package console
cp console*.tgz ${ROOT_DIR}/helm-chart/console-helm-chart-${GIT_TAG}.tgz
cd ${ROOT_DIR}/helm-chart/
if [ -f ${STRATOS_MASTER}/index.yaml ]; then
cp ${STRATOS_MASTER}/index.yaml ${ROOT_DIR}/helm-chart/
if [ -f ${HELM_REPO}/index.yaml ]; then
cp ${HELM_REPO}/index.yaml ${ROOT_DIR}/helm-chart/
MERGE_INDEX="--merge index.yaml"
fi
# Update Helm Repository
helm repo index ./ ${MERGE_INDEX} --url https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${GIT_TAG}/
cp index.yaml ${STRATOS_MASTER}
cd ${STRATOS_MASTER}
cp index.yaml ${HELM_REPO}
cd ${HELM_REPO}
setupAndPushChange
1 change: 1 addition & 0 deletions deploy/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The following guide details how to deploy Stratos in Kubernetes.
* [Deploying Stratos with your own TLS certificates](#deploying-stratos-with-your-own-tls-certificates)
* [Using with a Secure Image Repostiory](#using-with-a-secure-image-repository)
* [Installing Nightly Release](#installing-a-nightly-release)
* [Configuring Stratos to use an Ingress controller](./ingress)
<!-- /TOC -->

## Requirements
Expand Down
39 changes: 39 additions & 0 deletions deploy/kubernetes/ingress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Configuring Ingress

You can make Stratos available via Ingress by following the instructions below.

Ensure that you have Ingress deployed in your Kubernetes environment.

To do this using Helm follow the instructions here: https://github.com/nginxinc/kubernetes-ingress/tree/master/helm-chart.

If you want to use your own certificate, follow the link above for how to do this along with more advanced configuring options.

Briefly, this involves running:

```
git clone [email protected]:nginxinc/kubernetes-ingress.git
cd kubernetes-ingress/helm-chart
helm install --name ingress .
```

Wait for the Ingress controller pod to be in the Running state.

Now, edit the `ingress.xml` in this folder to suit your needs - most likely you will want to change:

- metadata.namespace to the namespace that you using when deploying Stratos

- spec.rules.host and spec.tls.hosts to change the host from stratos.127.0.0.1.xip.io to suit your deployment

Finally, deploy the Ingress configuraation with:

```
kubectl apply -f ./ingress.yml
```

You should now be able to access Stratos via the URL:

```
https://stratos.127.0.0.1.xip.io
```

Note if you changed the host in the ingress.yml file, this URL will of course need to be adjusted.
21 changes: 21 additions & 0 deletions deploy/kubernetes/ingress/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: stratos
namespace: stratos
annotations:
nginx.org/ssl-services: "stratos-ui-ext"
nginx.org/websocket-services: "stratos-ui-ext"
spec:
rules:
- host: stratos.127.0.0.1.xip.io
http:
paths:
- path: /
backend:
serviceName: stratos-ui-ext
servicePort: 443
tls:
- hosts:
- stratos.127.0.0.1.xip.io
secretName: stratos-tls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { first, map, publishReplay, refCount } from 'rxjs/operators';
import { Observable, combineLatest } from 'rxjs';
import { first, map, publishReplay, refCount, switchMap } from 'rxjs/operators';

import { IApp, ICfV2Info, IOrganization, ISpace } from '../../../core/cf-api.types';
import { EntityService } from '../../../core/entity-service';
Expand Down Expand Up @@ -32,6 +32,7 @@ import { CfApplicationState } from '../../../store/types/application.types';
import { EndpointModel, EndpointUser } from '../../../store/types/endpoint.types';
import { CfUser } from '../../../store/types/user.types';
import { ActiveRouteCfOrgSpace } from '../cf-page.types';
import { selectEntity } from '../../../store/selectors/api.selectors';

export function appDataSort(app1: APIResource<IApp>, app2: APIResource<IApp>): number {
const app1Date = new Date(app1.metadata.updated_at);
Expand Down Expand Up @@ -138,20 +139,8 @@ export class CloudFoundryEndpointService {
this.info$ = this.cfInfoEntityService.waitForEntity$;

this.allApps$ = this.orgs$.pipe(
map(p => {
return p
.filter(o => !!o.entity.spaces)
.map(o => {
return o.entity.spaces.map(space => space.entity.apps || []);
});
}),
map(a => {
let flatArray = [];
a.forEach(
appsInSpace => (flatArray = flatArray.concat(...appsInSpace))
);
return flatArray;
})
map(orgs => [].concat(...orgs.map(org => org.entity.spaces))),
map((spaces: APIResource<ISpace>[]) => [].concat(...spaces.map(space => space.entity.apps)))
);

this.fetchDomains();
Expand Down Expand Up @@ -209,7 +198,7 @@ export class CloudFoundryEndpointService {
statMetric: string
): number {
return apps ? apps
.filter(a => a.entity.state !== CfApplicationState.STOPPED)
.filter(a => a.entity && a.entity.state !== CfApplicationState.STOPPED)
.map(a => a.entity[statMetric] * a.entity.instances)
.reduce((a, t) => a + t, 0) : 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
SetCreateServiceInstanceCFDetails,
SetCreateServiceInstanceServiceGuid,
SetServiceInstanceGuid,
ResetCreateServiceInstanceOrgAndSpaceState,
} from '../../../../store/actions/create-service-instance.actions';
import { GetServiceInstance } from '../../../../store/actions/service-instances.actions';
import { GetAllAppsInSpace, GetSpace } from '../../../../store/actions/space.actions';
Expand Down Expand Up @@ -81,7 +82,6 @@ export class AddServiceInstanceComponent implements OnDestroy, AfterContentInit
this.inMarketplaceMode = this.modeService.isMarketplaceMode();
}
ngAfterContentInit(): void {

// Check if wizard has been initiated from the Services Marketplace
if (this.inMarketplaceMode) {
this.initialisedService$ = this.initialiseForMarketplaceMode();
Expand All @@ -102,18 +102,15 @@ export class AddServiceInstanceComponent implements OnDestroy, AfterContentInit
this.skipApps$ = this.store.select(selectCreateServiceInstance).pipe(
filter(p => !!p && !!p.spaceGuid && !!p.cfGuid),
switchMap(createServiceInstance => {
const paginationKey = createEntityRelationPaginationKey(spaceSchemaKey, createServiceInstance.spaceGuid);
return getPaginationObservables<APIResource<IApp>>({
store: this.store,
action: new GetAllAppsInSpace(createServiceInstance.cfGuid, createServiceInstance.spaceGuid, paginationKey),
paginationMonitor: this.paginationMonitorFactory.create(
paginationKey,
entityFactory(applicationSchemaKey)
)
}, true).entities$;
}),
map(apps => apps.length === 0)
);
const paginationKey = createEntityRelationPaginationKey(spaceSchemaKey, createServiceInstance.spaceGuid);
return getPaginationObservables<APIResource<IApp>>({
store: this.store,
action: new GetAllAppsInSpace(createServiceInstance.cfGuid, createServiceInstance.spaceGuid, paginationKey),
paginationMonitor: this.paginationMonitorFactory.create(paginationKey, entityFactory(applicationSchemaKey))
}, true).entities$;
}),
map(apps => apps.length === 0)
);
}

onNext = () => {
Expand All @@ -126,7 +123,11 @@ export class AddServiceInstanceComponent implements OnDestroy, AfterContentInit
}

resetStoreData = () => {
this.store.dispatch(new ResetCreateServiceInstanceState());
if (this.inMarketplaceMode) {
this.store.dispatch(new ResetCreateServiceInstanceOrgAndSpaceState());
} else if (this.modeService.isServicesWallMode()) {
this.store.dispatch(new ResetCreateServiceInstanceState());
}
}

private getIdsFromRoute() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ describe('ServiceInstanceCardComponent', () => {
updated_at: '',
created_at: ''
},
service: {
entity: {
label: '',
description: '',
active: 1,
bindable: 1,
unique_id: '',
extra: '',
tags: [''],
requires: [''],
service_broker_guid: '',
plan_updateable: 1,
service_plans_url: '',
service_plans: [],
},
metadata: null
},
service_plan: {
entity: {
name: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class ServiceInstanceCardComponent extends CardCell<APIResource<IServiceI
)

getServiceName = () => {
const serviceEntity = this.serviceInstanceEntity.entity.service_plan.entity.service;
const serviceEntity = this.serviceInstanceEntity.entity.service;
let extraInfo: IServiceExtra = null;
try {
extraInfo = serviceEntity.entity.extra ? JSON.parse(serviceEntity.entity.extra) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const SET_SERVICE_INSTANCE_SPACE_SCOPED = '[Create SI] Set Service Instan
export const SET_SERVICE_INSTANCE_SVC_GUID = '[Create SI] Set Service Instance Service Guid';
export const SET_SERVICE_INSTANCE_APP = '[Create SI] Set Service Instance App';
export const RESET_CREATE_SERVICE_INSTANCE_STATE = '[Create SI] Reset State';
export const RESET_CREATE_SERVICE_INSTANCE_STATE_ORG_SPACE = '[Create SI] Reset Partial Org Space State';

export class SetServicePlan implements Action {
constructor(public servicePlanGuid: string) { }
Expand Down Expand Up @@ -61,6 +62,10 @@ export class ResetCreateServiceInstanceState implements Action {
constructor() { }
type = RESET_CREATE_SERVICE_INSTANCE_STATE;
}
export class ResetCreateServiceInstanceOrgAndSpaceState implements Action {
constructor() { }
type = RESET_CREATE_SERVICE_INSTANCE_STATE_ORG_SPACE;
}
export class SetCreateServiceInstanceCFDetails implements Action {
constructor(
public cfGuid: string,
Expand Down
24 changes: 11 additions & 13 deletions src/frontend/app/store/actions/service-instances.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ import { getActions } from './action.helper';

export const DELETE_SERVICE_BINDING = '[Service Instances] Delete service binding';
export const UPDATE_SERVICE_INSTANCE_SUCCESS = getActions('Service Instances', 'Update Service Instance')[1];
export const getServiceInstanceRelations = [
createEntityRelationKey(serviceInstancesSchemaKey, serviceBindingSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, servicePlanSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, spaceSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, serviceSchemaKey),
createEntityRelationKey(spaceSchemaKey, organizationSchemaKey),
createEntityRelationKey(serviceBindingSchemaKey, applicationSchemaKey)
];

export class GetServiceInstances
extends CFStartAction implements PaginationAction, EntityInlineParentAction {
constructor(
public endpointGuid: string,
public paginationKey: string,
public includeRelations: string[] = [
createEntityRelationKey(serviceInstancesSchemaKey, serviceBindingSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, servicePlanSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, spaceSchemaKey),
createEntityRelationKey(spaceSchemaKey, organizationSchemaKey),
createEntityRelationKey(servicePlanSchemaKey, serviceSchemaKey),
createEntityRelationKey(serviceBindingSchemaKey, applicationSchemaKey)
],
public includeRelations: string[] = getServiceInstanceRelations,
public populateMissing = true
) {
super();
Expand All @@ -62,10 +63,7 @@ export class GetServiceInstance
constructor(
public guid: string,
public endpointGuid: string,
public includeRelations: string[] = [
createEntityRelationKey(serviceInstancesSchemaKey, serviceBindingSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, servicePlanSchemaKey)
],
public includeRelations: string[] = getServiceInstanceRelations,
public populateMissing = true
) {
super();
Expand All @@ -75,7 +73,7 @@ export class GetServiceInstance
this.options.params = new URLSearchParams();
}
actions = getActions('Service Instances', 'Get particular instance');
entity = [entityFactory(serviceInstancesSchemaKey)];
entity = [entityFactory(serviceInstancesWithSpaceSchemaKey)];
entityKey = serviceInstancesSchemaKey;
options: RequestOptions;
}
Expand Down
10 changes: 2 additions & 8 deletions src/frontend/app/store/actions/space.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { CFStartAction, ICFAction } from '../types/request.types';
import { getActions } from './action.helper';
import { RouteEvents } from './route.actions';
import { GetAllOrgUsers } from './organization.actions';
import { getServiceInstanceRelations } from './service-instances.actions';

export const GET_SPACES = '[Space] Get all';
export const GET_SPACES_SUCCESS = '[Space] Get all success';
Expand Down Expand Up @@ -266,14 +267,7 @@ export class GetServiceInstancesForSpace
public endpointGuid: string,
public paginationKey: string,
public q: QParam[] = null,
public includeRelations: string[] = [
createEntityRelationKey(serviceInstancesSchemaKey, serviceBindingSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, servicePlanSchemaKey),
createEntityRelationKey(serviceInstancesSchemaKey, spaceSchemaKey),
createEntityRelationKey(spaceSchemaKey, organizationSchemaKey),
createEntityRelationKey(servicePlanSchemaKey, serviceSchemaKey),
createEntityRelationKey(serviceBindingSchemaKey, applicationSchemaKey)
],
public includeRelations: string[] = getServiceInstanceRelations,
public populateMissing = true,
public flattenPagination = true
) {
Expand Down
Loading

0 comments on commit 62f9ad8

Please sign in to comment.