Skip to content

Commit

Permalink
Merge v2 master to master (#4050)
Browse files Browse the repository at this point in the history
* Follow redirect - needed for repo move

* Update metric used for cells (#4009)

- `firehose_value_metric_rep_unhealthy_cell` deprecated, now use `firehose_value_metric_rep_garden_health_check_failed`
- Try new metric first and fall back on old

* Fix incorrect SSO behaviour following 2.4.0 --> 2.6.0 upgrade (#4015)

- affects db migration of console config table to new config table
- fixes #4013

* 2.6.1 Release preparation

* Ingress fix (#4024)

* Fixes ingress and kube 1.16 version issue

* Update Changelog

* More test

* Fix ingress tests

* Show more service instance last operation details

* Show service instance service broker

* Handle last operation & broker in table view

* Show the service broker name in the service list service card

* Mention STRATOS_BP_DEBUG to troubleshoot staging (#4039)

* Backend changs to support long-running requests

* Fix create service instance from service instance page

* Fix unit tests

* Ensure service plans are sorted by display name
- sometimes these are fetched inline which aren't sorted

* Fix helm chart issue with semver (#4046)

* Handle Long Running Service Instance Operations
- Some brokers take a long time to execute create, update and delete service instance operations
- This time exceeded the amount allowed by browser/jetstream
- We now provide a custom response to the front end when this happens
- Front end then handles this and also shows a custom error message

* Fixes post merge

* Changes and tidy up post review
- Use a common way to get a service name, service link, broker name
- Split out cf specific long running functionality
- Show service as a link in app service instance card
- Show service plan and broker in app service instance card
- Update the service instance entity on Update as well as Delete
  (will show a better 'last operation' value)

* Fixes post merge

* Fix failing unit tests

* Improvements to error/notification process
- Show mini error message, as per create, when updating service instance
- Handle all 5XX status codes as errors
- Update messages to reflect varience of error states
- Show single popover message on error dismiss all button
- Correct error page selector

* Treat calls to multiple endpoints as `global`
- calls where we generate the endpoint lists (app wall, etc) were handled badly by jetstreamErrorHandler
- this was due to the internal event storing endpoint id as `` instead of one per endpoint
- this happened due to the list of generated endpoints being applied directly to request object in lower function
- treat these as global for the moment

* More fixes

* Fix failing e2e test

* Show last operation and service broker info for service instances (#4038)

* Show more service instance last operation details

* Show service instance service broker

* Handle last operation & broker in table view

* Show the service broker name in the service list service card

* Fix create service instance from service instance page

* Fix unit tests

* Fix failing e2e test

* Fix bad merge

* Fix failing tests

Co-authored-by: Neil MacDougall <[email protected]>
Co-authored-by: Guillaume Berche <[email protected]>
  • Loading branch information
3 people committed Jan 6, 2020
1 parent 337332f commit cfeffa9
Show file tree
Hide file tree
Showing 68 changed files with 1,193 additions and 274 deletions.
1 change: 1 addition & 0 deletions deploy/all-in-one/config.all-in-one.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DATABASE_PROVIDER=sqlite
HTTP_CONNECTION_TIMEOUT_IN_SECS=10
HTTP_CLIENT_TIMEOUT_IN_SECS=30
HTTP_CLIENT_TIMEOUT_MUTATING_IN_SECS=120
HTTP_CLIENT_TIMEOUT_LONGRUNNING_IN_SECS=600
CONSOLE_PROXY_TLS_ADDRESS=:443
CF_ADMIN_ROLE=cloud_controller.admin
CF_CLIENT=cf
Expand Down
216 changes: 216 additions & 0 deletions deploy/ci/automation/helm-chart-version-checking.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
#!/bin/bash

echo "========================="
echo "Stratos Helm Version Test"
echo "========================="

# This scrips does dry-run installs using differnt Helm and Kube versions

DIRPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
STRATOS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../../.. && pwd)"

CYAN="\033[96m"
YELLOW="\033[93m"
RESET="\033[0m"
BOLD="\033[1m"

function log {
MSG=$1
echo -e "${CYAN}${BOLD}${MSG}${RESET}"
}

declare -a HELM_VERSIONS=("3.0.0" "2.16.1" "2.15.2" "2.14.3")

set -e

# We should be running in the Stratos GitHub folder

NAME=stratos-test
NAMESPACE=stratos-ns
HELM_REPO=https://cloudfoundry.github.io/stratos
HELM_REPO_NAME=cfstratos

TEMP_FOLDER=${STRATOS}/tmp/helm
mkdir -p ${TEMP_FOLDER}

log "Building Helm chart ..."
pushd "${STRATOS}/deploy/kubernetes" > /dev/null
./build.sh -c -t helmtest
popd > /dev/null

log "Preparing environment ..."

pushd "${TEMP_FOLDER}" > /dev/null

export HELM_HOME=${TEMP_FOLDER}

function getKind {
if [ ! -f "./kind" ]; then
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.6.1/kind-$(uname)-amd64
chmod +x ./kind
fi
}

function getHelm {
UNAME=`uname | awk '{print tolower($0)}'`
if [ ! -f "./helm_${1}" ]; then
log "Getting helm version ${1} [${UNAME}]"
curl -Lo ./helm_${1}.tar.gz https://get.helm.sh/helm-v${1}-${UNAME}-amd64.tar.gz
tar -xvzf ./helm_${1}.tar.gz
mv ./${UNAME}-amd64/helm ./helm_${1}
chmod +x ./helm_${1}
rm -rf ./helm_${1}.tar.gz
rm -rf ./${UNAME}-amd64
fi
}

function getKubectl {
UNAME=`uname | awk '{print tolower($0)}'`
if [ ! -f "./kubectl_${2}" ]; then
log "Getting kubectl version ${1}"
curl -Lo ./kubectl_${2} https://storage.googleapis.com/kubernetes-release/release/v${1}/bin/${UNAME}/amd64/kubectl
chmod +x ./kubectl_${2}
fi
}

function cleanup {
if [ -f "./kind" ]; then
log "Cleaning up"
./kind delete cluster
fi
}

function wait_for_pods {
DONE="false"
NS="$1"

echo "Waiting for all pods in namespace '$NS' to be ready"
sleep 5

PROGRESS="."

while [ $DONE != "true" ]; do
PODS=`kubectl get po --namespace=$NS | wc -l`
RUNNING=`kubectl get po --namespace=$NS | grep 'Running' | wc -l`
COMPLETED=`kubectl get po --namespace=$NS | grep 'Completed' | wc -l`
NOTREADY=`kubectl get po --namespace=$NS | grep '0//*' | wc -l`
PODS=$((PODS-1))
OKAY=$((RUNNING+COMPLETED))
NOTREADY=$((NOTREADY-COMPLETED))

if [ "$PODS" == "$OKAY" ] && [ "$NOTREADY" == "0" ]; then
echo ""
echo "All pods are running"
DONE="true"
else
kubectl get po --namespace=$NS
echo ""
printf "\r${PODS} pods ($RUNNING are running, $NOTREADY are not yet ready) $PROGRESS "
printf "\r${PODS} pods ($RUNNING are running, $NOTREADY are not yet ready) $PROGRESS "
PROGRESS="$PROGRESS."

if [ ${#PROGRESS} -eq 10 ]; then
PROGRESS="."
fi
fi

echo ""

sleep 5
done

echo "Finished waiting for all pods in namespace '$NS'"
}

function do_chart_tests {


log "Preparing test run"
${KUBECTL} cluster-info --context kind-kind
${KUBECTL} version
${KUBECTL} get nodes

for i in "${HELM_VERSIONS[@]}"
do
if [ "$i" != "$1" ]; then
log "========================================================================"
log "Testing Stratos with Helm version $i on Kubernetes ${KUBE}"
./helm_$i init
./helm_$i version --client

HELM_MAJOR="${i:0:1}"
echo ${HELM_MAJOR}

# V2 and V3 are different
if [ "${HELM_MAJOR}" == "3" ]; then
./helm_$i install stratos "${STRATOS}/deploy/kubernetes/helm-chart" --namespace stratos --dry-run
else
./helm_$i init --upgrade --force-upgrade
wait_for_pods "kube-system"
# Don't actually install, just check we can render the chart
./helm_$i install "${STRATOS}/deploy/kubernetes/helm-chart" --name stratos --namespace stratos --dry-run
fi
log "Done Stratos with Helm version $i on Kubernetes ${KUBE}"
log "========================================================================"
else
log "Skipping testing with Helm version $i due to compatibility issues"
fi
done

}

# We always using --dry-run so we don't actually install - we are checking rendering only

# Temp folder

# Just check that there was not a kind cluster from an errored run

cleanup

getKind

# Get Helm client for each version
for i in "${HELM_VERSIONS[@]}"
do
getHelm "$i"
done

getKubectl 1.16.3 1.16
getKubectl 1.15.6 1.15
getKubectl 1.14.6 1.14

# Kind image references for a few K8S versions that we care about
K8S_16_IMAGE=kindest/node:v1.16.3
K8S_15_IMAGE=kindest/node:v1.15.6
K8S_14_IMAGE=kindest/node:v1.14.6

# At this point we have the kind and helm tools

# Set up a kind kube 1.14 cluster

log "Kubernetes 1.14 Cluster ..."
KUBE=1.14
./kind create cluster --image ${K8S_14_IMAGE}
KUBECTL=./kubectl_1.14
do_chart_tests
./kind delete cluster

log "Kubernetes 1.15 Cluster ..."
KUBE=1.15
./kind create cluster --image ${K8S_15_IMAGE}
KUBECTL=./kubectl_1.15
do_chart_tests
./kind delete cluster

log "Kubernetes 1.16 Cluster ..."
KUBE=1.16
./kind create cluster --image ${K8S_16_IMAGE}
KUBECTL=./kubectl_1.16

# Helm 2.14.3 won't work with Kubernetes 1.16
do_chart_tests "2.14.3"
./kind delete cluster

log "All checks completed"

popd > /dev/null
1 change: 1 addition & 0 deletions deploy/ci/travis/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DATABASE_PROVIDER=sqlite
HTTP_CONNECTION_TIMEOUT_IN_SECS=10
HTTP_CLIENT_TIMEOUT_IN_SECS=30
HTTP_CLIENT_TIMEOUT_MUTATING_IN_SECS=120
HTTP_CLIENT_TIMEOUT_LONGRUNNING_IN_SECS=600
SKIP_SSL_VALIDATION=true
CONSOLE_PROXY_TLS_ADDRESS=:5443
CONSOLE_CLIENT=console
Expand Down
1 change: 1 addition & 0 deletions deploy/cloud-foundry/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DATABASE_PROVIDER=sqlite
HTTP_CONNECTION_TIMEOUT_IN_SECS=10
HTTP_CLIENT_TIMEOUT_IN_SECS=30
HTTP_CLIENT_TIMEOUT_MUTATING_IN_SECS=120
HTTP_CLIENT_TIMEOUT_LONGRUNNING_IN_SECS=600
SKIP_SSL_VALIDATION=true
CONSOLE_PROXY_TLS_ADDRESS=:443
CONSOLE_CLIENT=console
Expand Down
6 changes: 4 additions & 2 deletions deploy/kubernetes/console/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
{{- if semverCompare ">=1.16" (printf "%s.%s" .Capabilities.KubeVersion.Major .Capabilities.KubeVersion.Minor)}}
{{- if semverCompare ">=1.16" (printf "%s.%s" .Capabilities.KubeVersion.Major (trimSuffix "+" .Capabilities.KubeVersion.Minor) )}}
apiVersion: apps/v1
{{- else }}
apiVersion: apps/v1beta1
Expand Down Expand Up @@ -123,6 +123,8 @@ spec:
value: "30"
- name: HTTP_CLIENT_TIMEOUT_MUTATING_IN_SECS
value: "120"
- name: HTTP_CLIENT_TIMEOUT_LONGRUNNING_IN_SECS
value: "600"
- name: SKIP_TLS_VERIFICATION
value: "false"
- name: CONSOLE_PROXY_TLS_ADDRESS
Expand Down Expand Up @@ -313,7 +315,7 @@ spec:
name: {{ .Values.console.templatesConfigMapName }}
{{- end }}
---
{{- if semverCompare ">=1.16" (printf "%s.%s" .Capabilities.KubeVersion.Major .Capabilities.KubeVersion.Minor)}}
{{- if semverCompare ">=1.16" (printf "%s.%s" .Capabilities.KubeVersion.Major (trimSuffix "+" .Capabilities.KubeVersion.Minor) )}}
apiVersion: apps/v1
{{- else }}
apiVersion: extensions/v1beta1
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/console/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ data:

---
# Ingress for the Console UI service
{{- if semverCompare ">=1.16" (printf "%s.%s" .Capabilities.KubeVersion.Major .Capabilities.KubeVersion.Minor) }}
{{- if semverCompare ">=1.16" (printf "%s.%s" .Capabilities.KubeVersion.Major (trimSuffix "+" .Capabilities.KubeVersion.Minor) ) }}
apiVersion: "networking.k8s.io/v1beta1"
{{- else }}
apiVersion: "extensions/v1beta1"
Expand Down
9 changes: 9 additions & 0 deletions deploy/kubernetes/console/tests/kube_version_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ tests:
- equal:
path: apiVersion
value: apps/v1beta1
- it: should use older API versions when kube is set to 1.14+
capabilities:
kubeVersion:
major: 1
minor: 14+
asserts:
- equal:
path: apiVersion
value: apps/v1beta1
1 change: 1 addition & 0 deletions deploy/proxy.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DB_PORT=3306
HTTP_CONNECTION_TIMEOUT_IN_SECS=10
HTTP_CLIENT_TIMEOUT_IN_SECS=30
HTTP_CLIENT_TIMEOUT_MUTATING_IN_SECS=120
HTTP_CLIENT_TIMEOUT_LONGRUNNING_IN_SECS=600
SKIP_SSL_VALIDATION=true
CONSOLE_PROXY_TLS_ADDRESS=:3003
CONSOLE_CLIENT=console
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
HTTP_CONNECTION_TIMEOUT_IN_SECS=10
HTTP_CLIENT_TIMEOUT_IN_SECS=30
HTTP_CLIENT_TIMEOUT_MUTATING_IN_SECS=120
HTTP_CLIENT_TIMEOUT_LONGRUNNING_IN_SECS=600
SKIP_SSL_VALIDATION=<%= p('stratos_ui.backend.skip_ssl_validation') %>
CONSOLE_PROXY_TLS_ADDRESS=<%= p('stratos_ui.backend.address') %>:<%= p('stratos_ui.backend.port') %>
CF_CLIENT=cf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { HttpHeaders, HttpParams, HttpRequest } from '@angular/common/http';

import { getActions } from '../../../store/src/actions/action.helper';
import { PaginatedAction } from '../../../store/src/types/pagination.types';
import { ICFAction } from '../../../store/src/types/request.types';
Expand All @@ -15,10 +17,8 @@ import {
} from '../cf-entity-types';
import { createEntityRelationKey, EntityInlineParentAction } from '../entity-relations/entity-relations.types';
import { CFStartAction } from './cf-action.types';
import { HttpRequest, HttpParams } from '@angular/common/http';

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 DELETE_SERVICE_INSTANCE_ACTIONS = getActions('Service Instances', 'Get particular instance');
export const getServiceInstanceRelations = [
createEntityRelationKey(serviceInstancesEntityType, serviceBindingEntityType),
createEntityRelationKey(serviceInstancesEntityType, servicePlanEntityType),
Expand Down Expand Up @@ -56,6 +56,7 @@ export class GetServiceInstances
};
flattenPagination = true;
}

export class GetServiceInstance
extends CFStartAction implements EntityInlineParentAction {
constructor(
Expand All @@ -70,7 +71,7 @@ export class GetServiceInstance
`service_instances/${guid}`
);
}
actions = getActions('Service Instances', 'Get particular instance');
actions = DELETE_SERVICE_INSTANCE_ACTIONS;
entity = [cfEntityFactory(serviceInstancesWithSpaceEntityType)];
schemaKey = serviceInstancesWithSpaceEntityType;
entityType = serviceInstancesEntityType;
Expand All @@ -80,10 +81,14 @@ export class GetServiceInstance
export class DeleteServiceInstance extends CFStartAction implements ICFAction {
constructor(public endpointGuid: string, public guid: string) {
super();
const headers = new HttpHeaders({
'x-cap-long-running': 'true'
});
this.options = new HttpRequest(
'DELETE',
`service_instances/${guid}`,
{
headers,
params: new HttpParams({
fromObject: {
accepts_incomplete: 'true',
Expand Down Expand Up @@ -114,6 +119,9 @@ export class CreateServiceInstance extends CFStartAction implements ICFAction {
url = 'service_instances'
) {
super();
const headers = new HttpHeaders({
'x-cap-long-running': 'true'
});
this.options = new HttpRequest(
httpMethod,
url,
Expand All @@ -125,6 +133,7 @@ export class CreateServiceInstance extends CFStartAction implements ICFAction {
tags
},
{
headers,
params: new HttpParams(
{
fromObject: {
Expand Down
Loading

0 comments on commit cfeffa9

Please sign in to comment.