-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v2-master' into user-favorites
* v2-master: (34 commits) v2/v3 api docs updates Fix create-services script used to set CF up for E2E tests Only prevent copy & paste in confirm dialog for production Fix for bug causing intermittment E2E Test failures on org tests (#3366) Allow e2e createService 3 attempts at creating service Weekly updaye 18 January (#3365) Change log for 2.3.0 (#3364) Ensure the loading indicator and the refresh button animated at the correct time. (#3363) Fix fetching of stats in app wall for some cases when list is maxed (#3360) Fix CF-Level Metrics permissions check (#3348) About Page Title customization support (#3356) Revert loading indicator fixes Fix app state to allow start action for offline while updating (#3350) Fix display of percent tooltip on metrics chart (#3361) Ensure the SCM type is included in store keys (#3353) Manually make the date selector date a moment object (#3352) Fix filter panel size on services and marketplace pages (#3358) Tidy up org spce reducer logic Remove full stops from empty list messages - fixes #3340 Fix search by space name in manage users space roles table - fixes #3329 ...
- Loading branch information
Showing
78 changed files
with
1,184 additions
and
386 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
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,168 @@ | ||
#!/bin/bash | ||
|
||
echo "=================" | ||
echo "Stratos Helm Test" | ||
echo "=================" | ||
|
||
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" | ||
|
||
set -e | ||
|
||
# We should be running in the Stratos GitHub folder | ||
|
||
NAME=stratos-test | ||
NAMESPACE=stratos-ns | ||
HELM_REPO=https://cloudfoundry-incubator.github.io/stratos | ||
HELM_REPO_NAME=cfstratos | ||
|
||
DEV_IMAGE_VERSION=2.0.0-dev | ||
|
||
function deleteRelease { | ||
helm delete ${NAME} --purge | ||
kubectl delete namespace ${NAMESPACE} | ||
|
||
local DONE="false" | ||
while [ $DONE != "true" ]; do | ||
COUNT=$(kubectl get namespaces | grep ${NAMESPACE} | wc -l) | ||
if [ $COUNT -eq 0 ]; then | ||
DONE="true" | ||
else | ||
echo "Waiting for namespace to terminate..." | ||
sleep 10 | ||
fi | ||
done | ||
} | ||
|
||
function waitForHelmRelease { | ||
echo "Waiting for Stratos Helm Release to be ready..." | ||
local DONE="false" | ||
while [ $DONE != "true" ]; do | ||
COUNT=$(kubectl get po --namespace=${NAMESPACE} | wc -l) | ||
kubectl get po --namespace=${NAMESPACE} | ||
if [ $COUNT -eq 3 ]; then | ||
READY=$(kubectl get po --namespace=${NAMESPACE} | grep "Running" | wc -l) | ||
if [ $READY -eq 2 ]; then | ||
READY1=$(kubectl get po --namespace=${NAMESPACE} | grep "3/3" | wc -l) | ||
READY2=$(kubectl get po --namespace=${NAMESPACE} | grep "1/1" | wc -l) | ||
READY=$(($READY1 + $READY2)) | ||
if [ $READY -eq 2 ]; then | ||
DONE="true" | ||
fi | ||
fi | ||
fi | ||
if [ "$DONE" != "true" ]; then | ||
echo "Waiting for Stratos Helm release to be ready..." | ||
sleep 5 | ||
fi | ||
done | ||
} | ||
|
||
function checkVersion { | ||
VERS=$1 | ||
STATUS=$(helm list ${NAME} | grep ${NAME}) | ||
STATUS=$(echo $STATUS | awk '{$1=$1};1') | ||
local HELM_STATUS_REGEX='^([a-z\-]*) ([0-9]*) ([A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]) ([A-Z]*) ([0-9\.a-z\-]*) ([0-9\.]*) ([a-z\-]*)' | ||
echo -e $STATUS | ||
if [[ "${STATUS}" =~ ${HELM_STATUS_REGEX} ]]; then | ||
# 6 is version | ||
if [ "${BASH_REMATCH[5]}" != "${VERS}" ]; then | ||
echo "Deployed version number incorrect" | ||
exit 1 | ||
fi | ||
else | ||
echo "Helm status parsing failed" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function log { | ||
MSG=$1 | ||
echo -e "${CYAN}${BOLD}${MSG}${RESET}" | ||
} | ||
|
||
log "Performing checks..." | ||
|
||
# Check that a helm release from a previous run is not still deployed | ||
EXISTING=$(helm list | grep ${NAME} | wc -l) | ||
if [ "$EXISTING" -ne 0 ]; then | ||
echo "Stratos is already deployed - deleting" | ||
deleteRelease | ||
fi | ||
|
||
# Check that we have the Stratos Open Source Helm Repository | ||
EXISTING=$(helm repo list | grep ${HELM_REPO_NAME} | wc -l) | ||
if [ "$EXISTING" -ne 1 ]; then | ||
echo "Stratos Helm Repository not added - adding" | ||
helm repo add ${HELM_REPO_NAME} ${HELM_REPO} | ||
fi | ||
|
||
# Update repos | ||
helm repo update | ||
|
||
# List Helm chart latest version | ||
helm search ${HELM_REPO_NAME}/console | ||
|
||
# Install latest version first | ||
log "Installing latest release" | ||
helm install ${HELM_REPO_NAME}/console --name ${NAME} --namespace ${NAMESPACE} | ||
|
||
# Wait for the chart to deploy and be ready | ||
waitForHelmRelease | ||
|
||
# Try and upgrade to the latest Chart | ||
|
||
# Copy the helm chart folder to a temp location | ||
TMP_DIR=${TMP_DIR:-/tmp} | ||
HELM_TMP=${TMP_DIR}/stratos_helm_test | ||
echo $HELM_TMP | ||
|
||
rm -rf ${HELM_TMP} | ||
mkdir -p ${HELM_TMP} | ||
cp -R "${STRATOS}/deploy/kubernetes/console" ${HELM_TMP} | ||
|
||
pushd ${HELM_TMP} > /dev/null | ||
# Make sure we can package the chart | ||
helm package ${HELM_TMP}/console | ||
|
||
CHART_FILE=$(ls ${HELM_TMP}/*.tgz) | ||
CHART_FILE=$(printf %q "${CHART_FILE}") | ||
echo "Chart file path: ${CHART_FILE}" | ||
|
||
popd > /dev/null | ||
|
||
log "Upgrading using latest Helm Chart" | ||
helm upgrade ${NAME} ${CHART_FILE} --recreate-pods --debug --set consoleVersion=${DEV_IMAGE_VERSION} --set imagePullPolicy=Always | ||
|
||
checkVersion console-0.1.0 | ||
waitForHelmRelease | ||
|
||
# Change just the chart version and try to upgrade | ||
sed -i.bak -e 's/version: 0.1.0/version: 0.2.0/g' ${HELM_TMP}/console/Chart.yaml | ||
sed -i.bak -e 's/appVersion: 0.1.0/appVersion: 0.2.0/g' ${HELM_TMP}/console/Chart.yaml | ||
cat ${HELM_TMP}/console/Chart.yaml | ||
|
||
log "Upgrading using latest Helm Chart (checking chart upgrade)" | ||
helm upgrade ${NAME} ${HELM_TMP}/console --recreate-pods --debug --set consoleVersion=${DEV_IMAGE_VERSION} --set imagePullPolicy=Always | ||
|
||
waitForHelmRelease | ||
checkVersion console-0.2.0 | ||
|
||
# Upgrade test passed - try simple install of latest chart | ||
deleteRelease | ||
|
||
log "Installing using latest Helm Chart" | ||
helm install ${CHART_FILE} --name ${NAME} --namespace ${NAMESPACE} --set consoleVersion=${DEV_IMAGE_VERSION} --set imagePullPolicy=Always | ||
|
||
waitForHelmRelease | ||
checkVersion console-0.1.0 | ||
|
||
# All okay | ||
deleteRelease | ||
|
||
log "All checks completed" |
Oops, something went wrong.