-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updates pipeline to the latest version (including change to use release-drafter for release) * Wraps all the config into a single helm chart with dependencies * Manually adds subcharts from dependencies to workaround helm terraform provider bug (hashicorp/terraform-provider-helm#405) * Sets fail-fast to false * Sets disable_openapi_validation to true * Waits for sccs to be deleted * Updates validate deploy logic
- Loading branch information
Showing
31 changed files
with
470 additions
and
319 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
PLATFORM="$1" | ||
INFILE_DIR="$2" | ||
OUTFILE_DIR="$3" | ||
|
||
mkdir -p "${OUTFILE_DIR}" | ||
|
||
resources="deployment,statefulset,service,ingress,configmap,secret,serviceaccount" | ||
if [[ "$PLATFORM" == "ocp3" ]] || [[ "$PLATFORM" == "ocp4" ]]; then | ||
resources="${resources},route" | ||
|
||
if [[ "$PLATFORM" == "ocp4" ]]; then | ||
resources="${resources},consolelink" | ||
fi | ||
fi | ||
|
||
ls "${INFILE_DIR}" | while read infile; do | ||
NAMESPACE="${infile//.out/}" | ||
OUTFILE="${OUTFILE_DIR}/${infile}" | ||
|
||
echo "Checking on namespace - ${NAMESPACE}" | ||
|
||
if kubectl get namespace "${NAMESPACE}" 1> /dev/null 2> /dev/null; then | ||
echo "Listing resources in namespace - ${resources}" | ||
|
||
kubectl get -n "${NAMESPACE}" "${resources}" -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.kind}{"/"}{.metadata.name}{"\n"}{end}' | \ | ||
tr '[:upper:]' '[:lower:]' > "${OUTFILE}" | ||
else | ||
echo "Namespace does not exist - ${NAMESPACE}" | ||
touch "${OUTFILE}" | ||
fi | ||
|
||
if kubectl get subscription -n "${NAMESPACE}" 1> /dev/null 2> /dev/null; then | ||
kubectl get -n "${NAMESPACE}" subscription -o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.kind}{"/"}{.metadata.name}{"\n"}{end}' 2> /dev/null | \ | ||
tr '[:upper:]' '[:lower:]' >> "${OUTFILE}" | ||
fi | ||
|
||
cat "${OUTFILE}" | ||
done |
File renamed without changes.
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,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(cd $(dirname $0); pwd -P) | ||
|
||
CLUSTER_TYPE="$1" | ||
NAMESPACE="$2" | ||
NAME="$3" | ||
|
||
if [[ -z "${NAME}" ]]; then | ||
NAME=$(echo "${NAMESPACE}" | sed "s/tools-//") | ||
fi | ||
|
||
echo "Verifying resources in ${NAMESPACE} namespace for module ${NAME}" | ||
|
||
PODS=$(kubectl get -n "${NAMESPACE}" pods -o jsonpath='{range .items[*]}{.status.phase}{": "}{.kind}{"/"}{.metadata.name}{"\n"}{end}' | grep -v "Running" | grep -v "Succeeded") | ||
POD_STATUSES=$(echo "${PODS}" | sed -E "s/(.*):.*/\1/g") | ||
if [[ -n "${POD_STATUSES}" ]]; then | ||
echo " Pods have non-success statuses: ${PODS}" | ||
exit 1 | ||
fi | ||
|
||
set -e | ||
|
||
if [[ "${CLUSTER_TYPE}" == "kubernetes" ]] || [[ "${CLUSTER_TYPE}" =~ iks.* ]]; then | ||
ENDPOINTS=$(kubectl get ingress -n "${NAMESPACE}" -o jsonpath='{range .items[*]}{range .spec.rules[*]}{"https://"}{.host}{"\n"}{end}{end}') | ||
else | ||
ENDPOINTS=$(kubectl get route -n "${NAMESPACE}" -o jsonpath='{range .items[*]}{"https://"}{.spec.host}{"\n"}{end}') | ||
fi | ||
|
||
echo "Validating endpoints:\n${ENDPOINTS}" | ||
|
||
echo "${ENDPOINTS}" | while read endpoint; do | ||
if [[ -n "${endpoint}" ]]; then | ||
${SCRIPT_DIR}/waitForEndpoint.sh "${endpoint}" 10 10 | ||
fi | ||
done | ||
|
||
CONFIG_URLS=$(kubectl get configmap -n "${NAMESPACE}" -l grouping=garage-cloud-native-toolkit -l app.kubernetes.io/component=tools -o json | jq '.items[].data | to_entries | select(.[].key | endswith("_URL")) | .[].value' | sed "s/\"//g") | ||
|
||
echo "${CONFIG_URLS}" | while read url; do | ||
if [[ -n "${url}" ]]; then | ||
${SCRIPT_DIR}/waitForEndpoint.sh "${url}" 10 10 | ||
fi | ||
done | ||
|
||
if [[ "${CLUSTER_TYPE}" == "ocp4" ]]; then | ||
echo "Validating consolelink" | ||
if [[ $(kubectl get consolelink "toolkit-${NAME}" | wc -l) -eq 0 ]]; then | ||
echo " ConsoleLink not found" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
exit 0 |
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,95 @@ | ||
#!/usr/bin/env bash | ||
|
||
CLUSTER_TYPE="$1" | ||
|
||
OUTER_LENGTH=$(yq r ./resources.yaml --length) | ||
|
||
outer_index=0 | ||
|
||
while [ $outer_index -lt "${OUTER_LENGTH}" ]; do | ||
NAMESPACE=$(yq read ./resources.yaml "[$outer_index].namespace") | ||
|
||
echo "Verifying resources in $NAMESPACE namespace" | ||
|
||
LENGTH=$(yq r ./resources.yaml "[$outer_index].resources" --length) | ||
|
||
index=0 | ||
while [ $index -lt "${LENGTH}" ]; do | ||
kind=$(yq r ./resources.yaml "[$outer_index].resources[$index].kind") | ||
name=$(yq r ./resources.yaml "[$outer_index].resources[$index].name") | ||
label=$(yq r ./resources.yaml "[$outer_index].resources[$index].label") | ||
|
||
destroy=$(yq r ./resources.yaml "[$outer_index].resources[$index].destroy") | ||
when_field=$(yq r ./resources.yaml "[$outer_index].resources[$index].when.field") | ||
when_operation=$(yq r ./resources.yaml "[$outer_index].resources[$index].when.operation") | ||
when_value=$(yq r ./resources.yaml "[$outer_index].resources[$index].when.value") | ||
|
||
if [[ -z "$when_operation" ]]; then | ||
when_operation="equal" | ||
fi | ||
|
||
index=$((index + 1)) | ||
|
||
if [[ -n $when_field ]] && [[ -n $when_value ]]; then | ||
if [[ "$when_operation" == "equal" ]]; then | ||
if [[ "${!when_field}" != "$when_value" ]]; then | ||
continue | ||
fi | ||
else | ||
if [[ "${!when_field}" == "$when_value" ]]; then | ||
continue | ||
fi | ||
fi | ||
fi | ||
|
||
if [[ "${NAMESPACE}" == "*" ]]; then | ||
namespace="--all-namespaces" | ||
else | ||
namespace="-n ${NAMESPACE}" | ||
fi | ||
|
||
if [[ "$destroy" == "false" ]]; then | ||
destroy_description="no destroy" | ||
else | ||
destroy_description="destroy" | ||
fi | ||
|
||
if [[ -n $name ]]; then | ||
echo " Verifying $destroy_description of $kind/$name" | ||
|
||
if kubectl get $namespace $kind $name 1> /dev/null 2> /dev/null; then | ||
if [[ "$destroy" != "false" ]]; then | ||
echo " Error: Found unexpected resources after destroy: $kind/$name" | ||
exit 1 | ||
fi | ||
elif [[ "$destroy" == "false" ]]; then | ||
echo " Error: Missing expected resource(s) after destroy: $kind/$name" | ||
exit 1 | ||
fi | ||
else | ||
description="" | ||
command_args="" | ||
if [[ -n $label ]]; then | ||
description="with label=$label" | ||
command_args="-l $label" | ||
fi | ||
|
||
echo " Verifying $destroy_description of $kind $description" | ||
|
||
resource_count=$(kubectl get $namespace $kind $command_args -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | wc -l) | ||
|
||
if [[ "$resource_count" -gt 0 ]]; then | ||
if [[ "$destroy" != "false" ]]; then | ||
echo " Error: Found unexpected resources after destroy: $kind $command_args" | ||
kubectl get $namespace $kind $command_args | ||
exit 1 | ||
fi | ||
elif [[ "$destroy" == "false" ]]; then | ||
echo " Error: Missing expected resource(s) after destroy: $kind $command_args" | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
|
||
outer_index=$((outer_index + 1)) | ||
done |
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,31 @@ | ||
URL="$1" | ||
WAIT_TIME=$2 | ||
WAIT_COUNT=$3 | ||
|
||
if [[ -z "${WAIT_TIME}" ]]; then | ||
WAIT_TIME=15 | ||
fi | ||
|
||
if [[ -z "${WAIT_COUNT}" ]]; then | ||
WAIT_COUNT=20 | ||
fi | ||
|
||
count=0 | ||
|
||
sleep 20 | ||
|
||
until [[ $(curl -X GET -Iq --insecure "${URL}" | grep -E "403|200") ]] || \ | ||
[[ $count -eq ${WAIT_COUNT} ]] | ||
do | ||
echo ">>> waiting for ${URL} to be available" | ||
sleep ${WAIT_TIME} | ||
count=$((count + 1)) | ||
done | ||
|
||
if [[ $count -eq ${WAIT_COUNT} ]]; then | ||
echo ">>> Retry count exceeded. ${URL} not avilable" | ||
exit 1 | ||
else | ||
echo ">>> ${URL} is avilable" | ||
fi | ||
|
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.